The AtomC Compiler is a work-in-progress compiler that I am building for my Compilation Techniques course. It currently implements some compiler features for the AtomC programming language, a small subset of C.
- Lexical Analyzer: Tokenizes the input source code into a series of tokens.
- Syntactical Analyzer: Parses tokens to ensure they follow the AtomC language syntax. Absence of output signifies the source file is free of syntactical errors.
- Domain Analyzer: Checks for domain errors in the source code, such as undeclared variables/functions, or redeclaration of variables.
- Type Analyzer: Analyzes and verifies the types of variables and expressions to ensure they are used correctly according to the language rules.
- Stack-Based Virtual Machine: A stack-based virtual machine to execute the generated code. You can test this feature using
./acc --vmtest
. - Code Generation: Transpiles an AtomC file to virtual machine code and runs it.
The compiler can be compiled using make with the following command:
make
If you don't want to compile it yourself, you can also get the compiler executable for Linux, macOS, and Windows from the releases page.
To compile an AtomC source file, use:
./acc <filename>
To run the stack-based virtual machine test, use:
./acc --vmtest
To test the compiler, you can run the test suite with:
make test
This runs all files in the tests/
directory through the compiler, you can add whatever tests you like in there.
Introduce syntax errors, for example, into tests/testparser.c
to see how the compiler responds.
If you find that I'm missing an error, or something could be clearer, feel free to raise an issue!
You can do cleanup with:
make clean