matanbt / compilation

Building a compiler from scratch, as final project for Compilation course.
0 stars 0 forks source link

L-Compiler Project

Building a compiler from scratch, as final project for Compilation course.

How does the compiler work?

Environment Setup

Usage - Compile & Run

In the following steps we'll demonstrate compiling and running the L source file code.l and write its output to code_output.txt.

  1. Compile the compiler: Make the compiler (from ex4 dir):
    • $ make compile
    • The compiler is now saved as binary named COMPILER.
    • Once the compiler is created it can be reused, and this step may not be repeated.
  2. Compile with the compiler: We may use COMPILER to compile L code files.
    • $ java -jar COMPILER code.l compiler_run.log
    • This run creates two artifaces - compiler_run.log which logs the latest compilation, and MIPS.txt which contains the generated code.
  3. Run the L program: Now we use MIPS to run the generated MIPS code.
    • $ mips -f MIPS.txt #> code_output.txt
  4. Enjoy your code output in code_output.txt. You've just brought L to life!

Files