Advertisement
Guest User

Untitled

a guest
Nov 19th, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.00 KB | None | 0 0
  1. /* Statements */
  2.  
  3. public static boolean statements(){
  4. if( statement() && statements() )
  5. {
  6. return true;
  7. }
  8. if( statements())
  9. return true;
  10.  
  11. return false;
  12. }
  13. public static boolean statement(){
  14. if( simpleStmt() )
  15. {
  16. if(tokens.get(index).equals("$SEMICOLON"))
  17. {
  18. index++;
  19. stack.add(level + " ;");
  20. return true;
  21. }
  22. }
  23.  
  24. return false;
  25. }
  26. public static boolean simpleStmt()
  27. {
  28. if( statement_varDeclaration() )
  29. return true;
  30. if( statement_assignment( ))
  31. return true;
  32. if( io() )
  33. return true;
  34.  
  35. return false;
  36. }
  37.  
  38. public static boolean statement_varDeclaration()
  39. {
  40. if( type() )
  41. {
  42. if( variable() )
  43. {
  44. if(tokens.get(index).equals("$SEMICOLON"))
  45. {
  46. index++;
  47. stack.add(level + " ;");
  48. return true;
  49. }
  50. }
  51. }
  52. else if( type())
  53. {
  54. if( variable())
  55. {
  56. if(tokens.get(index).equals("$ASSIGNMENT"))
  57. {
  58. index++;
  59. stack.add(level + " '='");
  60.  
  61. if( expression())
  62. {
  63. if(tokens.get(index).equals("$SEMICOLON"))
  64. {
  65. index++;
  66. stack.add(level + " ;");
  67. return true;
  68. }
  69. }
  70. }
  71. }
  72. }
  73.  
  74. }
  75. public static boolean statement_assignment()
  76. {
  77. if(variable())
  78. {
  79. if( assigment())
  80. {
  81.  
  82. }
  83. }
  84.  
  85. }
  86. public static boolean io()
  87. {
  88.  
  89. }
  90.  
  91. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement