Created
January 30, 2023 03:18
-
-
Save andrejewski/c45804a3728f66a3b2f06b1bc37a7976 to your computer and use it in GitHub Desktop.
Dattle specification described in Backus–Naur form (BNF). Note: I was using the Rust `bnf` crate to iterate which doesn't seem to support UTF-8 ranges but Dattle is built atop UTF-8 and this grammar should be expanded to support UTF-8 quoted strings.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<value> ::= <nil> | <boolean> | <string> | <vector> | <map> | |
<nil> ::= "nil" | |
<boolean> ::= "true" | "false" | |
<character> ::= <bring-your-own-utf8-character-term> | |
<quote-escape> ::= '\"' | |
<string-value> ::= <character> | <quote-escape> | |
<string-content> ::= <string-value> | <string-value> <string-content> | |
<string> ::= '"' <string-content> '"' | |
<whitespace> ::= " " | "\t" | "\n" | "\r" | |
<spacing> ::= <whitespace> | <whitespace> <spacing> | |
<optional-spacing> ::= "" | <spacing> | |
<vector-elements> ::= <value> | <value> <spacing> <vector-elements> | |
<vector> ::= "[" <optional-spacing> <vector-elements> <optional-spacing> "]" | |
<map-elements> ::= <value> <spacing> <value> | <value> <spacing> <value> <spacing> <map-elements> | |
<map> ::= "{" <optional-spacing> <map-elements> <optional-spacing> "}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment