CSC 645 - Compiler Construction

Dr. R. M. Siegfried

Term Project Part 2 - Building a Scanner (Lexical Analyzer)

Due - Monday, March 20, 2023

Implement a symbol table for the Pascal subset in the Project Language Specification. You may use the code from the JASON compiler as a basis for your compiler, however, keep in mind that you need to add an auxiliary table to keep track of upper and lower bounds for array.

The attribute table now needs a pointer to the auxiliary table as well as an indication of how many auxiliary table entries it is pointing to (2 - one pointing to lower bound and one pointing to upper bound). The auxiliary table simple contains pointers to the appropriate attribute table entries.

If your input is the program:



        PROGRAM Sample;
          CONST
            x = 15;
            ... ... ...
          BEGIN
            ... ... ...
          END.
Your initial output should be:


PROGRAM       tokprogram
SAMPLE        tokidentifier
;         toksemicolon
CONST         tokword
X         tokidentifier
=         tokequals
15        toknumber
;         toksemicolon
... ... ...
BEGIN         tokbegin
... ... ...
END       tokend
.         tokperiod

[Back to the Assignments Index]