osdb/grammar.ebnf

41 lines
907 B
EBNF
Raw Normal View History

/* token is first stage of parsing */
2025-05-30 13:52:26 +02:00
token ::= insert
| select
| meta-command
| int
| string
| end-of-file
/* command is second stage of parsing */
command ::= cmd-insert
| cmd-select
cmd-insert ::= insert int string string
cmd-select ::= select
2025-05-30 13:52:26 +02:00
insert ::= "insert"
select ::= "select"
meta-command ::= "." "exit"
2025-05-30 15:48:02 +02:00
| "about"
2025-05-31 15:59:58 +02:00
| "version"
2025-05-30 13:52:26 +02:00
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