Pland Compiler for the C Programming Language*
Compiler Pipeline
- Lexical Analysis
- Generates necessary tokens based on lexical rules
- Parsing
- Generates AST from tokens
- Semantic Analysis
- Checks program types and creates typed-AST
- Automatically type casts between different types by inserting TypeCast Nodes
- IR Generation
- 3AC-based IR
- Unlimited Virtual Registers
- Function call abstractions
- Optional IR VM
- Helps for debugging generated IR
- Targetted low-level IR
- Register allocation for specific architectures
- Respecting calling conventions at IR level
- IR to Target Translation
- Emits assembly instructions for target arch
There are a few major differences / features missing in this implementation that may be added in the future
- No preprocessor macros
- Stricter type checking (signed integers are not automatically cast to unsigned or vice versa), though type promotion is implemented.
- No for-loop semantics
- No string literals
- No user-defined types (structs, unions, enums, typedefs)
*= most of the C programming features