Question: ASAP please Goal: This assignment serves several purposes: - to be familiar with Bison, - to create context - free grammar for Tiger language, and
ASAP please
Goal:
This assignment serves several purposes:
to be familiar with Bison,
to create contextfree grammar for Tiger language, and
to create the parser for Tiger language using Bison
Description:
This is a team project that builds on the previous project. In this project, you are required to use Bison to create a parser for the Tiger language. More specifically, write the contextfree grammar for the Tiger language. Please read the Tiger language manual carefully before you start. The manual can be found in DL as well as the project repository.
In this project, Record and any recordrelated features will not be supported. These features include, but are not limited to record expression, record definition, and accessing a field of a record.
Team Project Requirement:
Please read "team requirements.doc"
Responsibility of Team Leader:
Organize regular team meetings virtual or inperson to discuss progress and issues of the project and submit time log reports before each deadline.
The time log report is used to monitor the progress of the project. Each team is required to submit time log reports. Each report should specify the major work that has been done and the estimated time needed to finish the project,
The firsttime log report should be submitted within days after the project is assigned. This report should specify the team members' roles and the estimated time needed from each team member.
One timelog reports to monitor the progress of the project alpha version and test cases.
One report to monitor the progress of the final version of the project.
The time log report pattern file can be found in the "projecttimelog folder.
Make sure programmers and testers submit their required documents by deadlines.
Put team member names in the rubric file and submit it to the project repository.
Responsibility of Programmer:
Work on the tiger.yy file. He can seek help from team leaders and testers if needed.
Submit the alpha version of tiger.yy before the deadline.
Fix errors based on the test report provided by the tester and submit the final version before the deadline.
Responsibility of Tester:
Work on test cases and submit it before the deadline. The test case should be a tiger program without any syntax errors. In this project, we focus on the syntax of the tiger program only, not semantics. The tiger program should cover all features supported in the language.
The Tiger program will be used to test the project alpha version The pattern of the test case file can be found at: "projectTesting
What to do in this project?
Come up with a contextfree grammar for Tiger language, and use Bison to generate its parser. Your
grammar should have as few shiftreduce conflicts as possible and no reducereduce conflicts. When
you compile your parser file, Bison will output information about the number of shiftreduce conflicts
and the number of reducereduce conflicts. If your grammar has a reducereduce conflict, please talk
to me to see how to get rid of it
Most Tiger CFG can be found in the brief manual located at "class
repository Document Tiger BriefManualpdf However, some changes are required to make it work.
The brief manual uses id for variable names and typeid for type names. In your CFG please
use ID for both.
Some nonterminals in the brief manual have subscript "opt" like the following:
exprseq opt
It means optional. You should treat it as two productions like the following:
exprseq doesn't occur
exprseqexprseq occur once.
Replace punctuation symbols and operators with the corresponding token names. For
example, replace : with ASSIGN, with LPAREN.
For production expr binaryoperator expr, please use actual operators to replace symbol
binaryoperator to get productions like expr LE expr, expr NEQ expr, etc.
Replace productions of left recursion with productions of right recursion. For example, the
following production is left recursion since the production head appears as the first symbol in
the production body.
typefields: quad typefield
typefields, typefield
Rewrite it to make the production head appear as the last symbol in the production body.
typefields: typefield
typefield, typefields
In the tiger.In the yy file, the operators' precedence level and association should be specified based on
the Tiger manual.
Extra rules should be provided to recover from errors. Your grammar should generate the same
output on the sample file example.tig as the one provided by the instructor.
Set up environment:
I strongly suggest teams use the sample Visual Studio solution I provided in the class repository.
Choose a tiger. l from your team members typically the one with the highest grades Correct
all existing errors. Copy the tiger. l to project BisonProjectlMainDriver, and make the
following change:
a Replace the line #include "tokens.h by #include "tiger.tab.hh This is required
because there are no tokens.h and all token definition
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
