{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

proj2 - Grm.cup Java files outside the Parse package can be...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
Project 2: Parsing CSC 4351, Spring 2011 Due: 21 February 2011 Use CUP to implement a parser for the Tiger language and write semantic actions to produce a parse tree. You can find the description for this project on pages 83, 84 and 106 of the textbook. The specification of the grammar is in the Tiger Language Reference Manual in Appendix A. Environment and Support Files For working on this project, change the environment variable PROG in your .profile file to: export PROG=chap4 As usual, you can find support code in ${TIGER}/${PROG} . The Absyn package contains the declarations for the abstract syntax tree classes. The content of this package is described on page 103. The Symbol package contains a simple hash table implementation for mapping strings into symbols. The skeleton for the parser is in Parse/Grm.cup . This is the only file you should need to modify. This file is written in CUP syntax. You can find a description of CUP on pages 70–78 and on the course web page. Compilation Again, a Makefile is provided for running CUP on
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Grm.cup . Java files outside the Parse package can be compiled manually as in the previous project. For running your parser on an input file test.tig , execute java Parse.Main test.tig in your working directory. The result is a printed representation of the abstract syntax tree. Submission For this project, you only need to modify file Parse/Grm.cup . To save space in the submit directory, please, don’t submit any class files. E.g., cd prog2; make clean; ˜cs4351_bau/bin/p_copy 2 In the README file, provide any information that will help the grader to give you partial credit. I.e., state what works, what doesn’t work, and what implementation decisions you made. In particular, explain how you resolve parsing conflicts and how much error recovery you implemented. Your grammar should not have any reduce/reduce conflicts and as few shift/reduce conflicts as possible. For any shift/reduce conflicts you did not resolve, explain why the conflict is not harmful. 1...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online