Question: Language Design ( 2 0 points ) Pat is writing a compiler for equality tests on numbers, and wants to handle both integers and floating
Language Design points
Pat is writing a compiler for equality tests on numbers, and wants to handle both integers and floating point values. Pat's initial version looks like this:
This version works fine with Pat's shiftreduce parser generator, but Pat wants the lan
guage to also allow comparisons between integers and floating point values converting the integer to floating point before comparison and adds one more production to the
grammar, changing the fltval rule to:
fltval rarr FLOAT INT
a points This augmented grammar is no longer SLR What conflicts will there
be in the generation of the parsing table? Can they be resolved with precedence
declarations on operators? Why or why not?
b points Pat's friend Chris suggests using a recursive descent parser instead. Will a
recursive descent parser using the augmented grammar as written generate the parse
tree that Pat wants in all cases? Justify your answer.
c points Pat's other friend Francis thinks that the problem can be solved in the
lexical analysis. Is this possible? Justify your answer.
d points Drew thinks the right answer is to change the language to use a different operator eg for floatingpoint comparisons. Explain how this resolves the
conflicts in the SLR parsing table, or show what conflicts remain.
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
