diff --git a/README.md b/README.md index 2a6464d..4fa39ba 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,32 @@ # DECAF Compiler -Learning to build a compiler by implementing a compiler for the DECAF programming language. + +Learning to build a compiler by implementing a compiler for the DECAF programming language. + +## What's in here + +A working compiler for DECAF (a trimmed-down typed C-like language), built stage by stage over a semester of CS370: + +| Stage | Where | +| --- | --- | +| Lexical analysis — a Flex specification turning source into tokens | `9LAB/lab9.l` | +| Syntax analysis — a Bison grammar producing the parse tree | `9LAB/lab9.y` | +| Semantic analysis — AST construction, type checks, scopes | `9LAB/ast.c`, `9LAB/symtable.c` | +| Code generation — MIPS assembly from the AST | `9LAB/emit.c` | + +The numbered folders (`1LAB` … `9LAB`, plus homework and an exam) are the increments the course was taught in; each +carries its own README with the assignment and sample output, so the folder itself is the progress log. `9LAB` is +the finished pipeline. + +## Build and run + +```bash +cd 9LAB +make clean && make # gcc + flex + bison -> ./lab9 +./lab9 < test1.decaf # writes MIPS assembly to stdout +``` + +Inputs and the assembly produced for them sit side by side (`test1.decaf` / `test1.asm`), which makes the tests +diffable without a harness. ## Tools - Flex