Advertisement
Eather

compiler

Mar 20th, 2011
689
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. 1.  Convert the following RE into DFA directly:
  2. a.  a* b ( c? / b+ ) c+ / Ԑ
  3. b.  a / b* / abc*d? / b?
  4. c.  (ab /ba)*
  5. d.  (a* / b*) c? (d+ / Ԑ ) +
  6. e.  (p* / q* )*
  7. f.  (p*q*)*
  8. g.  (a / Ԑ ) + ab*
  9.  
  10. 2.  Thomson’s construction (RE to NFA and NFA to DFA)
  11. a.  (a/b*) abb
  12. b.  (ab*/a*b)*abb(a/b)*
  13. c.  (a*b/ab*)+ abb(a/b)+
  14. d.  (a*/b*)abb
  15. e.  (a+/b+)*abb
  16.  
  17. 3.  Eliminate left recursion
  18. a.  S-> As / Ab
  19. A-> Ab / Sd/ BeA
  20. B-> Be/ AcBd/ j
  21.  
  22. b.  S-> Aa/b
  23. A-> Ac/Sd/Ԑ
  24.  
  25. c.  Class lectures
  26.  
  27. 4.  Build LL(1) parsing table
  28. a.  S->(L) / a /b
  29. L-> L,S /S
  30.  
  31. b.  S-> iEtSS’ / a
  32. S’->eS/Ԑ
  33. E->b
  34.  
  35. c.  S->aSc/B
  36. B->bBcf/C
  37. C-> cCg / d / Ԑ
  38.  
  39. d.  S-> aS/Ab
  40. A->XYZ/Ԑ
  41. X->cS/Ԑ
  42. Y->dS/Ԑ
  43. Z->eS
  44.  
  45. e.  X->YaYb/ZbZa
  46. Y->b
  47. Z->a/Ԑ
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement