ICPL Compiler Project
Phase 2
Syntax Analysis

Part 1 -- Revise the context free grammar

Revise the context free grammer that has been provided.
  1. Check for errors
  2. Modify using regular expressions instead of grammar notation
  3. Remove left recursions
Include a printed version of your new grammar with your work.

Part 2 -- The syntax analysis module


A separately compiled module is to be prepared to perform syntax analysis on the source program.  The module will interact with the lexical analysis module to obtain the tokens for the source code as well as the token value.  The syntax analysis will also obtain from the lexical analysis module the current line number  (and possibly the position of the cursor within the line) when a syntax error occurs.

The interface to this module will contain a procedure that has two parameters, both of string type.  One of these will be the name of the ICPL source code.  The other will be that of the ICPL object code.  The syntax analysis module will be the only module in the program to directly access the object code file.

For this project, when the program has completed the object code file should contain the statement "filename is a valid ICPL program" for valid input.  If the input is incorrect the object code file should contain, at a minimum, the line number of the first error and something about that error.

The syntax analysis module must be properly documented.
 
 
 

Part 3 -- The test program

The test program should be able to obtain a source ICPL source program file of the users choice, a target code file of the users choice, and call the syntax analysis module.