⚙️ Compiler for C to LC2K (Little Computer 2000) assembly
Pay no mind, this is a side project. This README.md is in development as I build.
Development Methodology:
-
Choose a small subset of the source language that we can compile directly to assembly.
-
Write as many test cases as necessary to cover the chosen subset of the language.
-
Write a compiler that accepts an expression (in the chosen subset of the source language) and outputs the equivalent sequence of assembly instructions.
-
Ensure that the compiler is functional, i.e. it passes all the tests that are written beforehand.
-
Refactor the compiler, if necessary, making sure that none of the tests are broken due to incorrect refactoring.
-
Enlarge the subset of the language in a very small step and repeat the cycle by writing more tests and extending the compiler to meet the newly-added requirements.
-
Perhaps make a REPL interpreter for on demand feedback when messing with LC2K code
- https://craftinginterpreters.com
- https://norasandler.com/2017/11/29/Write-a-Compiler.html
- http://scheme2006.cs.uchicago.edu/11-ghuloum.pdf (supports above article)
- https://github.com/rui314/chibicc
- https://llvm.org/docs/tutorial/ (a tad bit overkill)
- https://llvm.org/docs/tutorial/MyFirstLanguageFrontend/LangImpl02.html
- https://en.wikipedia.org/wiki/Abstract_syntax_tree
- https://norasandler.com/2017/11/29/Write-a-Compiler.html
- https://craftinginterpreters.com/parsing-expressions.html