-
Notifications
You must be signed in to change notification settings - Fork 148
Compiler Steps
Nathaniel Sabanski edited this page Jan 20, 2016
·
33 revisions
Added by dholton dholton
Pipelines consist of a set of steps that the compiler passes the code through. The source code for all the steps is here.
The order of steps when you compile a script is like this:
- First the Boo Parser (and lexer): Boo.Lang.Parser.BooParsingStep.
- The rules the Boo parser uses are defined in this ANTLR grammar file ** <<<--- CAN'T FIND IT**
- The boo lexer turns the text script into a set of tokens, and the boo parser converts the tokens into an abstract syntax tree (AST). I'll show examples of this later on. Each step after the parser is basically just working on this AST and transforming it. At the end, the AST is used to produce raw .NET assembly code (IL). The steps that happen after the parser step:
- InitializeTypeSystemServices
- PreErrorChecking
- InitializeNameResolutionService
- IntroduceGlobalNamespaces
- TransformCallableDefinitions
- BindTypeDefinitions
- BindNamespaces
- BindBaseTypes
- BindAndApplyAttributes
- ExpandMacros
- IntroduceModuleClasses
- NormalizeStatementModifiers
- NormalizeTypeAndMemberDefinitions
- BindTypeDefinitions
- BindBaseTypes
- ResolveTypeReferences
- BindTypeMembers
- ProcessInheritedAbstractMembers
- ProcessMethodBodiesWithDuckTyping
- ProcessAssignmentsToValueTypeMembers
- ExpandProperties
- StricterErrorChecking
- RemoveDeadCode
- NormalizeIterationStatements
- ProcessSharedLocals
- ProcessClosures
- ProcessGenerators
- InjectCallableConversions
- ImplementICallableOnCallableDefinitions
- EmitAssembly
- and finally SaveAssembly or RunAssembly
For a script that shows what your source code and other info looks like after every step, see http://groups.google.com/group/boolang/browse_frm/thread/4a836759385d9b24/88b28eb44bcadf35?hl=en#88b28eb44bcadf35
I have another version too that shows which nodes are synthetic (generated by the compiler), but it doesn't look like the patch required for this will be committed.