CPS710

Assignment 5

Toronto Metropolitan University University

Evaluator - Part 2: Symbol Tables

Due: December 14


Objectives

In this assignment you will add identifiers to HL, as well as all remaining functionality that depends on them: assignments, function calls and returns, loops, set formers, and, obviously, all declarations.

However, you still do not need to handle errors in programs. This functionality will be addressed in the final assignment.

With this assignment you should become much more familiar with symbol tables and scoping schemes. The learning objectives covered in this assignment are:

Some of these learning objectives will be identified in the description of this assignment, and some in the tests.

Solutions to the previous assignment, assignment 4, will not be provided. You will therefore need to complete the level objectives of that assignment at the same level as the ones on this assignment as a base for this one and for the one that follows. (i.e. you need the A4 C-level objectives for the A5 C-level objectives, and so on)

Preparation

This assignment is mostly a continuation of the last one. Your working directory should have the same structure and content as the fourth assignment. A few extra files specific to this assignment are provided in the Handouts directory:

Assignment

In this assignment you will be adding functionality to your interpreter to support the use of variables and functions in the language HL.

In addition to the semantic of HL described in HL semantics - Part 1 handed out in the fourth assignment, the remaining semantics of HL can be found in HL semantics - Part 2.

Below are the components that you will need to implement in this assignment. As you do so, remember that, as with previous assignments, you can continue to assume that the HL programs are error free. This means that your program does not need to handle invalid uses of variables or function calls or returns yet.

7Cb: Global variables and while statement

For this learning objective, you will need to implement the simplest possible configuration of variables in a language, which is a monolithic block structure where the language has no functions and all variables are global. Here is what you need to accomplish to meet this learning objective:
Implementation Suggestions:

7Bb: Dynamic Scoping and for loop

Here is what you need to accomplish to meet the 7Bb learning objective:
Implementation Suggestions:

7Ab: Static scoping

To meet this learning objective:
Implementation Suggestions:

7A+b: Set formers

Implementing this requirement in addition to static scoping will count as an additional blue learning objective at the A level. To meet this learning objective:
Implementation Suggestions:

References

I have found the following Java classes useful:

Testing your assignment

The testing process for this assignment is similar to the previous assignment: There is a single test script which simply tests all the learning objectives in order. You can find this test script runtests, and the unit test t in the Handouts directory.

The tests and results are in the Tests directory.

Submitting the assignment

To submit this assignment: If you had not previously submitted assignment 4, or if you want to resubmit it because you ended up doing more work on the assignment 4 learning objectives at the same time as this one, then you can also submit this assignment as an assignment 4 submission. To do this:


This page is maintained by Sophie Quigley (cps710@cs.torontomu.ca)
Last modified Thursday, 28-Nov-2024 12:36:57 EST