
S ---> A | '(' T
T ---> ')' | S T
A ---> 'a' | 'b' | 'c'
Give the parse tree and a leftmost derivation for the sentence:
<stmt> ---> if ( <log-expr> ) <stmt>
<stmt> ---> if ( <log-expr> ) <stmt> else <stmt>
|
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Sentence: id * ( id + id ) $
using the grammar above augmented with the extra grammar rule E' ---> E