daily pastebin goal
24%
SHARE
TWEET

Untitled

a guest May 19th, 2017 46 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. És gay e gostas de meninos pequeninos
  2.  
  3. R -> RbX | XQZ | c
  4. X -> Xa | bRd
  5. Q -> a
  6. Z -> b|c
  7.  
  8. step 1: mutual recursion
  9.  
  10. nothing to do here, move along...
  11.  
  12. step 2: factorization
  13.  
  14. nothing to do here, move along...
  15.  
  16. step 3: left recursion
  17.  
  18. R -> XQZR' | cR'
  19. R' -> bXR' | e
  20. X -> bRdX'
  21. X' -> aX' | e
  22. Q -> a
  23. Z -> b|c
  24.  
  25. step 4: left corners
  26.  
  27. R -> bRdX'QZR' | cR'
  28. R' -> bXR' | e
  29. X -> bRdX'
  30. X' -> aX' | e
  31. Q -> a
  32. Z -> b | c
  33.  
  34. 2.
  35.  
  36. first(R) = b, c
  37. first(R') = b, e
  38. first(X) = b
  39. first(X') = a, e
  40. first(Q) = a
  41. first(Z) = b, c
  42.  
  43. follow(R) = d, $
  44. follow(R') = follow(R) = d, $
  45. follow(X) = first(R') U follow(R') = b, d, $
  46. follow(X') = first(Q) U follow(X) = a, b, d, $
  47. follow(Q) = first(Z) = b, c
  48. follow(Z) = first(R') U follow(R) = b, d, $
  49.  
  50. 3.
  51.  
  52.         a           b           c           d           $
  53. R                   bRdX'QZR'       cR'            
  54. R'                  bXR                     epsilon         epsilon
  55. X                   bRdX
  56. X'      aX'/epsilon     epsilon                     epsilon         epsilon
  57. Q       a          
  58. Z                   b           c
  59.  
  60. stack           input           action
  61. R$          bcdac$          bRdX'QZR'
  62. bRdX'QZR'$      bcdac$          b
  63. RdX'QZR'$       cdac$           cR'
  64. cR'dX'QZR'$     cdac$           c
  65. R'dX'QZR'$      dac$            eps
  66. dX'QZR'$        dac$            d
  67. X'QZR'$         ac$         aX'
  68. aX'QZR'$        ac$         a
  69. X'QZR'$         c$          backtrack
  70. X'QZR'$         ac$         eps
  71. QZR'$           ac$         a
  72. aZR'$           ac$         a
  73. ZR'$            c$          c
  74. cR'$            c$          c
  75. R'$         $           eps
  76. $           $           accept
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top