Question: Syntactic Trees Consider the following two grammars. Grammar 1 EXPR -> TERM EXPR | TERM TERM -> FACT / TERM | FACT FACT -> ID
Syntactic Trees
Consider the following two grammars.
Grammar 1
EXPR -> TERM EXPR | TERM
TERM -> FACT / TERM | FACT
FACT -> ID | (EXPR)
ID -> x | y | z
Grammar 2
EXPR -> EXPR / FACT | FACT
FACT -> FACT TERM | TERM
TERM -> ID | (EXPR)
ID -> x | y | z
If possible, derive trees for each of the following expressions, using each of the two grammars. If it is not possible to derive the given expression using one of the grammars, explain why.
- x y / z
- x y z
- x / y z
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
