Description of Valentina SQL Grammar Rules
rule
A rule has name and body. Rule names are in low case. After rule name we use semicolon ‘:’rule_name : rule_body
key words
Key words are in the UPPER case.rule_name : SELECT
alternatives
A rule body can have several alternatives. Alternatives are separated by symbol '|'. You can read this symbol as “OR”.rule_name : select | execute
groups >sometimes we need to group some elements of a rule. For this we use {}
rule_name: {elem1 | elem2} elem3
this is the same asrule_name: elem1 elem3 | elem2 elem3
optional >Some words or group of words can be optional. To mark them as optional we use []
rule_name : SELECT [FROM table_name]
*
the STAR after [] or {} means: repeated zero or more times. (Like in regex).rule_name: elem [, elem ]*
+
the PLUS after [] or {} means: repeated zero or one times. (Like in regex).rule_name: elem [, elem ]+
coma list
Often we need to show a list of elements separated by coma. We can use for this the next short notation:
rule_name: elem, …
this is the same as:rule_name: elem [, …]
this is the same as:rule_name: elem [, elem ]*