-
Samuel Chassot authoredSamuel Chassot authored
Amy Lab 01: Interpreter
Below you will find the instructions for the first lab assignment in which you will get to know and implement an interpreter for the Amy language.
Logistics
As a reminder, the labs are done in groups of 2-3, please register on Moodle if not already done.
We advice you to create a private git repository to track your work and collaborate.
The labs are graded through Moodle assignments, similarly to Software Construction (CS-214) that you might have taken. You will have to submit your .scala
files on Moodle and you will receive automatically a grade and feedback. You submit as many times as you want, only the last submission will be taken into account. The tests are the same as the ones you will receive for each lab, we do not use any hidden tests.
For this first lab, you can download the initial project scaffold from this folder.
Part 1: Your first Amy programs
Write two example Amy programs each make sure that they typecheck (see Type check examples). Put them under /examples
. Please be creative when writing your programs: they should be nontrivial and not reproduce the functionality of the examples in the /library
and /examples
directories of the repository. Of course you are welcome to browse these directories for inspiration.
Remember that you will use these programs in the remaining of the semester to test your compiler, so don't make them too trivial! Try to test many features of the language.
If you have questions about how a feature of Amy works, you can always look at the Amy Specification. It's a good idea to keep a local copy of this document handy -- it will be your reference for whenever you are asked to implement an aspect of the Amy language throughout this semester.
Type check examples
You can use the provided Frontend to type check your programs. To do so, run the provided bash script:
./amytc.sh examples/your_program.amy
This will run the compiler frontend up to type checking and report either Type checking successful!
or an error message. If you get an error message, you should fix the error before moving on to the next step.
Please examine the bash scipt amytc.sh and its comments in your editor to understand how it works. Do not modify it.
Troubleshooting
- Your project must compile before you call the
amytc.sh
script. - If you get unexpected errors or behaviour, try to delete the
target/scala-3.5.2/amyc-assembly-1.7.jar
and retry.
Part 2: An Interpreter for Amy
The main task of the first lab is to write an interpreter for Amy.