/*
This lexical specification defines symbols and keywords for whitespace, braces,
parentheses, commas, asterisks, and quotes, including keywords for integer, text, and boolean types.
*/
WHITESPACE = _{ " " | "\t" | "\r" | "\n" }
open_brace = { "{" }
close_brace = { "}" }
comma = { "," }
quote = { "\"" }
int = { "INT" }
text = { "TEXT" }
bool = { "BOOL" }
/*
This grammar defines a simple syntax for creating tables in a language.
It includes rules for "CREATE TABLE" statements, specifying the table name, column names, and their data types.
*/
create = { ^"CREATE" }
table = { ^"TABLE" }
table_name = @{ (ASCII_ALPHANUMERIC | "_")+ }
column_name = ${ (ASCII_ALPHANUMERIC | "_")+ }
column_type = @{ ( int | text | bool ) }
column_def = { column_name ~ column_type }
table_fields = { (column_def ~ comma)* ~ (column_def)? }
create_table = { create ~ table ~ table_name ~ (open_brace ~ table_fields ~ close_brace) }
sql_grammar = {SOI ~ create_table ~ EOI }