Question
1 Syntax trees Consider the following grammar with terminals: number, +, , (, and ). expr ::= expr + expr | expr expr | (expr
1 Syntax trees
Consider the following grammar with terminals: number, +, , (, and ).
expr ::= expr + expr | expr expr | (expr ) | number
number = [0-9]+
1. We can derive the expression 78 20 + 5 39 as follows (among many other derivations).
expr expr expr expr + expr expr expr expr + expr expr number expr + expr expr 78 expr + expr expr 78 expr + number expr 78 expr + 5 expr 78 expr + 5 number 78 expr + 5 39 78 number + 5 39 78 20 + 5 39
Give the parse tree that represents this derivation. Lets call your parse tree P1.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started