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.

  1. x y / z
  2. x y z
  3. x / y z

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!