The compiler is divided in multiple passes, which are executed one after another by the Welder:
- the parser, generating the AST from char predicates
- the import solver, calling the parser as many times as needed to get all the files AST’s and piecing them together
- the macro processor, applying macros in the AST
- the name resolver, resolving packages
- the optimizer, removing unused symbols from the AST
- the AST lowerer, generating IR from the AST
- the IR optimizer, enhancing the IR by replacing common IR entities groups with super instructions where possible
- the IR compiler, generating bytecode from IR
There exists another compiler, the json compiler, converting a given code to JSON by iterating through the AST. It follows the same process as the compiler to generate the AST.