SmallerC
A small C compiler written in Python. Generates x64 Intel-format assembly, which is then assembled and linked by nasm and ld.
Features
See the tests folder for examples that compile. The function_test.c test is representative of the range of SmallerC.
- Math
- Operations:
+,-,*,/,%,++,--,&&,||,! - Assignment:
=,+=,-=,*=,/=,%= - Comparison:
==,!=,<,<=,>,>=
- Operations:
inttype variables- Control structures:
ifwhileforbreakcontinue
- Pointers (referencing and dereferencing)
- Arrays
- Function definition and calling
\* ... */-form commentsprintstatement:print noutputs the integernto stdout.- This isn't in the C spec, but I included it to facilitate outputting values from the program; SmallerC is nowhere near being able to compile the stdio C libraries.