A lightweight compiler for a simplified C-like language, built from scratch in C.
This project demonstrates core compiler construction concepts including lexical analysis, parsing, syntax validation, and translation toward lower-level output.
This project was developed to explore the main phases of compilation by implementing a small compiler for the C-- language. The compiler processes source input, performs tokenization and parsing, and reports syntax-related issues with line-aware diagnostics.
- Lexical analysis using a custom scanner
- Parsing for C-- language constructs
- Error reporting with line-number tracking
- Driver programs for testing scanner and parser behavior
- Makefile-based build process
scanner.c/scanner.h— lexical analyzer implementationparser.c/parser.h— parser implementationdriver.c— main compiler driverscanner-driver.c— standalone scanner testingMakefile— build automationtest.c,test2.c,exmpl.txt— sample input filesout.txt,diff.txt— output / comparison artifacts used during testing
To compile the project:
make