Pigmeo Compiler call stack

From Pigmeo Development Wiki

Jump to: navigation, search

NOTE: This article is obsolete

The entire compilation process is a series of static method calls, in the following order:


Note 1: The names are not always the same as in the real source code.

Note 2: Here you can see functions within functions. They don't exist in reality.

Note 3: Yes, it seems like source code. I think it would be easier to understand.


main(){
    LoadConfigurations()
    ParseConsoleParameters()
    switch(UserInterface){
        case WinForms:
            //Compile() is called when a button is pressed
        case console:
            Compile()
    }
}
 
//compiles everything
Compile(){
    //creates a bundle containing only the required code for the application. The code is taken from the user's .exe and from the assemblies in the GAC
    Frontend(){
        LoadUserApp()
        CreateBundle(){
            CreateListOfReferencedAssemblies()
            AddMainMethodToBundle()
            AddTargetLib() //adds a custom attribute to the assemblie specifying the target architecture and branch (the model of the microcontroller)
        }
        OptimizeBundle()
    }
 
    //converts the bundle to assembly language
    Backend(){
        DetectTargetArchitectureAndBranch()
        switch(Architecture){
            case PIC14:
                BackendPIC14()
            case OtherArchitectures:
                //not yet implemented
        }
    }
 
    //converts the assembly language to machine code
    Assembler(){
        //not yet implemented, it just writes the assembly code to a file
    }
}
 
 
BackendPIC14(){
    OptimiceCIL() //optimizes the bundle for this architecture before converting it to assembly language
    AddKernel() //adds to the bundle all the required functions implemented by Pigmeo, not by the user (calls to native libraries, basic operations with variables...)
    CompileToAsm(){
        AddHeader() //adds comments to the assembly file containing information about the file being compiled, about pigmeo, compilation date...
        AddDirectives() //adds code about the target branch, includes, configuration bits...
        AddStaticVariables() //compiles to asm all the static (global) variables
        AddStaticFunctions() //compiles to asm all the static functions (those not depending on instantiated objects)
        //object instantiation not supported yet
    }
    OptimizeAsm() //optimizes the assembly language after being generated
}
Personal tools