Advertisement
Guest User

Untitled

a guest
Dec 18th, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.84 KB | None | 0 0
  1. <program> :== "DECLARE" <declist> "BEGIN" <compound_instr> "END"
  2. <declist> :== <declaration> | <declaration> ";" <declist>
  3. <declaration> :== <IDENTIFIER> "=" <type>
  4. <type> :== <primitive> | <array>
  5. <primitive> :== "int" | "real" | "boolean" | "char"
  6. <array> :== "[" <primitive> "]":"[" <positive_number> "]"
  7. <compound_instr> :== "{" <list_instr> "}"
  8. <list_instr> :== <instr> | <instr> ";" <list_instr>
  9. <instr> :== <simple_instr> | <compound_instr> | <declaration>
  10. <simple_instr> :== <assignment> | "WRITE" "$"<IDENTIFIER> | "WRITE" "$"<const> | "READ" "$"<IDENTIFIER>
  11. <assignment> :== <IDENTIFIER> ":=" <expression>
  12. <expression> :== <expression> <OP_P1> <term> | <term>
  13. <term> :== <term> <OP_P2> <factor> | <factor>
  14. <factor> :== "("<expression>")" | <IDENTIFIER> | <const>
  15. <compount_instr> :== <if_inst> | <while_inst>
  16. <if_inst> :== "IF" <condition> "THEN" <stmt> | "IF" <condition> "THEN" <stmt> <else_inst>
  17. <else_inst> :== "ELSE" <stmt> | "ELSE" <stmt> <else_inst>
  18. <condition> :== <expression> <RELATION> <expression>
  19. <stmt> :== <simple_instr> | <compound_instr>
  20.  
  21. <identifier> :== <primul_caractere> <repetat_lc> | <primul_caracter>
  22. <primul_caracter> :== <underscore> | <letter>
  23. <litera_cifra> :== <letter> | <digit>
  24. <repetat_lc> :== <litera_cifra> | <litera_cifra> <repetat_lc>
  25. <letter> :== "A" | "B" | ... | "Z" | "a" | "b" | ... | "z"
  26. <digit> :== "0" | "1" | ... | "9"
  27. <digit_plus> :== "1" | "2" | ... | "9"
  28. <underscore> :== "_"
  29. <const> = <int> | <char> | <string> | <true> | <false>
  30. <int> :== <digit> | <positive_number> | "-" <positive_number>
  31. <cint> :== <digit> | <digit> <cint>
  32. <positive_number> :== <digit_plus> | <digit_plus> <cint>
  33. <string> :== <letter> | <letter> <string>
  34. <OP_P1> = "+" | "-"
  35. <OP_P2> = "*" | "\"
  36. <RELATION> = "==" | ">" | ">=" | "<" | "<=" | "!="
  37. <digit> = "0" | "1" | ... | "9"
  38. <digit_plus> = "1" | "2" | ... | "9"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement