@@ -132,3 +132,34 @@ The file ``main.cc`` contains a sample main program.
You may have to modify it depending on how you choose to report errors from your parser.
If the scanner encounters an error it will throw an object of type :class`ScannerError`.
Your main program should catch this exception (the sample main program does), print an error message (you can print a :class:`ScannerError` object using stream operators) and then perform error recovery.
Testing your solution
---------------------
A test script is available called test.py with an auxilary file called test.txt.
You may test your solution by using the following command::
python3 test.py test.txt
The output of running this test program should be something like this::
Demonstrate your solution to your lab assistant during a laboratory session.
Send an e-mail (one e-mail per group) with your modified code to the same assistant, put TDDD55, assignment number and your LiU logins in the e-mail subject line.
Getting Started
---------------
In this lab you will be working with a quite large codebase.
Documentation concerning this codebase is available under skeleton at the left side in the tab tab "The Skeleton".
It is recommended that you start by implementing the different rules for expressions.
A test program is available at `./test/expression_test.prog`.
However, it might be useful to write your own program and test simple expressions on a step by step basis.
To run the compiler on your own program, named for instance myProgram.prog execute::
./compiler ./test/myProgram.prog
If you want to run the program with debugging information you may run::
./compiler -d ./test/myProgram.prog
See the different files in the test folders for examples on how to write programs in this language.
Troubleshooting
---------------
Make sure that you have checked all places in parser.y with the phrase "Your Code Here".
Once you have done so you can execute the following sequence of commands to check your compiler::
./compiler ./test/test.prog > output.txt
diff -y ./output.txt ../traces/trace-lab3.txt
Using this commands you will get a side by side comparision of your own output and a trace.
Take note that the memory addresses might differ for some entries, this is ok.