Exercises On Grammars And Regular Expressions Worksheet With Answer Key - Olena Gryn, Louisiana State University, 2006 Page 8

ADVERTISEMENT

< expression >::= (< expression >)| < expression > + < expression > | < expression >
∗ < expression > | < variable >
< variable >::= x|y
b) Find a derivation tree for (x ∗ y) + x in this grammar.
Solution
a) S → (S)|S + S|S ∗ S|A, A → x|y.
b)
S

€ €


€ €


€ €

+
S
S

€ €


€ €


€ €

S
A
(
)

€ €


€ €


€ €

x
S
*
S
A
A
y
x
8

ADVERTISEMENT

00 votes

Related Articles

Related forms

Related Categories

Parent category: Education
Go
Page of 8