Appearance
Phase snapshots
These directories are standalone compiler checkpoints for following compilerbook on native macOS arm64.
Each language phase builds a real compiler:
- tokenize input
- parse it into an AST
- emit AArch64 assembly for Mach-O
- assemble and link with Apple
clang - execute the generated program in the test
The compiler must not evaluate the input program in the compiler process and print a constant result. Later syntax is intentionally rejected in earlier phases.
Current phases:
phase-01-int: integer literalphase-02-add-sub:+and-phase-03-tokenizer: tokenizer and whitespace handlingphase-04-errors: source-location errorsphase-05-mul-div-parens: precedence,*,/, parenthesesphase-06-unary: unary+and-phase-07-comparisons: comparison operatorsphase-08-file-split: split compiler source filesphase-09-single-letter-locals: one-letter local variablesphase-10-multiletter-locals: multi-letter local variablesphase-11-return:returnphase-12-control-flow:if,else,while,forphase-13-blocks: blocksphase-14-function-calls: function callsphase-15-function-definitions: function definitions
Run all phase snapshots:
sh
make phase-test