| class PARSER |
|---|
| CS_COMPONENT | LEX_CONST |
| attr convert: CONVERT; |
|---|
| **** |
| attr entered: FLIST{STR}; |
|---|
| **** | stack of grammatical procedure calls |
| attr next: TOKEN; |
|---|
| **** |
| attr scanner: SCANNER; |
|---|
| attr version_1_0:BOOL; |
|---|
| **** | true if the file has a 1.0 syntax |
| attr convert: CONVERT; |
|---|
| **** |
| attr entered: FLIST{STR}; |
|---|
| **** | stack of grammatical procedure calls |
| attr next: TOKEN; |
|---|
| **** |
| attr scanner: SCANNER; |
|---|
| attr version_1_0:BOOL; |
|---|
| **** | true if the file has a 1.0 syntax |
| abstract_argument (is_iter: BOOL): AS_ARG_DEC |
|---|
| **** | arg_dec => [mode ident {',' ident} ':'] type_spec ['!']
|
| abstract_class_def: AS_CLASS_DEF |
|---|
| **** | abstract_class_def => 'abstract' 'class' abstract_class_name ['{' param_dec {',' param_dec}'}'] ['<' type_spec_list] ['>' type_spec_list] 'is' [abstract_signature] {';' [abstract_signature]} 'end'
|
| abstract_signature: AS_ROUT_DEF |
|---|
| **** | abstract_signature => (ident | iter_name) ['(' abstract_argument {',' abstract_argument} ')'] [':' type_spec]
|
| abstract_signature_list: $AS_CLASS_ELT |
|---|
| **** | abstract_signature_list => [abstract_signature] {';' [abstract_signature]}
|
| append_bang (arg: IDENT): IDENT |
|---|
| **** | make new version with trailing bang |
| arg_dec (is_iter: BOOL): AS_ARG_DEC |
|---|
| **** | arg_dec => mode ident {',' ident} ':' type_spec
|
| assert_stmt: AS_ASSERT_STMT |
|---|
| **** | assert_stmt => 'assert' expr 'end'
|
| attr_def (mode: TOKEN): $AS_CLASS_ELT |
|---|
| **** | attr_def => 'attr' ident_list ':' type_spec
private or readonly already stripped if present. |
| bound_create_expr: AS_BOUND_CREATE_EXPR |
|---|
| **** | bound_create_expr =>
________'bind'_'(' ________('_'_[':'_type_spec]_'.'_call_expr_|_expr1) ________[':'_type_spec]_')' '#' already seen and stripped away next is one of ROUT_tok, bind_tok, ITER_tok (guaranteed) |
| break_stmt:AS_EXPR_STMT |
|---|
| call_expr (ob: $AS_EXPR, tp: AS_TYPE_SPEC, underscore_args: BOOL): AS_CALL_EXPR |
|---|
| **** | call_expr => (ident | [ident] '!') ['(' mode_expr_list ')']
|
| case_stmt: AS_CASE_STMT |
|---|
| **** | case_stmt =>
________'case'_expr ________{'when'_expr_{','_expr}_'_then'_stmt_list} ________['else'_stmt_list]_'end' |
| check (t: INT): BOOL |
|---|
| check_underscores (call:AS_CALL_EXPR, is_iter:BOOL) is |
|---|
| class_def: AS_CLASS_DEF |
|---|
| **** | class =>
________['spread'_|_'value'_|_'partial'_|_'external_(C_|_FORTAN)']_ _______________'class'_uppercase_ident ________['{'_param_dec_{','_param_dec}'}'] ________['<'_type_spec_list] ________'is'_class_elt_list_'end' |
| class_elt: $AS_CLASS_ELT |
|---|
| **** | class_elt => include_clause | const_def | shared_def | attr_def |
____rout_def_|_iter_def_|_stub_def |
| class_elt_list: $AS_CLASS_ELT |
|---|
| **** | class_elt_list => [class_elt] {';' [class_elt]}
|
| close_file |
|---|
| const_def (mode: TOKEN): $AS_CLASS_ELT |
|---|
| **** | const_def =>
________['private']_'const'_ident ________(':'_type_spec_'_:=_'_expr_|_['_:=_'_expr][','_ident_list]) private_tok already seen and stripped if present. |
| create (p: PROG, file: STR, pSather: BOOL, |
|---|
| create_expr: AS_CREATE_EXPR |
|---|
| **** | create_expr => '#' [type_spec] ['(' mode_expr_list ')']
'#' already seen and stripped away |
| enter (s: STR) |
|---|
| **** | announce beginning of syntactic structure (for nice errors)
|
| error (msg: STR) |
|---|
| **** | where errors during parsing go |
| exit |
|---|
| **** | exit from syntactic structure
|
| exp_error (msg: STR) |
|---|
| expr0: $AS_EXPR |
|---|
| **** | expr0 =>
______self_expr_|_local_expr_|_void_expr_|_new_expr_| ______create_expr_|_array_expr_|_bound_create_expr_| ______except_expr_|_initial_expr_|_result_expr_|_while!_expr_| ______until!_expr_|_break!_expr_|_bool_lit_expr_|_char_lit_expr_| ______str_lit_expr_|_int_lit_expr_|_flt_lit_expr_|_'('_expr_')'_| ______'['_expr_list_']'_| ______here_expr_|_where_expr_|_near_expr_|_far_expr_|_any_expr ______cluster_expr_|_cluster_bang_expr_|_|_cluster_size|_cohort_expr local_expr accepts also type_spec, filtered out here or in expr1 |
| expr1 (underscore_args:BOOL): $AS_EXPR |
|---|
| **** | expr1 =>
________(expr0_'.'_call_expr_|_type_spec_'::'_call_expr_|_ _______________call_expr_|_expr0_'['_expr_list_']') ________{"."_call_expr_|_'['_expr_list_']'} (expr0 accepts type_specs for local_exprs) |
| expr2: $AS_EXPR |
|---|
| **** | expr2 => exp1 ['^' exp2]
|
| expr3: $AS_EXPR |
|---|
| **** | expr3 => '-' expr3 | '~' expr3 | exp2.
in case of literals and '-' do the negation directly to prevent overflow in case of minint (e.g. -5 gets translated into 5.negate) |
| expr4: $AS_EXPR |
|---|
| **** | expr4 => expr3 {('*' | '/' | '%') expr3}
|
| expr5: $AS_EXPR |
|---|
| **** | expr5 => expr4 {('+' | '-') expr4}
|
| expr6: $AS_EXPR |
|---|
| **** | expr6 => expr5 {('=' | '/=' | '<' | '<=' | '>=' | '>') expr5}
|
| expr7: $AS_EXPR |
|---|
| **** | expr7 => expr6 {('and' | 'or') expr6}
|
| expr: $AS_EXPR |
|---|
| **** | expr => expr7 {'@' [expr 7 | any]}
|
| expr_list (underscore_args:BOOL): $AS_EXPR |
|---|
| **** | expr_list => bound_arg {',' bound_arg} bound_arg => expr | '_' [':' type_spec]
|
| fetch |
|---|
| fork_stmt: AS_FORK_STMT |
|---|
| **** | fork_stmt => 'fork' ['@' expr;] stmt_list 'end' (pSather construct)
|
| get_mode (is_iter: BOOL):AS_ARG_MODE |
|---|
| ident: IDENT |
|---|
| ident_list(t:$AS_NODE): AS_IDENT_LIST |
|---|
| **** | ident_list => ident {',' ident} in pSather with-near-mode `self' is allowed. The occurence of 'self' is marked in t
|
| ident_of (x: $AS_EXPR): IDENT |
|---|
| **** | make sure x consists of an ident only
|
| if_stmt: AS_IF_STMT |
|---|
| **** | if_stmt =>
________'if'_expr_'then'_stmt_list_{'elsif'_expr_'then'_stmt_list} ________['else'_stmt_list]_'end' if_tok already fetched |
| include_clause (mode: TOKEN): $AS_CLASS_ELT |
|---|
| **** | include_clause => 'include' type_spec [feat_mod {',' feat_mod}] feat_mod => ident '->' [['private' | 'readonly'] ident]
'private' already seen and stripped if present. |
| is_class_elt_start (t: TOKEN): BOOL |
|---|
| is_class_name (x: IDENT): BOOL |
|---|
| is_expr_start (t:TOKEN):BOOL |
|---|
| is_stmt_start (t:TOKEN):BOOL |
|---|
| is_type_or_class_start (t: TOKEN): BOOL |
|---|
| lock_stmt: AS_LOCK_STMT |
|---|
| **** | lock_stmt => 'lock'
______________{_['if'_expr]_'when'_expr_{','_expr}_'then'_stmt_list_} ______________[_'else'_stmt_list]_'end' (pSather construct) |
| loop_stmt: AS_LOOP_STMT |
|---|
| **** | loop_stmt => 'loop' stmt_list 'end'
|
| make_if_stmt (test: $AS_EXPR, then_part, else_part: $AS_STMT): AS_IF_STMT |
|---|
| match (t: INT) |
|---|
| mode_expr_list (underscore_args:BOOL, is_iter:BOOL): TUP{$AS_EXPR, AS_ARG_MODE} is |
|---|
| **** | mode_expr_list => bound_arg {',' bound_arg} bound_arg => mode (expr | '_') [':' type_spec]
|
| par_stmt: AS_PAR_STMT |
|---|
| **** | par_stmt => 'par' stmt_list 'end' (pSather construct)
|
| param_dec: AS_PARAM_DEC |
|---|
| **** | param_dec => uppercase_ident ['<' type_spec]
|
| parloop_stmt: AS_PAR_STMT |
|---|
| **** | parloop_stmt => 'parloop' stmt_list 'do' stmt_list 'end' (pSather construct) |
| protect_stmt: AS_PROTECT_STMT |
|---|
| **** | protect_stmt =>
________'protect'_stmt_list ________{'when'_type_spec_list_'then'_stmt_list} ________['else'_stmt_list]_'end' |
| raise_stmt: AS_RAISE_STMT |
|---|
| **** | raise_stmr => 'raise' expr
|
| return_stmt: AS_RETURN_STMT |
|---|
| **** | return_stmt => 'return' [expr]
|
| rout_def (mode: TOKEN): AS_ROUT_DEF |
|---|
| **** | rout_def =>
________(ident_|_iter_name)_['('_arg_dec_{','_arg_dec}_')']_ ________[':'_type_spec] ________['pre'_expr]_['post'_expr] ________['is'_(stmt_list_|_builtin_ident_[;])_'end'] private already stripped if present. |
| rout_or_iter_name: IDENT |
|---|
| **** | rout_or_iter_name => ident | [ident] '!'
|
| set_arg_modes(c: AS_CALL_EXPR, m: INT): AS_ARG_MODE |
|---|
| shared_def (mode: TOKEN): $AS_CLASS_ELT |
|---|
| **** | shared_def =>
________'shared'_(ident_':'_type_spec_':='_expr_|_ ________ident_list_':'_type_spec) private or readonly already stripped if present. |
| source_file: AS_CLASS_DEF |
|---|
| **** | source_file => [abstract_class_def | class] {';' [abstract_class_def | class]}
|
| source_loc: SFILE_ID |
|---|
| stmt: $AS_STMT |
|---|
| **** | stmt => dec_stmt | assign_stmt | expr_stmt | if_stmt | loop_stmt | return_stmt | yield_stmt | quit_stmt | case_stmt | typecase_stmt | assert_stmt | protect_stmt | raise_stmt while!_expr | until!_expr | break!_expr | lock_stmt | unlock_stmt | with_near_stmt | par_stmt | parloop_stmt | fork_stmt | sync_stmt
(while!_expr's and until!_expr's are transformed into aquivalent if statements and break!'s) |
| stmt_list: AS_STMT_LIST |
|---|
| **** | stmt_list => [stmt] {';' [stmt]}
|
| stub_def (mode: TOKEN): $AS_CLASS_ELT |
|---|
| **** | stub_def => abstract_signature
|
| sync_stmt: AS_SYNC_STMT |
|---|
| **** | sync_stmt => 'sync' (pSather construct)
|
| type_of (x: $AS_EXPR): AS_TYPE_SPEC |
|---|
| **** | make sure x could be a type_spec
|
| type_spec: AS_TYPE_SPEC |
|---|
| **** | type_spec =>
________class_name_['{'_type_spec_list_'}']_| ________('ROUT'_|_'ITER')_['{'_mode_type_spec_['!']_ ________________{','_mode_type_spec_}_'}']_[':'_type_spec]_| ________'SAME' |
| type_spec_list: AS_TYPE_SPEC |
|---|
| **** | type_spec_list => type_spec {',' type_spec}
|
| typecase_stmt: AS_TYPECASE_STMT |
|---|
| **** | typecase_stmt =>
________'typecase'_ident ________{'when'_type_spec_'then'_stmt_list} ________['else'_stmt_list]_'end' |
| unlock_stmt: AS_UNLOCK_STMT |
|---|
| **** | unlock_stmt => 'unlock' expr (pSather construct)
|
| warning (msg: STR) |
|---|
| **** | where errors during parsing go |
| with_near_stmt: AS_WITH_NEAR_STMT |
|---|
| **** | with_near_stmt =>
___'with'__ident_list_'near'_stmt_list ___['else'_stmt_list]_'end' (pSather construct) |
| yield_stmt: AS_YIELD_STMT |
|---|
| **** | return_stmt => 'yield' [expr]
|