Advertisement
Guest User

Untitled

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