Sub-C

Sub-C was my attempt at writing a compiler in my 3rd year of undergraduation. Sub-C has a C-like syntax and generates assembly code that readily compiles with the NASM assembler.

It has been written entirely in Java and has very simple features. Some of the more important features present are:

  • C-like syntax
  • Recursive Descent Parser
  • Supports variable declarations
  • Supports assignment statements
  • Supports basic constructs (if, if-else, while, do-while)
  • Supports functions

While it doesn't produce the most optimized code in the world (stack based code generation), it highlights the basic design of a simple compiler.