程序代写代做代考 ## 1 The grammar G

## 1 The grammar G

i) L E C F V T

ii) a b c d 0 1 2 3 if + – * print

iii) L

iv) L -> E -> (C) -> (if E E) -> (if (F) E )

​ -> (if (-L) E ) -> (if (-LE) E ) -> (if (-EE) E ) -> (if (-TE) E ) -> (if (-1E) E )

​ -> (if (-1V) E ) -> (if (-1a) E ) -> (if (-1a) (F) )

​ -> (if (-1a) (print L) ) -> (if (-1a) (print E) )

​ -> (if (-1a) (print T) ) -> (if (-1a) (print 1) )

## 2 Prove G is not LL(1)

L -> LE is left recursive, thus G is not LL(1).

## 3 Find an equivalent LL(1) grammar G′