Advertisement
Guest User

Untitled

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