- More on EDN here
- More on BNF here
- BNF -> RailRoad
Not complete or totally accurate yet
EDN ::= Whitespace (Comment | (Discard Whitespace)? (Tag Whitespace)? (List | Vector | Map | Set | String | Number | Keyword | Symbol | Nil | Boolean | Char) Whitespace Comment?) | |
Nil ::= "nil" | |
True ::= "true" | |
False ::= "false" | |
Boolean ::= True | False | |
Symbol ::= (Namespace "/")? ("/" | (Alphabetic Alphanumeric*)? (("-" | "." | "+")? Alphabetic | ("*" | "!" | "_" | "?" | "$" | "%" | "&" | "=")) (Alphanumeric | "#" | ":")*) /* FIXME: very inaccurate */ | |
Keyword ::= ":" Symbol | |
/* Whitespace */ | |
Whitespace ::= (Space | Tab | Comma)* | |
Space ::= " " | |
Tab ::= "\t" | |
Comma ::= "," | |
/* Data Structures */ | |
List ::= "(" EDN* ")" | |
Vector ::= "[" EDN* "]" | |
Map ::= "{" (EDN EDN)* "}" | |
Set ::= "#{" EDN* "}" /* TODO: duplicate semantics */ | |
String ::= '"' UTF8Char* '"' /* TODO: define UTF8Char — handle escaping */ | |
Character ::= "\" (Alphabetic | "newline" | "tab" | "return" | "space") /* numbers? */ | |
/* Numbers */ | |
NonZeroDigit ::= "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | |
ZeroDigit ::= "0" | |
Digit ::= ZeroDigit | NonZeroDigit | |
Digits ::= ZeroDigit | (NonZeroDigit Digit*) | |
Integer ::= NonZeroDigit* "N" | |
Float ::= Digits ("M" | (Digits (Fraction | (Fraction? Exponent)) "M"?)) | |
Fraction ::= "." Digit+ | |
Exponent ::= ("e" | "E") Sign? Digits | |
Sign ::= "+" | "-" | |
Number ::= Sign? (Integer | Float) | |
/* Misc */ | |
Comment ::= ";" UTF8Char* NewLine | |
NewLine ::= "\r\n" | "\n" | "\r" | |
UpperAlphabetic ::= "A" | "B" | "C" | "D" | "E" | "F" | "G" | "H" | "I" | "J" | "K" | "L" | "M" | "N" | "O" | "P" | "Q" | "R" | "S" | "T" | "U" | "V" | "W" | "X" | "Y" | "Z" | |
LowerAlphabetic ::= "a" | "b" | "c" | "d" | "e" | "f" | "g" | "h" | "i" | "j" | "k" | "l" | "m" | "n" | "o" | "p" | "q" | "r" | "s" | "t" | "u" | "v" | "w" | "x" | "y" | "z" | |
Alphabetic ::= UpperAlphabetic | LowerAlphabetic | |
Namespace ::= LowerAlphabetic+ ("." LowerAlphabetic+)* | |
Tag ::= "#" (Namespace "/") Alphabetic+ | |
Discard ::= "#_" |
Not complete or totally accurate yet