CSCI 439: Lab 2 (Spring 2025)

Note: the repo should now be accessible (1:15 Wed)

Lab 2 overview:

We'll continue working on the lex/yacc handling of the vurbossity language from lab 1, but now we're adding the context sensitie checking.

Obtaining/submitting the lab will follow the same process as lab1 (though of course the repo is named lab2 this time).

Our objectives in lab2 are to update the lex/yacc so that it correctly:

With respect to type compatibility, recall that an integer can be assigned to a real but not the reverse, and text is incompatible with both integers and reals.

Starting from a lab1 solution

The lab2 repo begins with a lab2.lex and lab2.yacc that represent the sample solution for lab1 plus some starter code for working with symbol tables and scopes.

The hope is that the sample code gives you a good start on the appropriate syntax and use of the symbol table and scope routines as well as accessing the content of the various tokens/non-terminals.

You are welcome to use your own lab1 solution as a starting point, and can use your own or the provided lab2 lex/yacc code for the context sensitive checking.

What the starter lab2 code provides

What the starter lab2 code doesn't provide (what's left for you to do)

  1. The code currently does not handle inserting local variables into the symbol table (nor does it currently check for redeclarations).

  2. The code currently does absolutely no type-checking in assignment statements, expressions, or parameter passing.

  3. The code currently does not do anything with procedure declarations or calls beyond checking the structural syntax (as per lab1). Some means will need to be added for checking that procedures are not redeclared, that there are no calls to undeclared procedures, and that the number and types of parameters passed in a procedure call are correct.


Suggestions