CS712/CS812
Project Phase 2
Spring 2016
Due Sunday March 6


Add features to your Tscript system:

  1. The Block statement.

  2. The Empty statement.

  3. The While statement.

  4. The If statement.

  5. The Break statement and the Continue statement, where these statements do not include an identifier.

  6. The Throw statement and the Try statement. When an undefined identifier error occurs, throw a TSString value, with the value of the string being equal to the message previously being printed by Message.executionError when this error occurred. If an exception reaches the outermost level of the program, then convert the exception value to a string and print it using Message.executionError.

  7. Function expressions and function calls, without arguments, and without supporting variables captured in the function closure. There is more information about function definitions here. You should create a function object to represent a function during evaluation. However, since we are not supporting objects yet, your function object only needs the capability to call the function.

  8. The Return statement. You must complete function expressions and function calls first.

  9. Add support for function arguments. You must complete function expressions, function calls and the Return statement first.

  10. Add support for variables being captured in function closures. You must complete function expressions, function calls, the Return statement and functions arguments first.

All items in the above list will be worth 10 points.

You should implement Block statements first, as I will use that to test the other items.

You should take care with each construct to track at runtime the current line number so that error messages will be as accurate as possible. The current line number is tracked in the Message class. It is set via the setLineNumber method.

Your Tscript compiler does not need to support strict execution mode or semicolon insertion.

Remember that you need to be sure that your compiler supports the first four work items from Phase 1: logical not operator, the equals operator, the less-than operator, the greater-than operator, the Boolean type, the Null type, and the Undefined type.

You should be sure to complete the first four items in the above list because they will be used to test your Phase 3 submission. In order to get full-credit on Phase 3 you will also need to have functions working, as well as the Return statement, but you do not need to support arguments or variables captured in function closures. This is necessary for supporting method calls and "this" in Phase 3.

There are some initial test files available on agate in ~cs712/public/tests/phase2.

To get full credit, your code must be adequately documented and structured. If I can't easily read and understand your code, you may lose points.

You must give me back the system in the same form that I gave it to you. I must be able to install it and run it in the exact same way as when it was delivered to you. I would also like you to keep the source code organized in the same directory hierarchy. If you fail to do this, a significant deduction will be made to your grade.

Note that there is a script, distribute.sh, in tscript/bin, which will generate a tar file for you. This tar file is what I require you to submit to me for grading.

To turn in this assignment, type:
~cs712/bin/submit phase2 tscript.tar

Submissions can be checked by typing:
~cs712/bin/scheck phase2

The assignment is due on Sunday March 6. There is a grace period to 8am on Monday March 7 when no late penalty will be assigned. Submissions between 8am March 7 and 8am March 8 will have a late penalty of 10 points. Submissions between 8am March 8 and 8am March 9 will have a late penalty of 30 points. No submissions will be accepted after 8am on Wednesday March 9.

Remember: you are expected to do your own work on this assignment.


Last modified on February 13, 2016.

Comments and questions should be directed to pjh@cs.unh.edu