feat(grammar): add grammar file

This commit is contained in:
Khaïs COLIN 2025-05-30 13:52:26 +02:00
parent 8553ae7a5a
commit c863d71409
Signed by: logistic-bot
SSH key fingerprint: SHA256:3zI3/tx0ZpCLHCLPmEaGR4oeYCPMCzQxXhXutBmtOAU
2 changed files with 36 additions and 1 deletions

31
grammar.ebnf Normal file
View file

@ -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

View file

@ -224,7 +224,11 @@ i will use rustyline, since it seems like the most feature-complete
* DONE print errors to stderr * 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 * TODO parse insert statements in the form
insert <id:int> <username:string> <email:string> insert <id:int> <username:string> <email:string>