Compilation process - metzzo/123-basic GitHub Wiki
Architecture
The 123basic is a self hosting multi pass compile on demand compiler.
The compiler architecture of 123 basic is very simple:
- Lexer/Tokenizer: Splits the source code into small "tokens"
- Preprocessor: Parses all the preprocessor commands (with "?" prefix)
- Analyser: Searches for all variables/functions and types
- Parser: Transforms the tokens into an abstract syntax tree(AST), checks for errors
- Generator: Generates the code for the target language out of the AST
- Target: Does all the target specific stuff (converting sound, include standard library,... )
Every pass is divided into several (little) sub passes. The compiler itself is a compile on demand parser, which means, it just compiles functions that are really used within the source code.
Lexer
TODO
Preprocessor
TODO
Analyser
TODO
Parser
TODO
Generator
TODO
Target
TODO