My Own Compiler!

After the gruel and suffering of finals week, a ray of hope! My compiler is finished! Still incredibly rudimentary, but it’s not too shabby. It currently supports:

  • Basic integral types including:
    • Integer
    • Float
    • Boolean
    • Char
    • Char * (not really a pointer, but a string type)
  • Functions, with return types and parameters
  • Comments, both single and multi-line
  • Variables
    • Local variables that respect the stack
    • Global variables (no initialization though)
  • Basic binary operators:
    • Assignment
    • Addition
    • Subtraction
    • Multiplication
    • Division
    • Modulo
    • Logical And
    • Logical Or
  • Basic type casting
  • Function binding to C++  (so you can set stuff up like printing to console)

The source is still intermingled with the assignment drivers, so I’m cleaning that up. In the meantime, if you’re interested you can give it a try! A source file and the executable for the compiler is available below. It covers the basic syntax and stuff. The compiler also has basic compiler errors, so sticking in bad code should (hopefully) not crash, and it will tell you where it found a mistake.

 

DOWNLOAD LINK

 

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s