This resolution replaces the resolution given by issue 10923 (2nd Ballot)
(1) Replaces the BNF grammar with the following:
// keywords
Bag, Collection, Dict, OrderedSet, Sequence, Set, Tuple, abstract,
access, and, any, assert, blackbox, break, case, class, collect,
collectNested, collectOne, collectselect, collectselectOne,
composes, compute, configuration, constructor, continue, datatype,
default, derived, disjuncts, do, elif, else, end, endif,
enum, except, exists, extends, exception, false, forAll, forEach ,
forOne, from, helper, if, implies, import , in, inherits, init,
inout, intermediate, invresolve, invresolveIn, invresolveone,
invresolveoneIn , isUnique, iterate, late, let, library, literal,
log, main, map, mapping, merges, metamodel, modeltype, new, not,
null, object, one, or, ordered, out, package, population, primitive, property,
query, raise, readonly, references, refines, reject, resolve, resolveIn, resolveone,
resolveoneIn, return, select, selectOne, sortedBy, static,
switch, tag, then, transformation, true, try, typedef, unlimited,
uses, var, when, where, while, with, xcollect , xmap, xor, xselect
// start rule
<topLevel> ::= <import>* <unit_element>*
<import> ::= 'from' <unit> 'import' (<identifier_list> | '*') ';'
'import' <unit> ';'
<unit> ::= <identifier> ('.' <identifier>)* |
<identifier_list> ::= <identifier> (',' <identifier>)*
// definitions in a compilation unit
<unit_element>
::= <transformation>
<library> |
<access_decl> |
<modeltype> |
<metamodel> |
<classifier> |
<property> |
<helper> |
<constructor> |
<entry> |
<mapping> |
<tag> |
<typedef> |
// Transformation and library definitions
<transformation> ::= <transformation_decl> | <transformation_def>
<transformation_decl> ::= <transformation_h> ';'
<transformation_def> ::= <transformation_h> '
{' <module_element>* '}' ';'?
<library> ::= <library_decl> | <library_def>
<library_decl> ::= <library_h> ';'
<library_def> ::= <library_h> '{' <module_element>* '}
' ';'?
// Transformation header
<transformation_h> ::= <qualifier>* 'transformation' <identifier>
<transformation_signature> <transformation_usage_refine>?
<transformation_usage_refine> ::= <module_usage> | <transformation_refine>
<transformation_signature> ::= <simple_signature>
<transformation_refine> ::= 'refines' <moduleref>
// Library header
<library_h> ::= 'library' <identifier> <library_signature>? <module_usage>?
<library_signature> ::= <simple_signature>
// import of transformation and library
<module_usage> ::= <access_usage> | <extends_usage>
<access_usage> ::= 'access' <module_kind>? <moduleref_list>
<extends_usage> ::= 'extends' <module_kind>? <moduleref_list>
<module_kind> ::= 'transformation' | 'library'
<moduleref_list> ::= <moduleref> (',' <moduleref>)*
<moduleref> ::= <scoped_identifier> <simple_signature>?
<access_decl> ::= <access_usage> ';'
// module definitions
<module_element>
::= <classifier>
<property> |
<helper> |
<constructor> |
<entry> |
<mapping> |
<tag> |
<typedef> |
<access_decl> |
// general purpose grammar rules
<qualifier> ::= 'blackbox' | 'abstract' | 'static'
<complete_signature> ::= <simple_signature> (':' param_list)?
<simple_signature> ::= '(' <param_list>? ')'
<param_list> ::= <param> (',' <param>)*
<param> ::= <param_direction>? <declarator>
<param_direction> ::= 'in' | 'inout' | 'out'
<simple_declarator> ::= <typespec>
<scoped_identifier> ':' <typespec>
<declarator> ::= <typespec> <init_part>? |
<scoped_identifier> ':' <typespec> <init_part>?
<simple_declarator_list> ::= <simple_declarator> (',' <simple_declarator>)*
<declarator_list> ::= <declarator> (',' <declarator>)*
<declarator_semi_list> ::= <declarator> (';' <declarator>)*
<init_part> ::= <init_op> <expression>
<init_op> ::= '=' |
':=' |
'::='
<typespec> ::= <type_reference> <extent_location>?
<type_reference> ::= <scoped_identifier> |
<complex_type>
<extent_location> ::= '@' <identifier>
<complex_type> ::= <complex_type_key> |
<collection_key> '(' <typespec> ')' |
'Tuple' '(' <declarator_list> ')' |
'Dict' '(' <typespec> ',' <typespec> ')'
<complex_type_key> ::= <collection_key> |
'Dict' |
'Tuple'
<collection_key> ::= 'Collection' |
'Set' |
'OrderedSet' |
'Sequence' |
'Bag' |
'List'
<scoped_identifier> ::= <identifier> ('::' <identifier>)*
<scoped_identifier_list> ::= <scoped_identifier> (',' <scoped_identifier>)*
<expression_list> ::= <expression_semi_list> ';'?
<expression_semi_list> ::= <expression> (';' <expression>)*
<expression_comma_list> ::= <expression> (',' <expression>)*
<expression_block> ::= '
{' <expression_list>? '}
'
<expression_statement> ::= <expression> ';' |
<expression_block> ';'? |
// model types compliance and metamodel declarations
<modeltype> ::= 'modeltype' <identifier> <compliance_kind>?
'uses' <packageref_list> <modeltype_where>? ';'
<modeltype_where> ::= 'where' <expression_block>
<packageref_list> ::= <packageref> (',' <packageref>)*
<packageref> ::= (<scoped_identifier> ( '(' <uri> ')' )? | <uri>)
<compliance_kind> ::= <STRING> // like: "strict" and "effective"
<uri> ::= <STRING>
// Syntax for defining explicitly metamodel contents
<metamodel> ::= <metamodel_decl> | <metamodel_def>
<metamodel_decl> ::= <metamodel_h> ';'
<metamodel_def> ::= <metamodel_h> '
{' <metamodel_element>* '}
' ';'?
<metamodel_h> ::= ('metamodel' | 'package') scoped_identifier
<metamodel_element> ::= <classifier> | <enumeration> | <tag>
<classifier> ::= <classifier_decl> | <classifier_def>
<classifier_decl> ::= <classifier_h> ';'
<classifier_def> ::= <classifier_h> '
{' <classifier_feature_list>? '}
' ';'?
<classifier_h> ::= <classifier_info> <scoped_identifier> <classifier_extension>?
<classifier_info> ::= 'datatype'
'primitive' |
'exception' |
'intermediate'? <qualifier>* 'class'
<classifier_extension> ::= 'extends' <scoped_identifier_list>
<classifier_feature_list> ::= <classifier_feature> (';' <classifier_feature>)* ';'?
<classifier_feature> ::= <classifier_property> |
<classifier_operation> |
<tag> |
<classifier_property> ::= <feature_qualifier>? <declarator> <multiplicity>?
<opposite_property>?
<feature_qualifier> ::= <stereotype_qualifier>? <feature_key>*
<feature_key> ::= 'composes' | 'references' | 'readonly' | 'derived' | 'static'
<stereotype_qualifier> ::= '<<' <identifier_list> '>>'
<multiplicity> ::= '[' multiplicity_range ']'
<multiplicity_range> ::= <INTEGER> | '' | <INTEGER> '...' <INTEGER> | <INTEGER> '...' ''
<classifier_operation> ::= <feature_qualifier>? <declarator> <complete_signature>
<enumeration> ::= <enumeration_h> ';'
<enumeration_h> '
{' <identifier_list> '}
' ';'? |
<enumeration_h> ::= 'enum' <identifier>
<opposite_property> ::= 'opposites' '~' <identifier> <multiplicity>?
<tag> ::= 'tag' <tagid> <scoped_identifier> ('=' <tagvalue>)? ';'
<tagid> ::= <STRING>
<tagvalue> :: <expression>
// typedefs
<typedef> ::= 'typedef' <identifier> '=' <typespec> (typedef_condition)? ';'
<typedef_condition> ::= '[' <expression> ']'
// Properties in transformation
<property> ::= 'intermediate'? <property_key>+ <declarator> ';'
<property_key> ::= 'derived' | 'literal' | 'configuration' | 'property'
// Syntax for helper operations
<helper> ::= <helper_decl> | <helper_simple_def> | <helper_compound_def>
<helper_header> ::= <helper_info> <scoped_identifier> <complete_signature>
<helper_info> ::= <qualifier>* <helper_kind>
<helper_kind> ::= 'helper' | 'query'
<helper_decl> ::= <helper_header> ';'
<helper_simple_def> ::= <helper_header> '=' <expression> ';'
<helper_compound_def> ::= <helper_header> <expression_block> ';'?
// Syntax for constructors
<constructor> ::= <constructor_decl> | <constructor_def>
<constructor_header> ::= <qualifier>* 'constructor' <scoped_identifier>
<simple_signature>
<constructor_decl> ::= <constructor_header> ';'
<constructor_def> ::= <constructor_header> <expression_block> ';'?
// Syntax for entries
<entry> ::= <entry_decl> | <entry_def>
<entry_header> :: 'main' <simple_signature>
<entry_decl> ::= <entry_header> ';'
<entry_def> ::= <entry_header> <expression_block> ';'?
// syntax for mapping operations
<mapping> ::= <mapping_decl> | <mapping_def>
<mapping_decl> ::= <mapping_full_header> ';'
<mapping_def> ::= <mapping_full_header> '
{' <mapping_body> '}
' ';'?
<mapping_full_header> ::= <mapping_header> <when>? <where>?
<mapping_header> ::= <qualifier>* 'mapping' <param_direction>?
<scoped_identifier> <complete_signature> <mapping_extra>*
<mapping_extra> ::= <mapping_extension> | <mapping_refinement>
<mapping_extension> ::= <mapping_extension_key> <scoped_identifier_list>
<mapping_extension_key> ::= 'inherits' | 'merges' | 'disjuncts'
<when> ::= 'when' <expression_block>
<where> ::= 'where' <expression_block>
<mapping_refinement> ::= 'refines' <scoped_identifier>
<mapping_body> ::= <init_section>? <population_section>? <end_section>?
<init_section> ::= 'init' <expression_block>
<population_section> ::= <expression_list>
'population' <expression_block>
<end_section> ::= 'end' <expression_block> |
// Expressions
<expression> ::= <assign_exp>
<assign_exp> ::= <implies_exp>
<unary_exp> <assign_op> <expression> <default_val>? |
<unary_exp> <assign_op> <expression_block> <default_val>? |
<assign_op> := ':=' | '::=' | '+=' | '-='
<default_val> ::= 'default' <assign_exp>
<implies_exp> ::= <or_exp>
<implies_exp> 'implies' <or_exp> |
<or_exp> ::= <and_exp>
<or_exp> <or_op> <and_exp> |
<or_op> ::= 'or' | 'xor'
<and_exp> ::= <cmp_exp>
<and_exp> 'and' <cmp_exp> |
<cmp_exp> ::= <additive_exp>
<cmp_exp> <cmp_op> <additive_exp> |
<cmp_op> ::= '=' | '==' | '<>' | '<' | '>' | '<=' | '>='
<additive_exp> ::= <mult_exp>
<additive_exp> <add_op> <mult_exp> |
<add_op> ::= '+' | '-'
<mult_exp> ::= <unary_exp>
<mult_exp> <mult_op> <unary_exp> |
<mult_op> ::= '*' | '/' | '%'
<unary_exp> ::= <postfix_exp>
<unary_op> ::= '-' | 'not' | '#' | '##' | '*'
<postfix_exp> ::= <primary_exp>
<postfix_exp> '(' <arg_list>? ')' |
<postfix_exp> '!'? '[' <declarator_vsep>? <expression> ']' |
<postfix_exp> <access_op>
(<scoped_identifier> |
<iterator_exp> |
<block_exp> |
<control_exp> |
<rule_call_exp> |
<resolve_exp> |
<resolve_in_exp>) |
<declarator_vsep> ::= <simple_declarator> '|'
<multi_declarator_vsep> ::= <simple_declarator_list> '|'
<resolve_exp> ::= <resolve_key> '(' <resolve_condition>? ')'
<resolve_condition> ::= <declarator> ('|' <expression>)?
<resolve_key> ::= 'late'? <resolve_kind>
<resolve_kind> ::= 'resolve' | 'resolveone' | 'invresolve' | 'invresolveone'
<resolve_in_exp> ::= <resolve_in_key> '(' <scoped_identifier>
(',' <resolve_condition>)?')'
<resolve_in_key> ::= 'late'? <resolve_in_kind>
<resolve_in_kind> ::= 'resolveIn' | 'resolveoneIn' | 'invresolveIn' | 'invresolveoneIn'
<access_op> ::= '.' | '>' | '!>'
<primary_exp> ::= <literal>
<scoped_identifier> |
<if_exp> |
<block_exp> |
<control_exp> |
<rule_call_exp> |
<quit_exp> |
<try_exp> |
<raise_exp> |
<assert_exp> |
<log_exp> |
'(' <expression> ')' |
<literal> ::= <literal_simple>
<literal_simple> ::= <INTEGER> | <FLOAT> | <STRING>
'true' |
'false' |
'unlimited' |
'null' |
<literal_complex> ::= <literal_collection>
<literal_tuple> |
<literal_dict> |
<literal_collection> ::= <collection_key> '
{' <collection_item_list>? '}
'
<literal_tuple> ::= 'Tuple' '
{' <tuple_item_list>? '}
'
<literal_dict> ::= 'Dict' '
{' <dict_item_list>? '}
'
<collection_item_list> ::= <expression_comma_list>
<tuple_item_list> ::= <declarator_list>
<dict_item_list> ::= <dict_item> (',' <dict_item>)*
<dict_item> ::= <literal_simple> '=' <expression>
<if_exp> ::= 'if' <expression> <then_part>
<elif_part>* <else_part>? 'endif'
<then_part> ::= 'then' <if_body>
<elif_part> ::= 'elif' <if_body>
<else_part> ::= 'else' <if_body>
<if_body> ::= <expression> | <expression_block>
<iterator_exp> ::= <simple_iterator_op> '(' <declarator_vsep>? <expression> ')'
<multi_iterator_op> '(' <multi_declarator_vsep>? <expression> ')' |
<iterate_exp> |
<simple_iterator_op> ::= 'reject' | 'select' | 'collect' | 'exists'
'one' |
'any' |
'isUnique' |
'collectNested' |
'sortedBy' |
'xselect' |
'xcollect' |
'selectOne' |
'collectOne' |
'collectselect' |
'collectselectOne' |
<multi_iterator_op> ::= 'forAll'
<iterate_exp> ::= 'iterate' '(' <declarator_list> ';'
<declarator> '|' <expression> ')'
<iter_declarator> ::= <declarator>
<iter_declarator_list> ::= <declarator_list>
<block_exp> ::= (<object_exp> | <do_exp> | <switch_exp>)
<object_exp> ::= 'object' ('(' <iter_declarator> ')')? <object_declarator>
<expression_block>
<object_declarator> ::= <typespec> | <identifier> ':' <typespec>?
<do_exp> ::= 'do' <expression_block>
<switch_exp> ::= 'switch' ('(' <iter_declarator> ')')? <switch_body>
<switch_body> ::= '
{' <switch_alt>+ <switch_else>? '}
'
<switch_alt> ::= 'case' '(' <expression> ')' <expression_statement>
<switch_else> ::= 'else' <expression_statement>
<control_exp> ::= (<while_exp> | <compute_exp> | <for_exp>)
<while_exp> ::= 'while' '(' (<declarator> ';')? <expression> ')'
<expression_block>
<compute_exp> ::= 'compute' '(' <declarator> ')' <expression_block>
<for_exp> ::= ('forEach' | 'forOne') '(' <iter_declarator_list>
(';' <declarator>)? ('|' <expression>)? ')' <expression_block>
<rule_call_exp> ::= ('map' | 'xmap' | 'new' )
('(' <declarator> ')')? <scoped_identifier>
<let_exp> ::= 'let' <declarator_list> 'in' <expression>
<var_init_exp> ::= 'var' <declarator_list>
'var' '(' <declarator_list> ')' |
<quit_exp> ::= 'break' | 'continue' | <return_exp>)
<return_exp> ::= 'return' <expression>?
<try_exp> ::= 'try' <expression_block> <except>+
<except> ::= 'except' '(' <scoped_identifier_list> ')' <expression_block>
<raise_exp> ::= 'raise' <scoped_identifier> ('(' <arg_list>? ')')?
<arg_list> ::= <expression_comma_list>
<assert_exp> ::= 'assert' <identifier>? '(' <expression> ')'
( 'with' <log_exp> )?
<log_exp> ::= 'log' '(' <arg_list> ')' ('when' <expression>)?