next up previous
Next: Is the grammar G left Up: Elements of Answers for Exercise Previous: Leftmost derivation and rightmost derivation

Leftmost derivation and rightmost derivation for

(a, (a, a)) Leftmost derivation:

S $\displaystyle \Rightarrow$ L
  $\displaystyle \Rightarrow$ (E)
  $\displaystyle \Rightarrow$ (E, S)
  $\displaystyle \Rightarrow$ (S, S)
  $\displaystyle \Rightarrow$ (a, S)
  $\displaystyle \Rightarrow$ (a, L)
  $\displaystyle \Rightarrow$ (a,(E))
  $\displaystyle \Rightarrow$ (a,(E, S))
  $\displaystyle \Rightarrow$ (a,(S, S))
  $\displaystyle \Rightarrow$ (a,(a, S))
  $\displaystyle \Rightarrow$ (a,(a, a))
   

Rightmost derivation:

S $\displaystyle \Rightarrow$ L
  $\displaystyle \Rightarrow$ (E)
  $\displaystyle \Rightarrow$ (E, S)
  $\displaystyle \Rightarrow$ (E, L)
  $\displaystyle \Rightarrow$ (E,(E))
  $\displaystyle \Rightarrow$ (E,(E, S))
  $\displaystyle \Rightarrow$ (E,(E, a))
  $\displaystyle \Rightarrow$ (E,(S, a))
  $\displaystyle \Rightarrow$ (E,(a, a))
  $\displaystyle \Rightarrow$ (S,(a, a))
  $\displaystyle \Rightarrow$ (a,(a, a))
   


next up previous
Next: Is the grammar G left Up: Elements of Answers for Exercise Previous: Leftmost derivation and rightmost derivation
Marc Moreno Maza
2004-12-01