diff --git a/grammar.ebnf b/grammar.ebnf new file mode 100644 index 0000000..6fd2ecb --- /dev/null +++ b/grammar.ebnf @@ -0,0 +1,31 @@ +token ::= insert + | select + | meta-command + | int + | string + | end-of-file + +insert ::= "insert" +select ::= "select" + +meta-command ::= "." "exit" + +int ::= sign? digit+ +sign ::= "+" + | "-" +digit ::= "0" + | "1" + | "2" + | "3" + | "4" + | "5" + | "6" + | "7" + | "8" + | "9" + +string ::= '"' string-char* '"' +string-char ::= '\' utf8-char + | utf8-char-not-dbl-quote + + diff --git a/notes.org b/notes.org index 12d8410..9d7ccc2 100644 --- a/notes.org +++ b/notes.org @@ -224,7 +224,11 @@ i will use rustyline, since it seems like the most feature-complete * DONE print errors to stderr -* TODO write a proper grammar +* DONE write a proper grammar + +* TODO .about meta-command +* TODO .version meta-command +* TODO .license meta-command * TODO parse insert statements in the form insert