Advertisement
Guest User

Untitled

a guest
Feb 5th, 2019
219
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
BNF 2.75 KB | None | 0 0
  1. // BNF description of Eggsembly syntax
  2. <syntax>     ::=  <optionalWs> <line> | <syntax> <endline> <syntax>
  3. <line>       ::=  <keyword>
  4.                 | <push>
  5.                 | <hatch>
  6.                 | <anychrs> <ws> "as" <ws> <anychrs>
  7.                 | "build" <ws> <id> <optionalWs> "{" <endline> <syntax> "}"
  8.                 | "repeat_" <woru>  <optionalWs> "{" <endline> <syntax> "}"
  9.                 | "loop_"   <torf>  <optionalWs> "{" <endline> <syntax> "}"
  10.                 | "if_"     <torf>  <optionalWs> "{" <endline> <syntax> "}"
  11.                 | <var>
  12.                 | <optionalWs>
  13.  
  14. <endline>    ::= <optionalWs> <EOL> | <endline> <endline>
  15. <torf>       ::= "true"             | "false"
  16. <woru>       ::= "while"            | "until"
  17. <optionalWs> ::= " " <optionalWs>   | ""
  18. <ws>         ::= " " <ws>           | " "
  19. <id>         ::= <alunder>          | <id> <alnumunder>
  20. <func>       ::= <id>               | <func> "." <func>
  21.  
  22. <letter>     ::= "A" | "B" | "C" | "D" | "E" | "F" | "G" | "H" | "I" | "J" | "K" | "L" | "M"
  23.                | "N" | "O" | "P" | "Q" | "R" | "S" | "T" | "U" | "V" | "W" | "X" | "Y" | "Z"
  24.                | "a" | "b" | "c" | "d" | "e" | "f" | "g" | "h" | "i" | "j" | "k" | "l" | "m"
  25.                | "n" | "o" | "p" | "q" | "r" | "s" | "t" | "u" | "v" | "w" | "x" | "y" | "z"
  26.  
  27. <digit>      ::= "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9"
  28.  
  29. <symbol>     ::= "|" | " " | "!" | "#" | "$" | "%" | "&" | "("
  30.                | ")" | "*" | "+" | "," | "-" | "." | "/" | ":"
  31.                | ";" | ">" | "=" | "<" | "?" | "@" | "[" |"\\"
  32.                | "]" | "^" | "_" | "`" | "{" | "}" | "~"
  33.  
  34. <alnum>      ::= <letter> | <digit>
  35. <alunder>    ::= <letter> | "_"
  36. <alnumunder> ::= <alnum>  | "_"
  37. <any>        ::= <letter> | <digit> | <symbol>
  38. <anychrs>    ::= <any>    | <anychrs> <any>
  39. <strchrs1>   ::= <any>    | "'"     | '\"'
  40. <strchrs2>   ::= <any>    | '"'     | "\'"
  41. <string1>    ::= <any>    | <strchrs1> <any>
  42. <string2>    ::= <any>    | <strchrs2> <any>
  43.  
  44. <num>        ::= <num> <digit> | <digit>
  45. <keyword>    ::= "axe" | "chicken" | "add" | "fox" | "rooster" | "compare" | "pick" | "peck" | "fr" | "bbq"
  46. <str>        ::= '"' <string1> '"' | "'" <string2> "'"
  47. <value>      ::= <str> | <num>
  48. <push>       ::= "push" <ws> <value>
  49. <hatch>      ::= "hatch" <ws> <func>
  50.  
  51. <var>        ::= <id> <optionalWs> "[" <optionalWs> <num> <optionalWs> "]" <optionalWs> "=" <optionalWs> <value>
  52.                | <id> <optionalWs> "[" <optionalWs> <num> <optionalWs> "]" <optionalWs> "=" <optionalWs> "Top"
  53.                | <id> <optionalWs> "[" <optionalWs> <num> <optionalWs> "]"
  54.                | <id> <optionalWs> "=" <optionalWs> <value>
  55.                | <id> <optionalWs> "=" <optionalWs> "Top"
  56.                | <id>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement