CST 8152 Compilers - Assignment #5
continued from page one...
6. Enhance your parser to use a value stack to hold the values and types of tokens returned by your scanner. Use this grammar and the new function p_factor():
<_assignment> -> IDENTIFIER = <_factor> ;
<_factor> -> IDENTIFIER | STRING | INTEGER
7. The p_factor() function must push the recognized value and its type onto the stack. The p_assignment() function must call the p_factor() function, then pop the pushed value and its type off the stack and enter them both into the symbol table at the location of the left-hand-side IDENTIFIER, as in Part I.
8. The error handling of Part I applies here, too. This is an enhancement of Part I.
9. Prepare answers to these questions: How does your program handle integer overflow when collecting digits for an integer or when converting a string of digits into an integer? Do you check for stack overflow and underflow? When the parser discovers a syntax error, how does it recover? Does your parser check for common syntax errors and attempt to do intelligent recovery? How do you handle strings or identifiers that are extremely long, if you use fixed-size buffers in your scanner or symbol table?
The deliverables for this assignment are as follows:
1. Make sure you have read all the fine print in this assignment.
2. Show me hard-copy of your test case input and ouput, and your parser source code.
3. Demonstrate briefly (2-3 minutes) but convincingly that your parser works.
Nothing has to be handed in for this assignment, but you must have hard-copy of your parser (not the scanner) available for me to examine. You have about 2-3 minutes of my time in the Lab to demonstrate your program and convince me that it works and that you know how it works. Your mark for this assignment is determined by the clarity and efficiency of your in-Lab demonstration. You might want to have hard copy available to quickly substantiate your quick demonstration. Organize your Lab presentation -- three minutes is not very much time to get full marks.