Generate the parse tree for the following statement with help of following grammar (the grammar image is attached). x=(p-q)+(p-r)+(p-r)       Thanks a lot in advance:)

Programming Logic & Design Comprehensive
9th Edition
ISBN:9781337669405
Author:FARRELL
Publisher:FARRELL
Chapter7: File Handling And Applications
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
100%

Generate the parse tree for the following statement with help of following grammar (the grammar image is attached).

x=(p-q)+(p-r)+(p-r)

 

 

 

Thanks a lot in advance:)

PRODUCTION
S>id : =E
E>E1+ E2
SEMANTIC RULES
S.code : = E.code || gen(id.place :=' E.place)
E.place := newtemp;
E.code := E1.code || E2.code || gen(E.place =' E1.place +' E2.place)
E.place := newtemp;
E.code := E1.code || E2.code || gen(E.place :=' El.place * E2.place)
E.place := newtemp;
E.code := El.code || gen(E.place :=' 'uminus' El.place)
E.place : = El.place;
E.code : = E1.code
E>E1 * E2
E→-E1
E> (El )
E.place : = id.place;
E.code : =
E>id
Transcribed Image Text:PRODUCTION S>id : =E E>E1+ E2 SEMANTIC RULES S.code : = E.code || gen(id.place :=' E.place) E.place := newtemp; E.code := E1.code || E2.code || gen(E.place =' E1.place +' E2.place) E.place := newtemp; E.code := E1.code || E2.code || gen(E.place :=' El.place * E2.place) E.place := newtemp; E.code := El.code || gen(E.place :=' 'uminus' El.place) E.place : = El.place; E.code : = E1.code E>E1 * E2 E→-E1 E> (El ) E.place : = id.place; E.code : = E>id
Expert Solution
steps

Step by step

Solved in 5 steps with 5 images

Blurred answer
Knowledge Booster
Sorting
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781305480537
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT