/*
*
* Lexer definitions
*
*/
|
<DEFAULT> SKIP : {
" "
| "\t"
| "\n"
| "\r"
| "\f"
}
|
<DEFAULT> SPECIAL : {
<SINGLE_LINE_COMMENT: "//" (~["\n","\r"])* ("\n" | "\r" | "\r\n")>
| <FORMAL_COMMENT: "/**" (~["*"])* "*" ("*" | ~["*","/"] (~["*"])* "*")* "/">
| <MULTI_LINE_COMMENT: "/*" (~["*"])* "*" ("*" | ~["*","/"] (~["*"])* "*")* "/">
}
|
<DEFAULT> TOKEN [IGNORE_CASE] : {
<ADD: "ADD">
| <AGGREGATE: "AGGREGATE">
| <AGGREGATED: "AGGREGATED">
| <ALL: "ALL">
| <ALTER: "ALTER">
| <AND: "AND">
| <ANNOUNCE: "ANNOUNCE">
| <ARRAY: "ARRAY">
| <AS: "AS">
| <ASC: "ASC">
| <ATTRIBUTES_OF: "ATTRIBUTES_OF">
| <AVG: "AVG">
| <AVGD: "AVGD">
| <BASE: "BASE">
| <BACKUP: "BACKUP">
| <BEGIN: "BEGIN">
| <BUT: "BUT">
| <BY: "BY">
| <CALL: "CALL">
| <CASE: "CASE">
| <COMMIT: "COMMIT">
| <COMPOSE: "COMPOSE">
| <CONSTRAINT: "CONSTRAINT">
| <COUNT: "COUNT">
| <COUNTD: "COUNTD">
| <DELETE: "DELETE">
| <DESC: "DESC">
| <DISTINCT: "DISTINCT">
| <DIVIDEBY: "DIVIDEBY">
| <DO: "DO">
| <DROP: "DROP">
| <D_INSERT: "D_INSERT">
| <D_UNION: "D_UNION">
| <ELSE: "ELSE">
| <END: "END">
| <EOT: "<EOT>">
| <EQUIV: "EQUIV">
| <EXACTLYD: "EXACTLYD">
| <EXACTLY: "EXACTLY">
| <EXECUTE: "EXECUTE">
| <EXTEND: "EXTEND">
| <EXTERNAL: "EXTERNAL">
| <FALSE: "FALSE">
| <FOREIGN: "FOREIGN"> : SCRIPT
| <FOR: "FOR">
| <FROM: "FROM">
| <FULL: "FULL">
| <GROUP: "GROUP">
| <I_DELETE: "I_DELETE">
| <I_MINUS: "I_MINUS">
| <IF: "IF">
| <IMAGE_IN: "IMAGE_IN">
| <IN: "IN">
| <INFINITY: "INFINITY">
| <INIT: "INIT">
| <INSERT: "INSERT">
| <INTERSECT: "INTERSECT">
| <IS: "IS">
| <JOIN: "JOIN">
| <KEY: "KEY">
| <LEAVE: "LEAVE">
| <LEFT: "LEFT">
| <LOAD: "LOAD">
| <LAMBDA: "~[">
| <LAMBDAEND: "]~">
| <MATCHING: "MATCHING">
| <MAX: "MAX">
| <MIN: "MIN">
| <MINUS: "MINUS">
| <NAN: "NAN">
| <NOEMPTY: "NOEMPTY">
| <NOT: "NOT">
| <OPERATOR: "OPERATOR">
| <ORDER: "ORDER">
| <ORDERED: "ORDERED">
| <ORDINAL: "ORDINAL">
| <OR: "OR">
| <OUTPUT: "OUTPUT">
| <PER: "PER">
| <POSSREP: "POSSREP">
| <PREFIX: "PREFIX">
| <PRIVATE: "PRIVATE">
| <PUBLIC: "PUBLIC">
| <RANK: "RANK">
| <REAL: "REAL">
| <RELATION: "RELATION" | "REL">
| <RENAME: "RENAME">
| <RETURN: "RETURN">
| <RETURNS: "RETURNS">
| <RIGHT: "RIGHT">
| <ROLLBACK: "ROLLBACK">
| <SAME_HEADING_AS: "SAME_HEADING_AS">
| <SAME_TYPE_AS: "SAME_TYPE_AS">
| <SEARCH: "SEARCH">
| <SET: "SET">
| <SEMIJOIN: "SEMIJOIN">
| <SEMIMINUS: "SEMIMINUS">
| <SUFFIX: "SUFFIX">
| <SUMD: "SUMD">
| <SUMMARIZE: "SUMMARIZE">
| <SUM: "SUM">
| <SYNONYMS: "SYNONYMS">
| <TABLE_DEE: "DEE" | "TABLE_DEE">
| <TABLE_DUM: "DUM" | "TABLE_DUM">
| <TCLOSE: "TCLOSE">
| <THEN: "THEN">
| <TIMES: "TIMES">
| <TO: "TO">
| <TRANSACTION: "TRANSACTION">
| <TRUE: "TRUE">
| <TUPLE: "TUPLE" | "TUP">
| <TYPE: "TYPE">
| <TYPE_OF: "TYPE_OF">
| <UNGROUP: "UNGROUP">
| <UNION: "UNION">
| <UNORDER: "UNORDER">
| <UNWRAP: "UNWRAP">
| <UPDATES: "UPDATES">
| <UPDATE: "UPDATE">
| <VAR: "VAR">
| <VERSION: "VERSION">
| <VIRTUAL: "VIRTUAL" | "VIEW">
| <WHEN: "WHEN">
| <WHERE: "WHERE">
| <WHILE: "WHILE">
| <WITH: "WITH">
| <WRAP: "WRAP">
| <WRITE: "WRITE">
| <WRITELN: "WRITELN">
| <XOR: "XOR">
| <XUNION: "XUNION">
}
|
<DEFAULT> TOKEN : {
<INTEGER_LITERAL: <DECIMAL_LITERAL> (["l","L"])?>
| <#DECIMAL_LITERAL: ["0"-"9"] (["0"-"9"])*>
| <FLOATING_POINT_LITERAL: (["0"-"9"])+ "." (["0"-"9"])* (<EXPONENT>)? (["f","F","d","D"])? | "." (["0"-"9"])+ (<EXPONENT>)? (["f","F","d","D"])? | (["0"-"9"])+ <EXPONENT> (["f","F","d","D"])? | (["0"-"9"])+ (<EXPONENT>)? ["f","F","d","D"]>
| <#EXPONENT: ["e","E"] (["+","-"])? (["0"-"9"])+>
| <STRING_LITERAL: ("\"" | "\u2018" | "\u2019" | "\u201c" | "\u201d") (~["\"","\\","\n","\r"] | "\\" (["n","t","b","r","f","\\","\'","\""] | ["0"-"7"] (["0"-"7"])? | ["0"-"3"] ["0"-"7"] ["0"-"7"]))* ("\"" | "\'" | "\u2018" | "\u2019" | "\u201c" | "\u201d") | "\'" (~["\'","\\","\n","\r"] | "\\" (["n","t","b","r","f","\\","\'","\""] | ["0"-"7"] (["0"-"7"])? | ["0"-"3"] ["0"-"7"] ["0"-"7"]))* ("\'" | "\"" | "\u2018" | "\u2019" | "\u201c" | "\u201d")>
}
|
<DEFAULT> TOKEN : {
<IDENTIFIER: <LETTER> (<LETTER> | <DIGIT> | "." | "#")*>
| <#LETTER: ["$","A"-"Z","_","a"-"z","\u00c0"-"\u00d6","\u00d8"-"\u00f6","\u00f8"-"\u00ff","\u0100"-"\u1fff","\u3040"-"\u318f","\u3300"-"\u337f","\u3400"-"\u3d2d","\u4e00"-"\u9fff","\uf900"-"\ufaff"]>
| <#DIGIT: ["0"-"9","\u0660"-"\u0669","\u06f0"-"\u06f9","\u0966"-"\u096f","\u09e6"-"\u09ef","\u0a66"-"\u0a6f","\u0ae6"-"\u0aef","\u0b66"-"\u0b6f","\u0be7"-"\u0bef","\u0c66"-"\u0c6f","\u0ce6"-"\u0cef","\u0d66"-"\u0d6f","\u0e50"-"\u0e59","\u0ed0"-"\u0ed9","\u1040"-"\u1049"]>
}
|
<DEFAULT> TOKEN : {
<LPAREN: "(">
| <RPAREN: ")">
| <LBRACE: "{">
| <RBRACE: "}">
| <SEMICOLON: ";">
| <COMMA: ",">
| <COLON: ":">
}
|
<DEFAULT> TOKEN : {
<ASSIGN: ":=">
| <EQ: "=">
| <GT: ">">
| <LT: "<">
| <LTE_A: "<=">
| <LTE_U: "\u2264">
| <GTE_A: ">=">
| <GTE_U: "\u2265">
| <NEQ_A: "<>">
| <NEQ_U: "\u2260">
| <PLUS: "+">
| <SUBT: "-">
| <STAR: "*">
| <MULT_U: "\u00d7">
| <DIVD_A: "/">
| <DIVD_U: "\u00f7">
| <MODL: "%">
| <BANGBANG_A: "!!">
| <BANGBANG_U: "\u203c">
| <SUBSET: "\u2282">
| <SUBSET_OR_EQUAL: "\u2286">
| <SUPERSET: "\u2283">
| <SUPERSET_OR_EQUAL: "\u2287">
| <ELEMENT_U: "\u2208">
| <BARBAR: "||">
}
|
<SCRIPT> TOKEN : {
<ENDFOREIGN: "\nEND"> : DEFAULT
| <TEXT: ~[]>
}
|
evaluate |
::= |
( compound_statement_body ";" )? expression ( <EOT> | <EOF> ) |
statement_list |
::= |
( statement )* |
code |
::= |
statement_list ( <EOT> | <EOF> ) |
statement |
::= |
statement_body ";" |
op_before_returns |
::= |
<OPERATOR> identifier "(" ( identifier type_ref ( "," identifier type_ref )* )? ")" |
op_after_returns |
::= |
op_updates op_synonym op_version ";" op_body <END> ( <OPERATOR> )? |
|
| |
identifier <FOREIGN> ( <TEXT> )* <ENDFOREIGN> ( <OPERATOR> )? |
getoperatorreturntype |
::= |
op_before_returns op_returns op_after_returns |
getheading |
::= |
heading |
getsignature |
::= |
op_signature op_returns |
statement_body |
::= |
assignment |
|
| |
loop |
|
| |
op_def |
|
| |
type_def |
|
| |
drop |
|
| |
alter |
|
| |
var_def |
|
| |
db_constraint_def |
|
| |
relation_array_load |
|
| |
begin_transaction |
|
| |
compound_statement_body |
|
| |
commit |
|
| |
rollback |
|
| |
call |
|
| |
return_statement |
|
| |
case_statement |
|
| |
if_statement |
|
| |
leave |
|
| |
write |
|
| |
writeln |
|
| |
output |
|
| |
announce |
|
| |
execute |
|
| |
set |
|
| |
backup |
/* Rel extension - non-TTM */
|
backup |
::= |
<BACKUP> |
/* Rel extension - non-TTM */
|
write |
::= |
<WRITE> expression |
/* Rel extension - non-TTM */
|
writeln |
::= |
<WRITELN> ( expression )? |
/* Rel extension - non-TTM */
|
output |
::= |
<OUTPUT> expression |
/* Rel extension - non-TTM */
|
announce |
::= |
<ANNOUNCE> string_literal |
/* Rel extension - non-TTM */
|
execute |
::= |
<EXECUTE> expression |
/* Rel extension - non-TTM */
|
set |
::= |
<SET> identifier identifier |
compound_statement_body |
::= |
<BEGIN> ";" statement_list <END> |
op_def |
::= |
<OPERATOR> identifier "(" parameter_def_commalist ")" op_returns ( rel_op_def | external_op_def ) |
lambda |
::= |
<OPERATOR> lambda_definition <END> ( <OPERATOR> )? |
|
| |
<LAMBDA> lambda_definition <LAMBDAEND> |
lambda_definition |
::= |
"(" parameter_def_commalist ")" <RETURNS> type_ref ";" op_body |
external_op_def |
::= |
identifier <FOREIGN> ( <TEXT> )* <ENDFOREIGN> ( <OPERATOR> )? |
rel_op_def |
::= |
op_updates op_synonym op_version ";" op_body <END> ( <OPERATOR> )? |
/* Note: op_returns() and op_updates()
should be mutually exclusive. */
|
op_returns |
::= |
( <RETURNS> type_ref )? |
op_updates |
::= |
( <UPDATES> "{" ( <ALL> <BUT> parameter_name_commalist )? "}" )? |
op_synonym |
::= |
( synonym_def )? |
op_version |
::= |
( <VERSION> identifier )? |
op_body |
::= |
statement_list |
return_statement |
::= |
<RETURN> ( expression )? |
/* Not explicitly defined in TTM3 */
|
parameter_def_commalist |
::= |
( parameter_def ( "," parameter_def )* )? |
parameter_def |
::= |
identifier type_ref |
/* Not explicitly defined in TTM3 */
|
parameter_name_commalist |
::= |
( identifier ( "," identifier )* )? |
synonym_def |
::= |
<SYNONYMS> "{" user_op_name_commalist "}" |
/* Not explicitly defined in TTM3 */
|
user_op_name_commalist |
::= |
identifier ( "," identifier )* |
/* Inclusion of type_ref_commalist() in
OPERATOR DROP is not per TTM3,
but necessary to
disambiguate operators. */
|
drop |
::= |
<DROP> ( <OPERATOR> op_signature | <VAR> identifier | <CONSTRAINT> identifier | <TYPE> identifier ) |
op_signature |
::= |
identifier "(" type_ref_commalist ")" |
alter |
::= |
<ALTER> alter_var |
alter_var |
::= |
<VAR> identifier alter_var_action_optional ( var_keydeflist )? |
alter_var_action_optional |
::= |
( alter_var_action )* |
alter_var_action |
::= |
<RENAME> identifier <TO> identifier |
|
| |
<TYPE_OF> identifier <TO> type_ref |
|
| |
<INSERT> attribute_spec |
|
| |
<DROP> identifier |
op_type |
::= |
<OPERATOR> "(" type_ref_commalist ")" ( <RETURNS> type_ref )? |
type_ref_commalist |
::= |
( type_ref ( "," type_ref )* )? |
/* Was user_scalar_type_def */
|
type_def |
::= |
<TYPE> identifier type_def_kind |
type_def_kind |
::= |
type_def_external |
|
| |
type_def_internal |
type_def_external |
::= |
identifier <FOREIGN> ( <TEXT> )* <ENDFOREIGN> ( <TYPE> )? |
/* User-defined (internal) types start here */
|
type_def_internal |
::= |
type_def_internal_ordinal type_def_internal_union type_def_internal_is_or_possrep |
type_def_internal_is_or_possrep |
::= |
is_def |
|
| |
possrep_def_list |
type_def_internal_ordinal |
::= |
( type_def_internal_opt_ordinal )? |
type_def_internal_opt_ordinal |
::= |
( <ORDINAL> | <ORDERED> ) |
type_def_internal_union |
::= |
( type_def_internal_opt_union )? |
type_def_internal_opt_union |
::= |
<UNION> |
is_def |
::= |
<IS> "{" ( single_inheritance_is_def | multiple_inheritance_is_def ) "}" |
single_inheritance_is_def |
::= |
identifier possrep_or_specialization_details |
possrep_or_specialization_details |
::= |
specialisation_constraint_def ( derived_possrep_def_list )? |
|
| |
possrep_def_list |
multiple_inheritance_is_def |
::= |
scalar_type_name_commalist derived_possrep_def_list |
/* Not explicitly defined in TTM3 */
|
scalar_type_name_commalist |
::= |
scalar_type_name ( "," scalar_type_name )* |
scalar_type_name |
::= |
identifier |
/* Not explicitly defined in TTM3 */
|
possrep_def_list |
::= |
( possrep_def )* possrep_opt_initialiser |
/* Not defined in TTM3. For explicitly setting
values of components not in the current possrep.
Only required by types with multiple possreps.
Takes the place of "highly protected
operators not part of D". (pg 382, etc.) */
|
possrep_opt_initialiser |
::= |
( <INIT> possrep_initialiser_assignments ( possrep_initialiser_assignments )* )? |
/* Not defined in TTM3, as per above.
Identifier should be existing POSSREP name. */
|
possrep_initialiser_assignments |
::= |
identifier "(" assignment ")" |
possrep_def |
::= |
<POSSREP> possrep_def_identifier ( "{" | "(" ) possrep_component_def_commalist possrep_opt_constraint_def ( "}" | ")" ) |
possrep_def_identifier |
::= |
( identifier )? |
possrep_opt_constraint_def |
::= |
( constraint_def )? |
/* Not explicitly defined in TTM3 */
|
possrep_component_def_commalist |
::= |
( possrep_component_def ( "," possrep_component_def )* )? |
possrep_component_def |
::= |
identifier type_ref |
/* Expression must be boolean */
|
constraint_def |
::= |
<CONSTRAINT> expression |
/* Expression must be boolean */
|
specialisation_constraint_def |
::= |
<CONSTRAINT> expression |
/* Not explicitly defined in TTM3 */
|
derived_possrep_def_list |
::= |
derived_possrep_def ( derived_possrep_def )* |
derived_possrep_def |
::= |
<POSSREP> derived_possrep_def_opt_identifier ( "(" | "{" ) derived_possrep_component_def_commalist ( "}" | ")" ) |
derived_possrep_def_opt_identifier |
::= |
( identifier )? |
/* Not explicitly defined in TTM3 */
|
derived_possrep_component_def_commalist |
::= |
derived_possrep_component_def ( "," derived_possrep_component_def )* |
derived_possrep_component_def |
::= |
identifier "=" identifier "(" identifier ")" |
/* End user-defined types (internal) */
/* Includes scalar_var_def,
relation_var_def,
tuple_var_def */
|
var_def |
::= |
<VAR> identifier ( var_scalar_or_tuple | var_relvar ) |
var_relvar |
::= |
( <REAL> | <BASE> ) var_type_or_init_value var_keydeflist |
|
| |
<PRIVATE> var_type_or_init_value var_keydeflist |
|
| |
<PUBLIC> type_ref var_keydeflist |
|
| |
<VIRTUAL> expression var_keydeflistoptional |
|
| |
var_relvar_external |
var_relvar_external |
::= |
<EXTERNAL> identifier string_literal ( identifier )? |
var_keydeflist |
::= |
var_keydef ( var_keydef )* |
var_keydeflistoptional |
::= |
( var_keydef )* |
var_keydef |
::= |
<KEY> "{" attribute_name_list "}" |
var_scalar_or_tuple |
::= |
var_type_or_init_value |
var_type_or_init_value |
::= |
var_type_and_optional_init |
|
| |
var_init |
var_type_and_optional_init |
::= |
type_ref ( <INIT> "(" expression ")" )? |
var_init |
::= |
<INIT> "(" expression ")" |
db_constraint_def |
::= |
<CONSTRAINT> identifier expression |
/* type -- scalar_type, tuple_type, relation_type */
|
type_ref |
::= |
identifier |
|
| |
type_same_type_as |
|
| |
tuple_type |
|
| |
relation_type |
|
| |
op_type |
|
| |
type_array |
type_array |
::= |
<ARRAY> type_ref |
type_same_type_as |
::= |
<SAME_TYPE_AS> "(" expression ")" |
tuple_type |
::= |
<TUPLE> heading_type |
relation_type |
::= |
<RELATION> heading_type |
heading_type |
::= |
heading |
|
| |
same_heading_as |
same_heading_as |
::= |
<SAME_HEADING_AS> "(" expression ")" |
relation_array_load |
::= |
<LOAD> identifier <FROM> expression |
begin_transaction |
::= |
<BEGIN> <TRANSACTION> |
commit |
::= |
<COMMIT> |
rollback |
::= |
<ROLLBACK> |
case_statement |
::= |
<CASE> ";" when_def_list case_else <END> ( <CASE> )? |
when_def_list |
::= |
when_def ( when_def )* |
when_def |
::= |
<WHEN> expression <THEN> statement_list |
case_else |
::= |
( <ELSE> statement_list )? |
/* Note that THEN and ELSE are not
followed by semicolons, but maybe should be? */
|
if_statement |
::= |
<IF> expression <THEN> statement_list if_statement_else <END> ( <IF> )? |
if_statement_else |
::= |
( <ELSE> statement_list )? |
loop |
::= |
( identifier ":" )? ( do_statement | while_statement | for_statement ) |
do_statement |
::= |
<DO> identifier ":=" expression <TO> expression ";" statement_list <END> ( <DO> )? |
while_statement |
::= |
<WHILE> expression ";" statement_list <END> ( <WHILE> )? |
for_statement |
::= |
<FOR> expression ";" statement_list <END> ( <FOR> )? |
leave |
::= |
<LEAVE> identifier |
call |
::= |
<CALL> identifier "(" arglist ")" |
assignment |
::= |
assign ( "," assign )* |
assign |
::= |
identifier ":=" expression |
|
| |
<INSERT> identifier expression |
|
| |
<D_INSERT> identifier expression |
|
| |
<DELETE> identifier delete_parameter |
|
| |
<I_DELETE> identifier expression |
|
| |
<UPDATE> identifier update_where ":" update_assignment |
delete_parameter |
::= |
( ( <WHERE> )? expression )? |
update_where |
::= |
( <WHERE> expression )? |
update_assignment |
::= |
"{" ( assignment )? "}" |
/* Expressions */
|
expression |
::= |
( attribute_from | basic_expression | tuple_from | with | tclose ) |
attribute_from |
::= |
identifier <FROM> expression |
tuple_from |
::= |
<TUPLE> <FROM> expression |
with |
::= |
<WITH> "(" name_intro_commalist ")" ":" expression |
name_intro_commalist |
::= |
name_intro ( "," name_intro )* |
name_intro |
::= |
identifier ":=" expression |
tclose |
::= |
<TCLOSE> expression |
basic_expression |
::= |
order_expression ( "[" expression "]" | "(" arglist ")" )? |
order_expression |
::= |
where_expression ( ( <ORDER> "(" order_item_commalist ")" | <UNORDER> "(" ")" ) )? |
where_expression |
::= |
equiv_expression ( <WHERE> equiv_expression )? |
equiv_expression |
::= |
or_expression ( <EQUIV> or_expression )* |
or_expression |
::= |
xor_expression ( <OR> xor_expression )* |
xor_expression |
::= |
and_expression ( <XOR> and_expression )* |
and_expression |
::= |
compare_expression ( <AND> compare_expression )* |
compare_expression |
::= |
rel_op ( <EQ> rel_op | ( <NEQ_A> | <NEQ_U> ) rel_op | ( <GTE_A> | <GTE_U> ) rel_op | ( <LTE_A> | <LTE_U> ) rel_op | <GT> rel_op | <LT> rel_op | <SUBSET> rel_op | <SUBSET_OR_EQUAL> rel_op | <SUPERSET> rel_op | <SUPERSET_OR_EQUAL> rel_op | ( <IN> | <ELEMENT_U> ) rel_op )? |
/* Parentheses around WRAP, UNWRAP, GROUP, UNGROUP removed as of 1.0.11
Infix EXTEND added as of 1.0.20. Not per Tutorial D spec.
Infix SUMMARIZE added as of 1.0.20. Not per Tutorial D spec.
rel_monadic() and rel_dyadic() combined and changed to rel_op() to
give monadic and dyadic ops equal precedence.
*/
|
rel_op |
::= |
rel_project ( <RENAME> "{" renaming_commalist "}" | <EXTEND> ( ":" )? "{" extend_add_commalist "}" | <RANK> ( <BY> )? "(" order_item_commalist <AS> identifier ")" | <SUMMARIZE> per_or_by ( ":" )? "{" summarize_add_commalist "}" | <UPDATE> ( ":" )? update_assignment | <WRAP> wrapping | <UNWRAP> identifier | <GROUP> grouping | <UNGROUP> identifier | <DIVIDEBY> expression <PER> "(" expression divide_per_optional ")" | <UNION> rel_project | <XUNION> rel_project | <D_UNION> rel_project | <INTERSECT> rel_project | <MINUS> rel_project | <I_MINUS> rel_project | <JOIN> rel_project | <LEFT> <JOIN> rel_project | <RIGHT> <JOIN> rel_project | <FULL> <JOIN> rel_project | <TIMES> rel_project | <COMPOSE> rel_project | ( <SEMIJOIN> | <MATCHING> ) rel_project | ( <SEMIMINUS> | <NOT> <MATCHING> ) rel_project )* |
/* Not explicitly defined in TTM3 */
|
order_item_commalist |
::= |
( order_item ( "," order_item )* )? |
order_item |
::= |
<ASC> identifier |
|
| |
<DESC> identifier |
divide_per_optional |
::= |
( "," expression )? |
grouping |
::= |
"{" attribute_name_list "}" <AS> identifier |
wrapping |
::= |
"{" attribute_name_list "}" <AS> identifier |
renaming_commalist |
::= |
( renaming ( "," renaming )* )? |
renaming |
::= |
renaming_simple |
|
| |
renaming_prefix |
|
| |
renaming_suffix |
renaming_simple |
::= |
identifier <AS> identifier |
renaming_prefix |
::= |
<PREFIX> string_literal <AS> string_literal |
renaming_suffix |
::= |
<SUFFIX> string_literal <AS> string_literal |
attribute_name_list |
::= |
optional_all_but attribute_name_commalist |
optional_all_but |
::= |
( <ALL> <BUT> )? |
attribute_name_commalist |
::= |
attribute_name_commalist_attributes_of |
|
| |
attribute_name_commalist_list |
attribute_name_commalist_attributes_of |
::= |
<ATTRIBUTES_OF> "(" expression ")" |
attribute_name_commalist_list |
::= |
( identifier ( "," identifier )* )? |
rel_project |
::= |
add_expression ( "{" attribute_name_list "}" )? |
add_expression |
::= |
mul_expression ( <PLUS> mul_expression | <SUBT> mul_expression | <BARBAR> mul_expression )* |
mul_expression |
::= |
unary_expression ( ( <STAR> | <MULT_U> ) unary_expression | ( <DIVD_A> | <DIVD_U> ) unary_expression | <MODL> unary_expression )* |
unary_expression |
::= |
<NOT> unary_expression |
|
| |
<PLUS> unary_expression |
|
| |
<SUBT> unary_expression |
|
| |
primary_expression |
primary_expression |
::= |
literal |
|
| |
aggregate_operator |
|
| |
exactly |
|
| |
nadic_or |
|
| |
nadic_equiv |
|
| |
nadic_xor |
|
| |
nadic_and |
|
| |
nadic_union |
|
| |
nadic_xunion |
|
| |
nadic_disjoint_union |
|
| |
nadic_intersect |
|
| |
nadic_join |
|
| |
nadic_times |
|
| |
nadic_compose |
|
| |
nadic_count |
|
| |
nadic_sum |
|
| |
nadic_avg |
|
| |
nadic_max |
|
| |
nadic_min |
|
| |
extend |
|
| |
rank |
|
| |
summarize |
|
| |
substitute |
|
| |
case_expression |
|
| |
if_expression |
|
| |
search |
|
| |
type_of |
|
| |
image_in |
|
| |
fn_invoke |
|
| |
dereference |
|
| |
"(" expression ")" |
search |
::= |
<SEARCH> "(" expression "," expression ")" |
type_of |
::= |
<TYPE_OF> "(" expression ")" |
image_in |
::= |
( <BANGBANG_A> | <BANGBANG_U> ) ( image_in_bracketed | image_in_identifier ) |
|
| |
<IMAGE_IN> image_in_bracketed |
image_in_bracketed |
::= |
"(" expression ( "," expression )? ")" |
image_in_identifier |
::= |
identifier |
case_expression |
::= |
<CASE> when_def_list_expr <ELSE> expression <END> ( <CASE> )? |
when_def_list_expr |
::= |
when_def_expr ( when_def_expr )* |
when_def_expr |
::= |
<WHEN> expression <THEN> expression |
if_expression |
::= |
<IF> expression <THEN> expression <ELSE> expression <END> ( <IF> )? |
/* Update expression, *not* assignment.
Contents of expression() does not change! */
|
substitute |
::= |
<UPDATE> expression ":" update_assignment |
nadic_optional_heading |
::= |
heading "{" heading_exp_commalist "}" |
|
| |
"{" heading_exp_commalist "}" |
nadic_union |
::= |
<UNION> nadic_optional_heading |
nadic_xunion |
::= |
<XUNION> nadic_optional_heading |
nadic_disjoint_union |
::= |
<D_UNION> nadic_optional_heading |
nadic_intersect |
::= |
<INTERSECT> nadic_optional_heading |
nadic_join |
::= |
<JOIN> "{" heading_exp_commalist "}" |
nadic_times |
::= |
<TIMES> "{" heading_exp_commalist "}" |
nadic_compose |
::= |
<COMPOSE> "{" heading_exp_commalist "}" |
nadic_or |
::= |
<OR> "{" bool_exp_commalist "}" |
nadic_equiv |
::= |
<EQUIV> "{" bool_exp_commalist "}" |
nadic_xor |
::= |
<XOR> "{" bool_exp_commalist "}" |
nadic_and |
::= |
<AND> "{" bool_exp_commalist "}" |
nadic_count |
::= |
<COUNT> "{" exp_commalist "}" |
nadic_sum |
::= |
<SUM> "{" exp_commalist "}" |
nadic_avg |
::= |
<AVG> "{" exp_commalist "}" |
nadic_max |
::= |
<MAX> "{" exp_commalist "}" |
nadic_min |
::= |
<MIN> "{" exp_commalist "}" |
exactly |
::= |
<EXACTLY> "(" expression ( "," expression ( "," expression )* )? ")" |
exp_commalist |
::= |
( expression ( "," expression )* )? |
bool_exp_commalist |
::= |
( expression ( "," expression )* )? |
heading_exp_commalist |
::= |
( expression ( "," expression )* )? |
extend |
::= |
<EXTEND> expression ":" "{" extend_add_commalist "}" |
rank |
::= |
<RANK> expression <BY> "(" order_item_commalist <AS> identifier ")" |
extend_add_commalist |
::= |
( extend_add ( "," extend_add )* )? |
extend_add |
::= |
identifier ":=" expression |
summarize |
::= |
<SUMMARIZE> expression per_or_by ":" "{" summarize_add_commalist "}" |
per_or_by |
::= |
( <PER> "(" expression ")" | <BY> "{" attribute_name_list "}" )? |
summarize_add_commalist |
::= |
summarize_add ( "," summarize_add )* |
summarize_add |
::= |
identifier ":=" summary |
summary |
::= |
<COUNT> "(" ")" |
|
| |
<COUNTD> "(" expression ")" |
|
| |
<SUM> "(" expression ")" |
|
| |
<SUMD> "(" expression ")" |
|
| |
<AVG> "(" expression ")" |
|
| |
<AVGD> "(" expression ")" |
|
| |
<MAX> "(" expression ")" |
|
| |
<MIN> "(" expression ")" |
|
| |
<AND> "(" expression ")" |
|
| |
<OR> "(" expression ")" |
|
| |
<EQUIV> "(" expression ")" |
|
| |
<XOR> "(" expression ")" |
|
| |
<EXACTLY> "(" expression "," expression ")" |
|
| |
<EXACTLYD> "(" expression "," expression ")" |
|
| |
<UNION> "(" expression ")" |
|
| |
<XUNION> "(" expression ")" |
|
| |
<D_UNION> "(" expression ")" |
|
| |
<INTERSECT> "(" expression ")" |
|
| |
summarize_aggregate |
|
| |
summarize_aggregated |
|
| |
summarize_userdefined |
/* Rel extension. */
|
summarize_aggregate |
::= |
<AGGREGATE> "(" expression ( "," expression )? ")" ";" op_body <END> ( <AGGREGATE> )? |
/* Rel extension. */
|
summarize_aggregated |
::= |
<AGGREGATED> "(" expression ( "," expression )? ")" ";" op_body <END> ( <AGGREGATED> )? |
/* Rel extension. */
|
summarize_userdefined |
::= |
identifier "(" SummarizeItemDistinct expression ( "," expression )? ")" |
/* Rel extension. */
|
SummarizeItemDistinct |
::= |
( SummarizeItemDistinctTrue )? |
/* Rel extension. */
|
SummarizeItemDistinctTrue |
::= |
<DISTINCT> |
fn_invoke |
::= |
identifier "(" arglist ")" |
arglist |
::= |
( expression ( "," expression )* )? |
aggregate_operator |
::= |
<COUNT> "(" expression ")" |
|
| |
<SUM> "(" expression "," expression ")" |
|
| |
<AVG> "(" expression "," expression ")" |
|
| |
<MAX> "(" expression "," expression ")" |
|
| |
<MIN> "(" expression "," expression ")" |
|
| |
<AND> "(" expression "," expression ")" |
|
| |
<OR> "(" expression "," expression ")" |
|
| |
<EQUIV> "(" expression "," expression ")" |
|
| |
<XOR> "(" expression "," expression ")" |
|
| |
<UNION> "(" expression "," expression ")" |
|
| |
<XUNION> "(" expression "," expression ")" |
|
| |
<D_UNION> "(" expression "," expression ")" |
|
| |
<INTERSECT> "(" expression "," expression ")" |
|
| |
agg_aggregate |
agg_aggregate |
::= |
<AGGREGATE> ( agg_aggregate_inline | agg_aggregate_userdefined ) |
/* Rel extension. */
|
agg_aggregate_inline |
::= |
"(" expression "," expression ( "," expression )? ")" ";" op_body <END> ( <AGGREGATE> )? |
/* Rel extension. */
|
agg_aggregate_userdefined |
::= |
identifier "(" expression "," expression ( "," expression )? ")" |
literal |
::= |
lambda |
|
| |
tuple |
|
| |
relation |
|
| |
integer |
|
| |
character |
|
| |
rational |
|
| |
bool |
tuple |
::= |
<TUPLE> "{" ( tuple_component_wildcard | ( tuple_component_commalist )? ) "}" |
tuple_component_wildcard |
::= |
<STAR> |
tuple_component_commalist |
::= |
tuple_component ( "," tuple_component )* |
tuple_component |
::= |
identifier expression |
relation |
::= |
<RELATION> relation_heading "{" tuple_exp_commalist "}" |
|
| |
<TABLE_DUM> |
|
| |
<TABLE_DEE> |
relation_heading |
::= |
( heading_type )? |
heading |
::= |
"{" ( attribute_spec_commalist )? "}" |
tuple_exp_commalist |
::= |
( expression ( "," expression )* )? |
attribute_spec_commalist |
::= |
attribute_spec ( "," attribute_spec )* |
attribute_spec |
::= |
identifier type_ref |
identifier |
::= |
<IDENTIFIER> |
dereference |
::= |
<IDENTIFIER> |
character |
::= |
<STRING_LITERAL> |
string_literal |
::= |
<STRING_LITERAL> |
integer |
::= |
<INTEGER_LITERAL> |
rational |
::= |
( <FLOATING_POINT_LITERAL> | <INFINITY> | <NAN> ) |
bool |
::= |
<TRUE> |
|
| |
<FALSE> |