<- Back to shtanton's homepage
aboutsummaryrefslogtreecommitdiff
path: root/grammar.ebnf
diff options
context:
space:
mode:
Diffstat (limited to 'grammar.ebnf')
-rw-r--r--grammar.ebnf14
1 files changed, 14 insertions, 0 deletions
diff --git a/grammar.ebnf b/grammar.ebnf
new file mode 100644
index 0000000..e97bfad
--- /dev/null
+++ b/grammar.ebnf
@@ -0,0 +1,14 @@
+value = map | array | string | multiline_string | number | boolean | null ;
+map = "{", {field}, "}" | {field}, ";" | {field} >> (EOF | "]") ;
+field = key, ":", value ;
+key = '"', {-'"' | '""'}, '"' | (alphanumeric | "_" | "-"), {alphanumeric | "_" | "-"} ;
+array = "[", {value}, "]" ;
+string = '"', {-'"' | '\"'}, -("\" | '"'), '"' | '"\""' | '""' | {alphanumeric | " " | "_"}, "," | {alphanumeric | " " | "_"} >> inline_end ;
+inline_end = "\r" | "\n" | "]" | "}" | ";" | EOF ;
+multiline_string = "|", end_sequence, "\n", ?any character?, "\n", end_sequence ;
+end_sequence = {-("\r" | "\n")} ;
+integer = ["-"], {digit}, ["e", {digit}] ;
+float = ["-"], {digit}, [".", {digit}], ["e", {digit}] ;
+number = (integer | float), "," | (integer | float) >> (inline_end | whitespace) ;
+boolean = "%true" | "%false" ;
+null = "%null" ;