Advertisement
Guest User

Untitled

a guest
Nov 18th, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.55 KB | None | 0 0
  1. -- JVM instructions (excerpt)
  2.  
  3. -- Int instructions
  4. PDefs. Program ::= [Def];
  5. terminator Def "" ;
  6.  
  7. comment "//" ;
  8. comment "/*" "*/" ;
  9.  
  10. DFun. Def ::= Type Id "(" [Arg] ")" "{" [Stm] "}" ;
  11. separator Arg "," ;
  12. terminator Stm "" ;
  13.  
  14. ADecl. Arg ::= Type Id ;
  15. SExp. Stm ::= Exp ";" ;
  16.  
  17. SDecl. Stm ::= Type Id ";" ;
  18. SDecls. Stm ::= Type Id "," [Id] ";" ;
  19. SInit. Stm ::= Type Id "=" Exp ";" ;
  20.  
  21. SReturn. Stm ::= "return" Exp ";" ;
  22. SWhile. Stm ::= "while" "(" Exp ")" Stm ;
  23. SBlock. Stm ::= "{" [Stm] "}" ;
  24. SIfElse. Stm ::= "if" "(" Exp ")" Stm "else" Stm ;
  25.  
  26. EInt. Exp15 ::= Integer ;
  27. EDouble. Exp15 ::= Double ;
  28. EString. Exp15 ::= String ;
  29. ETrue. Exp15 ::= "true" ;
  30. EFalse. Exp15 ::= "false" ;
  31. EId. Exp15 ::= Id ;
  32. ECall. Exp15 ::= Id "(" [Exp] ")" ;
  33. EPIncr. Exp14 ::= Exp15 "++" ;
  34. EPDecr. Exp14 ::= Exp15 "--" ;
  35. EIncr. Exp13 ::= "++" Exp14 ;
  36. EDecr. Exp13 ::= "--" Exp14 ;
  37. ENeg. Exp13 ::= "-" Exp14 ;
  38. EMul. Exp12 ::= Exp12 "*" Exp13 ;
  39. EDiv. Exp12 ::= Exp12 "/" Exp13 ;
  40. EAdd. Exp11 ::= Exp11 "+" Exp12 ;
  41. ESub. Exp11 ::= Exp11 "-" Exp12 ;
  42. ELt. Exp9 ::= Exp9 "<" Exp10 ;
  43. EGt. Exp9 ::= Exp9 ">" Exp10 ;
  44. ELEq. Exp9 ::= Exp9 "<=" Exp10 ;
  45. EGEq. Exp9 ::= Exp9 ">=" Exp10 ;
  46. EEq. Exp8 ::= Exp8 "==" Exp9 ;
  47. ENEq. Exp8 ::= Exp8 "!=" Exp9 ;
  48. EAnd. Exp4 ::= Exp4 "&&" Exp5 ;
  49. EOr. Exp3 ::= Exp3 "||" Exp4 ;
  50. EAss. Exp2 ::= Exp3 "=" Exp2 ;
  51.  
  52. coercions Exp 15 ;
  53. separator Exp "," ;
  54.  
  55. Tbool. Type ::= "bool" ;
  56. Tdouble. Type ::= "double" ;
  57. Tint. Type ::= "int" ;
  58. Tstring. Type ::= "string" ;
  59. Tvoid. Type ::= "void" ;
  60. token Id (letter (letter | digit | '_')*) ;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement