From 687fd007417985586fbb0b221c003593fcb6ca55 Mon Sep 17 00:00:00 2001 From: Philipp van Kempen Date: Thu, 20 Feb 2025 13:45:41 +0100 Subject: [PATCH 1/8] rename M2Model.models to M2Model.cores --- m2isar/backends/coverage/coverage_dbg.py | 4 ++-- m2isar/backends/coverage/coverage_lcov.py | 8 ++++---- m2isar/backends/disass/disass.py | 4 ++-- m2isar/backends/etiss/writer.py | 10 +++++----- m2isar/backends/viewer/viewer.py | 6 +++--- m2isar/metamodel/__init__.py | 3 ++- 6 files changed, 18 insertions(+), 17 deletions(-) diff --git a/m2isar/backends/coverage/coverage_dbg.py b/m2isar/backends/coverage/coverage_dbg.py index f6755cf1..0e1798ec 100644 --- a/m2isar/backends/coverage/coverage_dbg.py +++ b/m2isar/backends/coverage/coverage_dbg.py @@ -60,7 +60,7 @@ def main(): if model_obj.model_version != M2_METAMODEL_VERSION: logger.warning("Loaded model version mismatch") - for core_name, core_obj in model_obj.models.items(): + for core_name, core_obj in model_obj.cores.items(): process_functions(core_obj) process_instructions(core_obj) process_attributes(core_obj) @@ -70,7 +70,7 @@ def main(): ctx = IdMatcherContext() - for core_name, core_obj in model_obj.models.items(): + for core_name, core_obj in model_obj.cores.items(): ctx.arch_name = core_name for fn_name, fn_obj in core_obj.functions.items(): diff --git a/m2isar/backends/coverage/coverage_lcov.py b/m2isar/backends/coverage/coverage_lcov.py index aba52c19..a13d3b4a 100644 --- a/m2isar/backends/coverage/coverage_lcov.py +++ b/m2isar/backends/coverage/coverage_lcov.py @@ -125,12 +125,12 @@ def main(): logger.warning("Loaded model version mismatch") if args.target_arch is not None: - models_to_use = {arch_name: model_obj.models[arch_name] for arch_name in args.target_arch} - model_obj.models = models_to_use + cores_to_use = {arch_name: model_obj.cores[arch_name] for arch_name in args.target_arch} + model_obj.cores = cores_to_use logger.info("preprocessing models") - for core_name, core_obj in model_obj.models.items(): + for core_name, core_obj in model_obj.cores.items(): process_functions(core_obj) process_instructions(core_obj) process_attributes(core_obj) @@ -141,7 +141,7 @@ def main(): ctx = IdMatcherContext() - for core_name, core_obj in model_obj.models.items(): + for core_name, core_obj in model_obj.cores.items(): ctx.arch_name = core_name for fn_name, fn_obj in core_obj.functions.items(): diff --git a/m2isar/backends/disass/disass.py b/m2isar/backends/disass/disass.py index 1193c296..8c71168c 100644 --- a/m2isar/backends/disass/disass.py +++ b/m2isar/backends/disass/disass.py @@ -98,9 +98,9 @@ def main(): if model_obj.model_version != M2_METAMODEL_VERSION: logger.warning("Loaded model version mismatch") - models = model_obj.models + cores = model_obj.cores - core = models[args.core_name] + core = cores[args.core_name] readlen = max(core.instr_classes) // 8 steplen = min(core.instr_classes) // 8 diff --git a/m2isar/backends/etiss/writer.py b/m2isar/backends/etiss/writer.py index c24cd0c6..bd1b41ff 100755 --- a/m2isar/backends/etiss/writer.py +++ b/m2isar/backends/etiss/writer.py @@ -121,18 +121,18 @@ def setup(): start_time = time.strftime("%a, %d %b %Y %H:%M:%S %z", time.localtime()) - assert len(model_obj.models) > 0, "No cores found in metamodel" + assert len(model_obj.cores) > 0, "No cores found in metamodel" - return (model_obj.models, logger, output_base_path, spec_name, start_time, args) + return (model_obj.cores, logger, output_base_path, spec_name, start_time, args) def main(): """etiss_writer main entrypoint function.""" # setup etiss writer - models, logger, output_base_path, spec_name, start_time, args = setup() + cores, logger, output_base_path, spec_name, start_time, args = setup() # preprocess all models - for core_name, core in models.items(): + for core_name, core in cores.items(): logger.info("preprocessing model %s", core_name) process_functions(core) process_instructions(core) @@ -151,7 +151,7 @@ def main(): core.functions = renamed_fns # generate each core in the model - for core_name, core in models.items(): + for core_name, core in cores.items(): logger.info("processing model %s", core_name) # create output files path diff --git a/m2isar/backends/viewer/viewer.py b/m2isar/backends/viewer/viewer.py index c5150caa..4178d3c8 100644 --- a/m2isar/backends/viewer/viewer.py +++ b/m2isar/backends/viewer/viewer.py @@ -73,10 +73,10 @@ def main(): if model_obj.model_version != M2_METAMODEL_VERSION: logger.warning("Loaded model version mismatch") - models = model_obj.models + cores = model_obj.cores # preprocess model - for core_name, core in models.items(): + for core_name, core in cores.items(): logger.info("preprocessing model %s", core_name) process_functions(core) process_instructions(core) @@ -101,7 +101,7 @@ def main(): tree.heading(1, text="Value") # add each core to the treeview - for core_name, core_def in sorted(models.items()): + for core_name, core_def in sorted(cores.items()): core_id = tree.insert("", tk.END, text=core_name) # add constants to tree diff --git a/m2isar/metamodel/__init__.py b/m2isar/metamodel/__init__.py index 04eec5cc..e6268df2 100644 --- a/m2isar/metamodel/__init__.py +++ b/m2isar/metamodel/__init__.py @@ -78,7 +78,8 @@ def patch_model(module): @dataclass class M2Model: model_version: int - models: "dict[str, arch.CoreDef]" + cores: "dict[str, arch.CoreDef]" + sets: "dict[str, arch.InstructionSet]" code_infos: "dict[int, code_info.CodeInfoBase]" def __post_init__(self): From 0be5ba57f11cd4f9133d63c5b207e9a07d0bbc42 Mon Sep 17 00:00:00 2001 From: Philipp van Kempen Date: Sat, 8 Mar 2025 11:23:24 +0100 Subject: [PATCH 2/8] WIP: add coredsl2_set parser --- m2isar/frontends/coredsl2_set/.gitignore | 10 + m2isar/frontends/coredsl2_set/CoreDSL2.g4 | 319 + m2isar/frontends/coredsl2_set/README.md | 81 + m2isar/frontends/coredsl2_set/__init__.py | 7 + m2isar/frontends/coredsl2_set/antlr.sh | 11 + .../architecture_model_builder.py | 548 ++ .../coredsl2_set/behavior_model_builder.py | 449 ++ .../coredsl2_set/expr_interpreter.py | 44 + m2isar/frontends/coredsl2_set/importer.py | 143 + m2isar/frontends/coredsl2_set/load_order.py | 91 + m2isar/frontends/coredsl2_set/parser.py | 323 + .../coredsl2_set/parser_gen/.gitignore | 12 + .../coredsl2_set/parser_gen/CoreDSL2Lexer.py | 510 ++ .../parser_gen/CoreDSL2Listener.py | 786 ++ .../coredsl2_set/parser_gen/CoreDSL2Parser.py | 6378 +++++++++++++++++ .../parser_gen/CoreDSL2Visitor.py | 443 ++ .../coredsl2_set/parser_gen/__init__.py | 16 + m2isar/frontends/coredsl2_set/utils.py | 41 + 18 files changed, 10212 insertions(+) create mode 100644 m2isar/frontends/coredsl2_set/.gitignore create mode 100644 m2isar/frontends/coredsl2_set/CoreDSL2.g4 create mode 100644 m2isar/frontends/coredsl2_set/README.md create mode 100644 m2isar/frontends/coredsl2_set/__init__.py create mode 100755 m2isar/frontends/coredsl2_set/antlr.sh create mode 100644 m2isar/frontends/coredsl2_set/architecture_model_builder.py create mode 100644 m2isar/frontends/coredsl2_set/behavior_model_builder.py create mode 100644 m2isar/frontends/coredsl2_set/expr_interpreter.py create mode 100644 m2isar/frontends/coredsl2_set/importer.py create mode 100644 m2isar/frontends/coredsl2_set/load_order.py create mode 100644 m2isar/frontends/coredsl2_set/parser.py create mode 100644 m2isar/frontends/coredsl2_set/parser_gen/.gitignore create mode 100644 m2isar/frontends/coredsl2_set/parser_gen/CoreDSL2Lexer.py create mode 100644 m2isar/frontends/coredsl2_set/parser_gen/CoreDSL2Listener.py create mode 100644 m2isar/frontends/coredsl2_set/parser_gen/CoreDSL2Parser.py create mode 100644 m2isar/frontends/coredsl2_set/parser_gen/CoreDSL2Visitor.py create mode 100644 m2isar/frontends/coredsl2_set/parser_gen/__init__.py create mode 100644 m2isar/frontends/coredsl2_set/utils.py diff --git a/m2isar/frontends/coredsl2_set/.gitignore b/m2isar/frontends/coredsl2_set/.gitignore new file mode 100644 index 00000000..92ea2d50 --- /dev/null +++ b/m2isar/frontends/coredsl2_set/.gitignore @@ -0,0 +1,10 @@ +# SPDX-License-Identifier: Apache-2.0 +# +# This file is part of the M2-ISA-R project: https://github.com/tum-ei-eda/M2-ISA-R +# +# Copyright (C) 2022 +# Chair of Electrical Design Automation +# Technical University of Munich + +.antlr +*.jar diff --git a/m2isar/frontends/coredsl2_set/CoreDSL2.g4 b/m2isar/frontends/coredsl2_set/CoreDSL2.g4 new file mode 100644 index 00000000..4bf2b521 --- /dev/null +++ b/m2isar/frontends/coredsl2_set/CoreDSL2.g4 @@ -0,0 +1,319 @@ +// SPDX-License-Identifier: Apache-2.0 + +/* + * This file is part of the M2-ISA-R project: https://github.com/tum-ei-eda/M2-ISA-R + * + * Copyright (C) 2022 + * Chair of Electrical Design Automation + * Technical University of Munich + */ + +grammar CoreDSL2; + +description_content + : imports+=import_file* definitions+=isa+ + ; + +import_file + : 'import' uri=STRING + ; + +isa + : 'InstructionSet' name=IDENTIFIER ('extends' extension+=IDENTIFIER (',' extension+=IDENTIFIER)*)? '{' sections+=section+ '}' # instruction_set + | 'Core' name=IDENTIFIER ('provides' contributing_types+=IDENTIFIER (',' contributing_types+=IDENTIFIER)*)? '{' sections+=section* '}' # core_def + ; + +section + : type_='architectural_state' '{' (declarations+=declaration | expressions+=expression ';')+ '}' # section_arch_state + | type_='functions' '{' functions+=function_definition* '}' # section_functions + | type_='instructions' attributes+=attribute* '{' instructions+=instruction* '}' # section_instructions + | type_='always' attributes+=attribute* '{' always_blocks+=always_block+ '}' # section_always + ; + +always_block + : name=IDENTIFIER attributes+=attribute* behavior=block; + +instruction + : name=IDENTIFIER attributes+=attribute* '{' + 'encoding' ':' encoding+=encoding_entry ('::' encoding+=encoding_entry)*';' + ('assembly' ':' (assembly=STRING | '{' mnemonic=STRING ',' assembly=STRING '}') ';')? + 'behavior' ':' behavior=statement + '}' + ; + +rule_encoding + : fields+=encoding_entry ('::' fields+=encoding_entry)* + ; + +encoding_entry + : value=integer_constant # bit_value + | name=IDENTIFIER '[' left=integer_constant ':' right=integer_constant ']' # bit_field + ; + +function_definition + : extern='extern' type_=type_specifier name=IDENTIFIER '(' params=parameter_list? ')' attributes+=attribute* ';' + | type_=type_specifier name=IDENTIFIER '(' params=parameter_list? ')' attributes+=attribute* (behavior=block | ';') + ; + +parameter_list + : params+=parameter_declaration (',' params+=parameter_declaration)* + ; + +parameter_declaration + : type_=type_specifier decl=declarator? + ; + +statement + : block # block_statement + | ref=IDENTIFIER '(' (args+=expression (',' args+=expression)*)? ')' ';' # procedure_call + | type_='if' '(' cond+=expression ')' stmt+=statement ('else' 'if' '(' cond+=expression ')' stmt+=statement)* ('else' stmt+=statement)? # if_statement + | type_='for' '(' cond=for_condition ')' stmt=statement # for_statement + | type_='while' '(' cond=expression ')' stmt=statement # while_statement + | type_='do' stmt=statement 'while' '(' cond=expression ')' ';' # do_statement + | type_='switch' '(' cond=expression ')' '{' items+=switch_block_statement_group* switch_label* '}' # switch_statement + | type_='return' expr=expression? ';' # return_statement + | type_='break' ';' # break_statement + | type_='continue' ';' # continue_statement + | type_='spawn' stmt=statement # spawn_statement + | expr=expression ';' # expression_statement + ; + +switch_block_statement_group + : labels+=switch_label+ statements+=statement+ + ; + +switch_label + : 'case' const_expr=expression ':' + | 'default' ':' + ; + +block + : '{' items+=block_item* '}' + ; + +block_item + : statement + | declaration + ; + +for_condition + : (start_decl=declaration | start_expr=expression? ';') + end_expr=expression? ';' + (loop_exprs+=expression (',' loop_exprs+=expression)*)? + ; + +declaration + : (storage+=storage_class_specifier | qualifiers+=type_qualifier | attributes+=attribute)* + type_=type_specifier + (declarations+=declarator (',' declarations+=declarator)*)? ';' + ; + +type_specifier + : type_=value_type_specifier (ptr='*' | ptr='&')? + ; + +value_type_specifier + : signed=integer_signedness (shorthand=integer_shorthand | '<' size=primary '>') # integer_type + | shorthand=integer_shorthand # integer_type + | shorthand=float_shorthand # float_type + | type_='bool' # bool_type + | type_='void' # void_type + | type_=struct_or_union name=IDENTIFIER? '{' declarations+=struct_declaration* '}' # composite_declaration + | type_=struct_or_union name=IDENTIFIER # composite_reference + | type_='enum' name=IDENTIFIER? '{' enumerator_list ','? '}' # enum_declaration + | type_='enum' name=IDENTIFIER # enum_reference + ; + +integer_signedness + : 'unsigned' + | 'signed' + ; + +integer_shorthand + : 'char' + | 'short' + | 'int' + | 'long' + ; + +float_shorthand + : 'float' + | 'double' + ; + +attribute + : '[[' name=IDENTIFIER ('=' params+=expression | '(' params+=expression (',' params+=expression)* ')')? ']]' + ; + +bit_size_specifier + : '<' size+=primary (',' size+=primary ',' size+=primary ',' size+=primary)? '>' + ; + +enumerator_list + : enumerators+=enumerator (',' enumerators+=enumerator)* + ; + +enumerator + : name=IDENTIFIER + | name=IDENTIFIER '=' expression + ; + +struct_declaration + : specifier=struct_declaration_specifier declarators+=declarator(',' declarators+=declarator)* ';' + ; + +struct_declaration_specifier + : type_=type_specifier + | qualifiers+=type_qualifier + ; + +declarator + : name=IDENTIFIER + (LEFT_BR size+=expression RIGHT_BR)* + attributes+=attribute* + ('=' init=initializer)? + ; + +initializer + : expr=expression + | '{' initializerList ','? '}' + ; + +initializerList + : (designated_initializer | initializer) (',' (designated_initializer | initializer))* + ; + +designated_initializer + : designators+=designator+ '=' init=initializer + ; + +designator + : LEFT_BR idx=expression RIGHT_BR + | '.' prop=IDENTIFIER + ; + +expression + : primary # primary_expression + | bop=('.' | '->') ref=IDENTIFIER # deref_expression + | expr=expression bop='[' left=expression (':' right=expression)? ']' # slice_expression + | ref=IDENTIFIER '(' (args+=expression (',' args+=expression)*)? ')' # method_call + | left=expression op=('++' | '--') # postinc_expression + | op=('++'|'--') right=expression # preinc_expression + | prefix=('&'|'*'|'+'|'-') right=expression # prefix_expression + | prefix=('~'|'!') right=expression # prefix_expression + | '(' (type_=type_specifier | sign=integer_signedness) ')' right=expression # cast_expression + | left=expression bop=('*'|'/'|'%') right=expression # binary_expression + | left=expression bop=('+'|'-') right=expression # binary_expression + | left=expression bop=('<<' | '>>') right=expression # binary_expression + | left=expression bop=('<=' | '>=' | '>' | '<') right=expression # binary_expression + | left=expression bop=('==' | '!=') right=expression # binary_expression + | left=expression bop='&' right=expression # binary_expression + | left=expression bop='^' right=expression # binary_expression + | left=expression bop='|' right=expression # binary_expression + | left=expression bop='&&' right=expression # binary_expression + | left=expression bop='||' right=expression # binary_expression + | left=expression bop='::' right=expression # concat_expression + | cond=expression bop='?' then_expr=expression ':' else_expr=expression # conditional_expression + | left=expression bop=('=' | '+=' | '-=' | '*=' | '/=' | '&=' | '|=' | '^=' | '>>=' | '>>>=' | '<<=' | '%=') right=expression # assignment_expression + ; + +primary + : ref=IDENTIFIER # reference_expression + | const_expr=constant # constant_expression + | literal+=string_literal+ # literal_expression + | '(' expr=expression ')' # parens_expression + ; + +string_literal + : ENCSTRINGCONST + | STRING + ; + +constant + : integer_constant + | floating_constant + | character_constant + | string_constant + | bool_constant + ; + +integer_constant + : value=INTEGER + ; + +floating_constant + : value=FLOAT + ; + +bool_constant + : value=BOOLEAN + ; + +character_constant + : value=CHARCONST + ; + +string_constant + : value=STRING + ; + +double_left_bracket + : LEFT_BR LEFT_BR + ; + +double_right_bracket + : RIGHT_BR RIGHT_BR + ; + +data_types + : 'bool' + | 'char' + | 'short' + | 'int' + | 'long' + | 'signed' + | 'unsigned' + | 'float' + | 'double' + | 'void' + | 'alias' + ; + +type_qualifier + : 'const' + | 'volatile' + ; + +storage_class_specifier + : 'extern' + | 'static' + | 'register' + ; + +struct_or_union + : 'struct' + | 'union' + ; + +LEFT_BR: '['; +RIGHT_BR: ']'; + +BOOLEAN: ('true'|'false'); +FLOAT: ('0'..'9')+ '.' ('0'..'9')* (('e'|'E') ('+'|'-')? ('0'..'9')+)? ('f'|'F'|'l'|'L')?; +INTEGER: (BINARYINT|HEXADECIMALINT|OCTALINT|DECIMALINT|VLOGINT) ('u'|'U')? (('l'|'L') ('l'|'L')?)?; + +fragment BINARYINT: ('0b'|'0B') '0'..'1' ('_'? '0'..'1')*; +fragment OCTALINT: '0' '_'? '0'..'7' ('_'? '0'..'7')*; +fragment DECIMALINT: ('0'|'1'..'9' ('_'? '0'..'9')*); +fragment HEXADECIMALINT: ('0x'|'0X') ('0'..'9'|'a'..'f'|'A'..'F') ('_'? ('0'..'9'|'a'..'f'|'A'..'F'))*; +fragment VLOGINT: ('0'..'9')+ '\'' ('s')? ('b' ('0'..'1')+|'o' ('0'..'7')+|'d' ('0'..'9')+|'h' ('0'..'9'|'a'..'f'|'A'..'F')+); + +IDENTIFIER: '^'? ('a'..'z'|'A'..'Z'|'_') ('a'..'z'|'A'..'Z'|'_'|'0'..'9')*; + +CHARCONST: ('u'|'U'|'L')? '\'' ('\\' .|~('\\'|'\''))* '\''; +ENCSTRINGCONST: ('u8'|'u'|'U'|'L') '"' ('\\' .|~('\\'|'"'))* '"'; +STRING: ('"' ('\\' .|~('\\'|'"'))* '"'|'\'' ('\\' .|~('\\'|'\''))* '\''); + +ML_COMMENT: '/*' .*?'*/' -> skip; +SL_COMMENT: '//' ~('\n'|'\r')* ('\r'? '\n')? -> skip; +WS: (' '|'\t'|'\r'|'\n')+ -> skip; diff --git a/m2isar/frontends/coredsl2_set/README.md b/m2isar/frontends/coredsl2_set/README.md new file mode 100644 index 00000000..af88943a --- /dev/null +++ b/m2isar/frontends/coredsl2_set/README.md @@ -0,0 +1,81 @@ + + +# CoreDSL 2 Parser + +This parser understands the preliminary version 2 of CoreDSL. Its grammar is implemented after the [original XText grammar](https://github.com/Minres/CoreDSL/blob/master/com.minres.coredsl/src/com/minres/coredsl/CoreDsl.xtext) and the [accompanying programmer's manual](https://github.com/Minres/CoreDSL/wiki/CoreDSL-2-programmer's-manual), as the reference grammar is not complete. + +## Parser generation +The actual text parser for the CoreDSL 2 language is generated from [](CoreDSL2.g4) using the ANTLR4 parser generator. This repository provides up-to-date generation outputs for ease of use. If you want to change the main grammar, you have to regenerate the parser as follows: + +1) Install `antlr-tools` in your venv: + + ``` + pip install antlr-tools + ``` + +2) Run ANTLR4 parser generator: + + ``` + cd /path/to/M2-ISA-R/m2isar/frontends/coredsl2 + antlr4 -v 4.11.1 -o parser_gen -listener -visitor -Dlanguage=Python3 CoreDSL2.g4 + ``` + +A VSCode task for parser generation is already created for this project. To use it, install `antlr-tools` as shown in 1), then select `Terminal` -> `Run Task...` -> `Generate CoreDSL2 ANTLR parser`. + +## Limitations +This parser should be considered as in active development, so bugs will most likely occur. In addition, this parser (but also the metamodel and therefore the code generator) do not implement the following CoreDSL 2 features (at the moment): +- Pre- / Post-increment (`x++, ++x`) +- Switch case statements +- Complex datatypes (`struct`, `enum`) +- Pointers +- `spawn` statements +- String literals + +In addition to that, qualifiers other than `extern` and `register` in `architectural_state` declarations are ignored. The "flexible attribute system" of the reference parser is implemented, although unknown attributes are currently ignored. + +The parser does not honor CoreDSL 2's type promotion rules for arithmetic operations. For progress on this feature, see #10. + +In the future, these features might also be implemented if needed. For most CPU models, they should however not be absolutely necessary. + +Functionality currently considered experimental: +- Slicing expressions +- Concatenation expressions +- Loops + +## Outputs + +The parser outputs the architecture model as a pickled python object at `path/to/input/gen_model/.m2isarmodel`. + +## Usage + +The parser can be called by its full python module path `python -m m2isar.frontends.coredsl2.parser` or if installed as in the main README, simply by `coredsl2_parser`. + +``` +$ coredsl2_parser --help +usage: parser.py [-h] [--log {critical,error,warning,info,debug}] top_level + +positional arguments: + top_level The top-level CoreDSL file. + +optional arguments: + -h, --help show this help message and exit + --log {critical,error,warning,info,debug} +``` + +## Internals +CoreDSL 2 files are parsed using the ANTLR v4 grammar [CoreDSL2.g4](CoreDSL2.g4). Generation of the architecture model takes place during multiple phases: +1) Read top-level CoreDSL file +2) Recursively resolve and read all imports +3) Generate a bottom-up parsing order, to preserve the hierarchical model contained in the CoreDSL description during model generation +4) Parse architectural details and build an architectural model. Here everything except instruction and function behavior is read and generated. +5) Check if top-level architecture model is fully resolved. As CoreDSL 2 allows arbitrary expressions almost anywhere (i.e. user-defined parameters as register size), try to evaluate all expressions describing architectural details. Cancel parsing if evaluation fails. +6) Parse instruction / function behavior, build the behavioral models for each instruction and function. This and the previous parsing steps are seperated to make state tracking between different passes easy. +7) Dump the resulting model to disk, as a binary Python pickle dump. diff --git a/m2isar/frontends/coredsl2_set/__init__.py b/m2isar/frontends/coredsl2_set/__init__.py new file mode 100644 index 00000000..73b72e51 --- /dev/null +++ b/m2isar/frontends/coredsl2_set/__init__.py @@ -0,0 +1,7 @@ +# SPDX-License-Identifier: Apache-2.0 +# +# This file is part of the M2-ISA-R project: https://github.com/tum-ei-eda/M2-ISA-R +# +# Copyright (C) 2022 +# Chair of Electrical Design Automation +# Technical University of Munich diff --git a/m2isar/frontends/coredsl2_set/antlr.sh b/m2isar/frontends/coredsl2_set/antlr.sh new file mode 100755 index 00000000..17d8e6b0 --- /dev/null +++ b/m2isar/frontends/coredsl2_set/antlr.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +# SPDX-License-Identifier: Apache-2.0 +# +# This file is part of the M2-ISA-R project: https://github.com/tum-ei-eda/M2-ISA-R +# +# Copyright (C) 2022 +# Chair of Electrical Design Automation +# Technical University of Munich + +java -jar antlr-4.13.1-complete.jar -o parser_gen -listener -visitor -Dlanguage=Python3 CoreDSL2.g4 diff --git a/m2isar/frontends/coredsl2_set/architecture_model_builder.py b/m2isar/frontends/coredsl2_set/architecture_model_builder.py new file mode 100644 index 00000000..e651300a --- /dev/null +++ b/m2isar/frontends/coredsl2_set/architecture_model_builder.py @@ -0,0 +1,548 @@ +# SPDX-License-Identifier: Apache-2.0 +# +# This file is part of the M2-ISA-R project: https://github.com/tum-ei-eda/M2-ISA-R +# +# Copyright (C) 2022 +# Chair of Electrical Design Automation +# Technical University of Munich + +import itertools +import logging +from typing import Union + +from m2isar import M2DuplicateError, M2NameError, M2TypeError, M2ValueError, flatten +from m2isar.metamodel import arch, behav, intrinsics +from .parser_gen import CoreDSL2Parser, CoreDSL2Visitor +from .utils import RADIX, SHORTHANDS, SIGNEDNESS + +logger = logging.getLogger("arch_builder") + + +class ArchitectureModelBuilder(CoreDSL2Visitor): + """ANTLR visitor to build an M2-ISA-R architecture model of a CoreDSL 2 specification.""" + + _constants: "dict[str, arch.Constant]" + _instructions: "dict[str, arch.Instruction]" + _functions: "dict[str, arch.Function]" + _always_blocks: "dict[str, arch.AlwaysBlock]" + _instruction_sets: "dict[str, arch.InstructionSet]" + _read_types: "dict[str, str]" + _memories: "dict[str, arch.Memory]" + _memory_aliases: "dict[str, arch.Memory]" + _overwritten_instrs: "list[tuple[arch.Instruction, arch.Instruction]]" + _instr_classes: "set[int]" + _main_reg_file: Union[arch.Memory, None] + + def __init__(self): + super().__init__() + self._constants = {} + self._instructions = {} + self._functions = {} + self._always_blocks = {} + self._instruction_sets = {} + self._read_types = {} + self._memories = {} + self._memory_aliases = {} + + self._overwritten_instrs = [] + self._instr_classes = set() + self._main_reg_file = None + + def visitBit_field(self, ctx: CoreDSL2Parser.Bit_fieldContext): + """Generate a bit field (instruction parameter in encoding).""" + + # generate lower and upper bounds + left = self.visit(ctx.left) + right = self.visit(ctx.right) + + # instantiate M2-ISA-R objects + range = arch.RangeSpec(left.value, right.value) + return arch.BitField(ctx.name.text, range, arch.DataType.U) + + def visitBit_value(self, ctx: CoreDSL2Parser.Bit_valueContext): + """Generate a fixed encoding part.""" + + val = self.visit(ctx.value) + return arch.BitVal(val.bit_size, val.value) + + def visitInstruction_set(self, ctx: CoreDSL2Parser.Instruction_setContext): + """Generate a top-level instruction set object.""" + # print("visitInstruction_set", ctx.name.text) + # print("len(self._constants) 1", len(self._constants)) + # input("22") + + # keep track of seen instruction set names + self._read_types[ctx.name.text] = None + + name = ctx.name.text + extension = [] + if ctx.extension: + extension = [obj.text for obj in ctx.extension] + + # generate flat list of instruction set contents + contents = flatten([self.visit(obj) for obj in ctx.sections]) + # print("len(self._constants) 2", len(self._constants)) + # input("33") + + constants = {} + constants.update(self._constants) + memories = {} + memories.update(self._memories) + functions = {} + functions.update(self._functions) + instructions = {} + # instructions.update(self._instructions) + + # group contents by type + for item in contents: + if isinstance(item, arch.Constant): + constants[item.name] = item + elif isinstance(item, arch.Memory): + memories[item.name] = item + elif isinstance(item, arch.Function): + functions[item.name] = item + item.ext_name = name + elif isinstance(item, arch.Instruction): + instructions[(item.code, item.mask)] = item + item.ext_name = name + elif isinstance(item, arch.AlwaysBlock): + pass + else: + raise M2ValueError("unexpected item encountered") + + # instantiate M2-ISA-R object + i = arch.InstructionSet(name, extension, constants, memories, functions, instructions) + + if name in self._instruction_sets: + raise M2DuplicateError(f'instruction set "{name}" already defined') + + # keep track of instruction set object + self._instruction_sets[name] = i + return i + + def visitSection_instructions(self, ctx: CoreDSL2Parser.Section_instructionsContext): + attributes = dict([self.visit(obj) for obj in ctx.attributes]) + instructions: "list[arch.Instruction]" = [self.visit(obj) for obj in ctx.instructions] + + for attr, val in attributes.items(): + for instr in instructions: + if attr not in instr.attributes: + instr.attributes[attr] = val + + return instructions + + def visitCore_def(self, ctx: CoreDSL2Parser.Core_defContext): + """Generate a top-level CoreDef object.""" + + self.visitChildren(ctx) + + name = ctx.name.text + + c = arch.CoreDef( + name, + list(self._read_types.keys()), + None, + self._constants, + self._memories, + self._memory_aliases, + self._functions, + self._instructions, + self._instr_classes, + intrinsics, + ) + + return c + + def visitSection_arch_state(self, ctx: CoreDSL2Parser.Section_arch_stateContext): + """Generate "archictectural_state" section of CoreDSL file.""" + + decls = [self.visit(obj) for obj in ctx.declarations] + decls = list(itertools.chain.from_iterable(decls)) + for obj in ctx.expressions: + self.visit(obj) + + return decls + + def visitAlways_block(self, ctx: CoreDSL2Parser.Always_blockContext): + """Generate always block""" + + name = ctx.name.text + attributes = dict([self.visit(obj) for obj in ctx.attributes]) + + a = arch.AlwaysBlock(name, attributes, ctx.behavior) + + self._always_blocks[name] = a + + return a + + def visitInstruction(self, ctx: CoreDSL2Parser.InstructionContext): + """Generate non-behavioral parts of an instruction.""" + + # read encoding, attributes and disassembly + encoding = [self.visit(obj) for obj in ctx.encoding] + attributes = dict([self.visit(obj) for obj in ctx.attributes]) + assembly = ctx.assembly.text.replace('"', "") if ctx.assembly is not None else None + mnemonic = ctx.mnemonic.text.replace('"', "") if ctx.mnemonic is not None else None + + i = arch.Instruction(ctx.name.text, attributes, encoding, mnemonic, assembly, ctx.behavior, None) + self._instr_classes.add(i.size) + + instr_id = (i.code, i.mask) + + # check for duplicate instructions + if instr_id in self._instructions: + self._overwritten_instrs.append((self._instructions[instr_id], i)) + + # keep track of instruction + self._instructions[instr_id] = i + + return i + + def visitFunction_definition(self, ctx: CoreDSL2Parser.Function_definitionContext): + """Generate non-behavioral parts of a function.""" + + # decode attributes + attributes = dict([self.visit(obj) for obj in ctx.attributes]) + + if arch.FunctionAttribute.ETISS_TRAP_ENTRY_FN in attributes: + attributes[arch.FunctionAttribute.ETISS_NEEDS_ARCH] = [] + + # decode return type and name + type_ = self.visit(ctx.type_) + name = ctx.name.text + + # decode function arguments + params = [] + if ctx.params: + params = self.visit(ctx.params) + + if not isinstance(params, list): + params = [params] + + return_size = None + data_type = arch.DataType.NONE + + if isinstance(type_, arch.IntegerType): + return_size = type_._width + data_type = arch.DataType.S if type_.signed else arch.DataType.U + + f = arch.Function(name, attributes, return_size, data_type, params, ctx.behavior, ctx.extern is not None) + + # error on duplicate function definition + # TODO: implement overwriting function prototypes? + f2 = self._functions.get(name, None) + + if f2 is not None: + if len(f2.operation.statements) > 0: + raise M2DuplicateError(f'function "{name}" already defined') + + self._functions.pop(name) + + self._functions[name] = f + return f + + def visitParameter_declaration(self, ctx: CoreDSL2Parser.Parameter_declarationContext): + """Generate function argument declaration.""" + + # type is required, name and array size optional + type_ = self.visit(ctx.type_) + name = None + # size = None + if ctx.decl: + if ctx.decl.name: + name = ctx.decl.name.text + if ctx.decl.size: + ctx.decl.size = [self.visit(obj) for obj in ctx.decl.size] + + p = arch.FnParam(name, type_._width, arch.DataType.S if type_.signed else arch.DataType.U) + return p + + def visitInteger_constant(self, ctx: CoreDSL2Parser.Integer_constantContext): + """Generate an integer literal.""" + + # extract raw text + text: str = ctx.value.text.lower() + + # extract tick position for verilog-stlye literal + tick_pos = text.find("'") + + # decode verilog-style literal + if tick_pos != -1: + width = int(text[:tick_pos]) + radix = text[tick_pos + 1] + value = int(text[tick_pos + 2 :], RADIX[radix]) + + # decode normal dec, hex, bin, oct literal + # TODO: remove width inference from text + else: + value = int(text, 0) + if text.startswith("0b"): + width = len(text) - 2 + elif text.startswith("0x"): + width = (len(text) - 2) * 4 + elif text.startswith("0") and len(text) > 1: + width = (len(text) - 1) * 3 + else: + width = value.bit_length() + + return behav.IntLiteral(value, width) + + def visitDeclaration(self, ctx: CoreDSL2Parser.DeclarationContext): + """Generate a declaration.""" + + # extract storage type, qualifiers and attributes + storage = [self.visit(obj) for obj in ctx.storage] + # qualifiers = [self.visit(obj) for obj in ctx.qualifiers] + attributes = dict([self.visit(obj) for obj in ctx.attributes]) + + # extract data type + type_ = self.visit(ctx.type_) + + # extract list of contained declarations for the given type + decls: "list[CoreDSL2Parser.DeclaratorContext]" = ctx.declarations + + ret_decls = [] + + # generate each declaration + for decl in decls: + name = decl.name.text + + # generate a register alias + if type_.ptr == "&": + # error out on duplicate declaration + if name in self._memory_aliases: + raise M2DuplicateError(f"memory {name} already defined") + + # assume default size + size = [1] + # alias needs to have a reference as initializer + init: behav.IndexedReference = self.visit(decl.init) + attributes = {} + + # extract array size + if decl.size: + size = [self.visit(obj).value for obj in decl.size] + + # extract referenced object and indices + left = init.index + right = init.right if init.right is not None else left + reference = init.reference + + if decl.attributes: + attributes = dict([self.visit(obj) for obj in decl.attributes]) + + range = arch.RangeSpec(left, right) + + # if range.length != size[0]: + # raise ValueError(f"range mismatch for \"{name}\"") + + # instantiate M2-ISA-R object, keep track of parent - child relations + m = arch.Memory(name, range, type_._width, attributes) + m.parent = reference + m.parent.children.append(m) + + # keep track of this declaration globally + self._memory_aliases[name] = m + # keep track of this declaration for this declaration statement + ret_decls.append(m) + + # normal declaration + else: + # no storage specifier -> implementation parameter, "Constant" in M2-ISA-R + if len(storage) == 0: + if name in self._constants: + raise M2DuplicateError(f"constant {name} already defined") + + # extract initializer if present + init = None + if decl.init is not None: + init = self.visit(decl.init) + + c = arch.Constant(name, init, [], type_._width, type_.signed) + + self._constants[name] = c + ret_decls.append(c) + + # register and extern declaration: "Memory" object in M2-ISA-R + elif "register" in storage or "extern" in storage: + if name in self._memories: + raise M2DuplicateError(f"memory {name} already defined") + + size = [1] + init = None + attributes = {} + + if decl.size: + size = [self.visit(obj) for obj in decl.size] + + if len(size) > 1: + raise NotImplementedError("arrays with more than one dimension are not supported") + + if decl.init is not None: + init = self.visit(decl.init) + + if decl.attributes: + attributes = dict([self.visit(obj) for obj in decl.attributes]) + + range = arch.RangeSpec(size[0]) + m = arch.Memory(name, range, type_._width, attributes) + + # attach init value to memory object + if init is not None: + m._initval[None] = init.generate(None) + + if arch.MemoryAttribute.IS_MAIN_REG in attributes: + self._main_reg_file = m + + self._memories[name] = m + ret_decls.append(m) + + return ret_decls + + def visitType_specifier(self, ctx: CoreDSL2Parser.Type_specifierContext): + type_ = self.visit(ctx.type_) + if ctx.ptr: + type_.ptr = ctx.ptr.text + return type_ + + def visitInteger_type(self, ctx: CoreDSL2Parser.Integer_typeContext): + """Generate an integer type specification.""" + + # default signedness + signed = True + # minimal integer type is just a signedness without width + width = None + + # extract sign + if ctx.signed is not None: + signed = self.visit(ctx.signed) + + # extract size + if ctx.size is not None: + width = self.visit(ctx.size) + + # extract and decode shorthand (int = signed<32>) + if ctx.shorthand is not None: + width = self.visit(ctx.shorthand) + + # type check width + if isinstance(width, behav.IntLiteral): + width = width.value + elif isinstance(width, behav.NamedReference): + width = width.reference + else: + raise M2TypeError("width has wrong type") + + return arch.IntegerType(width, signed, None) + + def visitVoid_type(self, ctx: CoreDSL2Parser.Void_typeContext): + """Generate a void type.""" + return arch.VoidType(None) + + def visitBool_type(self, ctx: CoreDSL2Parser.Bool_typeContext): + """Generate a bool (alias for unsigned<1>).""" + return arch.IntegerType(1, False, None) + + def visitBinary_expression(self, ctx: CoreDSL2Parser.Binary_expressionContext): + """Generate a binary expression.""" + + # visit LHS and RHS + left = self.visit(ctx.left) + right = self.visit(ctx.right) + op = behav.Operator(ctx.bop.text) + + # return M2-ISA-R object + return behav.BinaryOperation(left, op, right) + + def visitSlice_expression(self, ctx: CoreDSL2Parser.Slice_expressionContext): + left = self.visit(ctx.left) + right = self.visit(ctx.right) if ctx.right is not None else None + expr = self.visit(ctx.expr).reference + + op = behav.IndexedReference(expr, left, right) + return op + + def visitPrefix_expression(self, ctx: CoreDSL2Parser.Prefix_expressionContext): + prefix = behav.Operator(ctx.prefix.text) + expr = self.visit(ctx.right) + return behav.UnaryOperation(prefix, expr) + + def visitReference_expression(self, ctx: CoreDSL2Parser.Reference_expressionContext): + """Generate a referencing expression.""" + + name = ctx.ref.text + + # try to resolve the reference, error out if invalid + ref = self._constants.get(name) or self._memories.get(name) or self._memory_aliases.get(name) + if ref is None: + raise M2NameError(f'reference "{name}" could not be resolved') + return behav.NamedReference(ref) + + def visitStorage_class_specifier(self, ctx: CoreDSL2Parser.Storage_class_specifierContext): + return ctx.children[0].symbol.text + + def visitType_qualifier(self, ctx: CoreDSL2Parser.Type_qualifierContext): + return ctx.children[0].symbol.text + + def visitInteger_signedness(self, ctx: CoreDSL2Parser.Integer_signednessContext): + return SIGNEDNESS[ctx.children[0].symbol.text] + + def visitInteger_shorthand(self, ctx: CoreDSL2Parser.Integer_shorthandContext): + return behav.IntLiteral(SHORTHANDS[ctx.children[0].symbol.text]) + + def visitAssignment_expression(self, ctx: CoreDSL2Parser.Assignment_expressionContext): + """Generate an assignment.""" + + # extract LHS and RHS + left = self.visit(ctx.left) + right = self.visit(ctx.right) + + # if LHS is a reference, assign RHS as its default value + if isinstance(left, behav.NamedReference): + if isinstance(left.reference, arch.Constant): + left.reference.value = right.generate(None) + + elif isinstance(left.reference, arch.Memory): + left.reference._initval[None] = right.generate(None) + + elif isinstance(left, behav.IndexedReference): + left.reference._initval[left.index.generate(None)] = right.generate(None) + + def visitAttribute(self, ctx: CoreDSL2Parser.AttributeContext): + """Generate an attribute.""" + + name = ctx.name.text + + # read attribute from enums + attr = ( + arch.InstrAttribute._member_map_.get(name.upper()) + or arch.MemoryAttribute._member_map_.get(name.upper()) + or arch.FunctionAttribute._member_map_.get(name.upper()) + ) + + # warn if attribute is unknown to M2-ISA-R + if attr is None: + logger.warning('unknown attribute "%s" encountered', name) + attr = name + + return attr, ctx.params + + def visitChildren(self, node): + """Helper method to return flatter results on tree visits.""" + # print("visitChildren", node) + + ret = super().visitChildren(node) + if isinstance(ret, list) and len(ret) == 1: + return ret[0] + return ret + + def aggregateResult(self, aggregate, nextResult): + """Aggregate results from multiple children into a list.""" + + ret = aggregate + if nextResult is not None: + if ret is None: + ret = [nextResult] + else: + ret += [nextResult] + return ret diff --git a/m2isar/frontends/coredsl2_set/behavior_model_builder.py b/m2isar/frontends/coredsl2_set/behavior_model_builder.py new file mode 100644 index 00000000..12fb60a7 --- /dev/null +++ b/m2isar/frontends/coredsl2_set/behavior_model_builder.py @@ -0,0 +1,449 @@ +# SPDX-License-Identifier: Apache-2.0 +# +# This file is part of the M2-ISA-R project: https://github.com/tum-ei-eda/M2-ISA-R +# +# Copyright (C) 2022 +# Chair of Electrical Design Automation +# Technical University of Munich + +import logging + +from m2isar import M2NameError, M2SyntaxError, M2TypeError, flatten +from m2isar.metamodel import arch, behav, intrinsics +from m2isar.metamodel.utils import StaticType +from .parser_gen import CoreDSL2Parser, CoreDSL2Visitor +from .utils import BOOLCONST, RADIX, SHORTHANDS, SIGNEDNESS + +# import seal5.model as seal5_model + +logger = logging.getLogger("behav_builder") + + +class BehaviorModelBuilder(CoreDSL2Visitor): + """ANTLR visitor to build an M2-ISA-R behavioral model of a function or instruction + of a CoreDSL 2 specification. + """ + + def __init__( + self, + constants: "dict[str, arch.Constant]", + memories: "dict[str, arch.Memory]", + memory_aliases: "dict[str, arch.Memory]", + fields: "dict[str, arch.BitFieldDescr]", + functions: "dict[str, arch.Function]", + warned_fns: "set[str]", + ): + super().__init__() + + self._constants = constants + self._memories = memories + self._memory_aliases = memory_aliases + self._fields = fields + self._scalars = {} + self._functions = functions + self.warned_fns = warned_fns if warned_fns is not None else set() + + def visitChildren(self, node): + """Helper method to return flatter results on tree visits.""" + + ret = super().visitChildren(node) + if isinstance(ret, list) and len(ret) == 1: + return ret[0] + return ret + + def aggregateResult(self, aggregate, nextResult): + """Aggregate results from multiple children into a list.""" + + ret = aggregate + if nextResult is not None: + if ret is None: + ret = [nextResult] + else: + ret += [nextResult] + return ret + + def visitProcedure_call(self, ctx: CoreDSL2Parser.Procedure_callContext): + """Generate a procedure (method call without return value) call.""" + + # extract name and reference to procedure object to be called + name = ctx.ref.text + ref = self._functions.get(name, None) + + # error out if method is unknown + if ref is None: + raise M2NameError(f"procedure {name} is not defined") + + # generate method arguments + args = [self.visit(obj) for obj in ctx.args] if ctx.args else [] + + return behav.ProcedureCall(ref, args) + + def visitMethod_call(self, ctx: "CoreDSL2Parser.Method_callContext"): + """Generate a function (method call with return value) call.""" + + # extract name and reference to function object to be called + name = ctx.ref.text + ref = self._functions.get(name, None) + + # error out if method is unknown + if ref is None: + raise M2NameError(f'function "{name}" is not defined') + + if arch.FunctionAttribute.ETISS_TRAP_ENTRY_FN in ref.attributes: + raise M2SyntaxError(f'exception entry function "{name}" must be called as procedure') + + # generate method arguments + args = [self.visit(obj) for obj in ctx.args] if ctx.args else [] + + return behav.FunctionCall(ref, args) + + def visitBlock(self, ctx: CoreDSL2Parser.BlockContext): + """Generate a block of statements, return a list.""" + + items = [self.visit(obj) for obj in ctx.items] + items = list(flatten(items)) + return behav.Block(items) + + def visitDeclaration(self, ctx: CoreDSL2Parser.DeclarationContext): + """Generate a declaration statement. Can be multiple declarations of + the same type at once. Each declaration can have an initial value. + """ + + # extract variable qualifiers, currently unused + # storage = [self.visit(obj) for obj in ctx.storage] + # qualifiers = [self.visit(obj) for obj in ctx.qualifiers] + # attributes = [self.visit(obj) for obj in ctx.attributes] + + type_ = self.visit(ctx.type_) + + decls: "list[CoreDSL2Parser.DeclaratorContext]" = ctx.declarations + + ret_decls = [] + + # iterate over all contained declarations + for decl in decls: + name = decl.name.text + + # instantiate a scalar and its definition + s = arch.Scalar( + name, None, StaticType.NONE, type_.width, arch.DataType.S if type_.signed else arch.DataType.U + ) + self._scalars[name] = s + sd = behav.ScalarDefinition(s) + + # if initializer is present, generate an assignment to apply + # initialization to the scalar + if decl.init: + init = self.visit(decl.init) + else: + init = behav.IntLiteral(0) + + a = behav.Assignment(sd, init) + ret_decls.append(a) + + return ret_decls + + def visitBreak_statement(self, ctx: CoreDSL2Parser.Break_statementContext): + return behav.Break() + + def visitReturn_statement(self, ctx: CoreDSL2Parser.Return_statementContext): + """Generate a return statement.""" + + expr = self.visit(ctx.expr) if ctx.expr else None + return behav.Return(expr) + + def visitWhile_statement(self, ctx: CoreDSL2Parser.While_statementContext): + """Generate a while loop.""" + + stmt = self.visit(ctx.stmt) if ctx.stmt else None + cond = self.visit(ctx.cond) + + if not isinstance(stmt, list): + stmt = [stmt] + + return behav.Loop(cond, stmt, False) + + def visitDo_statement(self, ctx: CoreDSL2Parser.Do_statementContext): + """Generate a do .. while loop.""" + + stmt = self.visit(ctx.stmt) if ctx.stmt else None + cond = self.visit(ctx.cond) + + if not isinstance(stmt, list): + stmt = [stmt] + + return behav.Loop(cond, stmt, True) + + def visitFor_statement(self, ctx: CoreDSL2Parser.For_statementContext): + """Generate a for loop. Currently hacky, untested and mostly broken.""" + + start_decl, start_expr, end_expr, loop_exprs = self.visit(ctx.cond) + stmt = self.visit(ctx.stmt) if ctx.stmt else None + + if not isinstance(stmt, list): + stmt = [stmt] + + ret = [] + + if start_decl is not None: + ret.append(start_decl) + if start_expr is not None: + ret.append(start_expr) + + if loop_exprs: + stmt.extend(loop_exprs) + + ret.append(behav.Loop(end_expr, stmt, False)) + + return ret + + def visitFor_condition(self, ctx: CoreDSL2Parser.For_conditionContext): + """Generate the condition of a for loop.""" + + start_decl = self.visit(ctx.start_decl) if ctx.start_decl else None + start_expr = self.visit(ctx.start_expr) if ctx.start_expr else None + end_expr = self.visit(ctx.end_expr) if ctx.end_expr else None + loop_exprs = [self.visit(obj) for obj in ctx.loop_exprs] if ctx.loop_exprs else None + + return start_decl, start_expr, end_expr, loop_exprs + + def visitIf_statement(self, ctx: CoreDSL2Parser.If_statementContext): + """Generate an if statement. Packs all if, else if and else branches + into one object. + """ + + conds = [self.visit(x) for x in ctx.cond] + stmts = [self.visit(x) for x in ctx.stmt] + + stmts = [x if not isinstance(x, list) else None for x in stmts] + + if None in stmts: + raise Exception("meep") + + return behav.Conditional(conds, stmts) + + def visitConditional_expression(self, ctx: CoreDSL2Parser.Conditional_expressionContext): + """Generate a ternary expression.""" + + cond = self.visit(ctx.cond) + then_expr = self.visit(ctx.then_expr) + else_expr = self.visit(ctx.else_expr) + + return behav.Ternary(cond, then_expr, else_expr) + + def visitBinary_expression(self, ctx: CoreDSL2Parser.Binary_expressionContext): + """Generate a binary expression.""" + + left = self.visit(ctx.left) + op = behav.Operator(ctx.bop.text) + right = self.visit(ctx.right) + + return behav.BinaryOperation(left, op, right) + + def visitPreinc_expression(self, ctx: CoreDSL2Parser.Preinc_expressionContext): + """Generate a pre-increment expression. Not yet supported, throws + :exc:`NotImplementedError`.""" + + raise NotImplementedError("pre-increment expressions are not supported yet") + + def visitPostinc_expression(self, ctx: CoreDSL2Parser.Preinc_expressionContext): + """Generate a post-increment expression. Not yet supported, throws + :exc:`NotImplementedError`.""" + + raise NotImplementedError("post-increment expressions are not supported yet") + + def visitPrefix_expression(self, ctx: CoreDSL2Parser.Prefix_expressionContext): + """Generate an unary expression.""" + + op = behav.Operator(ctx.prefix.text) + right = self.visit(ctx.right) + + return behav.UnaryOperation(op, right) + + def visitParens_expression(self, ctx: CoreDSL2Parser.Parens_expressionContext): + """Generate a parenthesized expression.""" + + expr = self.visit(ctx.expr) + return behav.Group(expr) + + def visitSlice_expression(self, ctx: CoreDSL2Parser.Slice_expressionContext): + """Generate a slice expression. Depending on context, this is translated + to either an actual :class:`m2isar.metamodel.behav.SliceOperation`or + an :class:`m2isar.metamodel.behav.IndexedReference` if a :class:`m2isar.metamodel.arch.Memory + object is to be sliced. + """ + + expr = self.visit(ctx.expr) + + left = self.visit(ctx.left) + right = self.visit(ctx.right) if ctx.right else left + + if ( + isinstance(expr, behav.NamedReference) + and isinstance(expr.reference, arch.Memory) + and (expr.reference.data_range is None or expr.reference.data_range.length > 1) + ): + return behav.IndexedReference(expr.reference, left, right) + else: + return behav.SliceOperation(expr, left, right) + + def visitConcat_expression(self, ctx: CoreDSL2Parser.Concat_expressionContext): + """Generate a concatenation expression.""" + + left = self.visit(ctx.left) + right = self.visit(ctx.right) + + return behav.ConcatOperation(left, right) + + def visitAssignment_expression(self, ctx: CoreDSL2Parser.Assignment_expressionContext): + """Generate an assignment. If a combined arithmetic-assignment is present, + generate an additional binary operation and use it as the RHS. + """ + + op = ctx.bop.text + left = self.visit(ctx.left) + right = self.visit(ctx.right) + + if op != "=": + op2 = behav.Operator(op[:-1]) + right = behav.BinaryOperation(left, op2, right) + + return behav.Assignment(left, right) + + def visitReference_expression(self, ctx: CoreDSL2Parser.Reference_expressionContext): + """Generate a simple reference.""" + + name = ctx.ref.text + + var = ( + self._scalars.get(name) + or self._fields.get(name) + or self._constants.get(name) + or self._memory_aliases.get(name) + or self._memories.get(name) + or intrinsics.get(name) + ) + + if var is None: + raise M2NameError(f'Named reference "{name}" does not exist!') + + return behav.NamedReference(var) + + def visitInteger_constant(self, ctx: CoreDSL2Parser.Integer_constantContext): + """Generate an integer literal.""" + + text: str = ctx.value.text.lower() + + tick_pos = text.find("'") + + if tick_pos != -1: + width = int(text[:tick_pos]) + radix = text[tick_pos + 1] + value = int(text[tick_pos + 2 :], RADIX[radix]) + + else: + value = int(text, 0) + width = value.bit_length() + + return behav.IntLiteral(value, width) + + def visitCharacter_constant(self, ctx: CoreDSL2Parser.Character_constantContext): + """Generate a character literal. Converts directly to uint8.""" + + text: str = ctx.value.text + + value = min(ord(text.replace("'", "")), 255) + + return behav.IntLiteral(value, 8) + + # def visitString_literal(self, ctx:CoreDSL2Parser.String_literalContext): + + # print("visitString_literal", self, ctx, dir(self), dir(ctx)) + # text: str = ctx.value.text + # # text: str = ctx.text + + # return behav.IntLiteral(0, 8) + + def visitString_constant(self, ctx: CoreDSL2Parser.String_constantContext): + # print("visitString_constant", self, ctx, dir(self), dir(ctx)) + text: str = ctx.value.text + assert len(text) >= 2 + assert text[0] == '"' and text[-1] == '"' + text = text[1:-1] + # text: str = ctx.text + + return behav.StringLiteral(text) + # return seal5_model.StringLiteral(text) + + def visitBool_constant(self, ctx: CoreDSL2Parser.Bool_constantContext): + """Generate a boolean literal. Converts directly to uint1.""" + + text: str = ctx.value.text + + return behav.IntLiteral(BOOLCONST[text], 1) + + def visitCast_expression(self, ctx: CoreDSL2Parser.Cast_expressionContext): + """Generate a type cast.""" + + expr = self.visit(ctx.right) + if ctx.type_: + type_ = self.visit(ctx.type_) + sign = arch.DataType.S if type_.signed else arch.DataType.U + size = type_.width + + if ctx.sign: + sign = self.visit(ctx.sign) + sign = arch.DataType.S if sign else arch.DataType.U + size = None + + return behav.TypeConv(sign, size, expr) + + def visitType_specifier(self, ctx: CoreDSL2Parser.Type_specifierContext): + """Generate a generic type specifier.""" + + type_ = self.visit(ctx.type_) + if ctx.ptr: + type_.ptr = ctx.ptr.text + return type_ + + def visitInteger_type(self, ctx: CoreDSL2Parser.Integer_typeContext): + """Generate an integer type specifier.""" + + signed = True + width = None + + if ctx.signed is not None: + signed = self.visit(ctx.signed) + + if ctx.size is not None: + width = self.visit(ctx.size) + + if ctx.shorthand is not None: + width = self.visit(ctx.shorthand) + + if isinstance(width, behav.BaseNode): + width = width.generate(None) + else: + raise M2TypeError("width has wrong type") + + return arch.IntegerType(width, signed, None) + + def visitVoid_type(self, ctx: CoreDSL2Parser.Void_typeContext): + """Generate a void type specifier.""" + + return arch.VoidType(None) + + def visitBool_type(self, ctx: CoreDSL2Parser.Bool_typeContext): + """Generate a bool type specifier. Aliases to unsigned<1>.""" + + return arch.IntegerType(1, False, None) + + def visitInteger_signedness(self, ctx: CoreDSL2Parser.Integer_signednessContext): + """Generate integer signedness.""" + + return SIGNEDNESS[ctx.children[0].symbol.text] + + def visitInteger_shorthand(self, ctx: CoreDSL2Parser.Integer_shorthandContext): + """Lookup a shorthand type specifier.""" + + return behav.IntLiteral(SHORTHANDS[ctx.children[0].symbol.text]) diff --git a/m2isar/frontends/coredsl2_set/expr_interpreter.py b/m2isar/frontends/coredsl2_set/expr_interpreter.py new file mode 100644 index 00000000..bdb9b5d5 --- /dev/null +++ b/m2isar/frontends/coredsl2_set/expr_interpreter.py @@ -0,0 +1,44 @@ +# SPDX-License-Identifier: Apache-2.0 +# +# This file is part of the M2-ISA-R project: https://github.com/tum-ei-eda/M2-ISA-R +# +# Copyright (C) 2022 +# Chair of Electrical Design Automation +# Technical University of Munich + +"""Very crude expression evaluation functions for use during model generation.""" + +from m2isar.metamodel import arch, behav + + +def group(self: behav.Group, context): + return self.expr.generate(context) + + +def int_literal(self: behav.IntLiteral, context): + return self.value + + +def named_reference(self: behav.NamedReference, context): + if isinstance(self.reference, arch.Constant) and self.reference.value is not None: + return self.reference.value + return None + # raise M2ValueError("non-interpretable value encountered") + + +def indexed_reference(self: behav.IndexedReference, context): + idx = self.index.generate(context) + return self.reference._initval[idx] + + +def binary_operation(self: behav.BinaryOperation, context): + left = self.left.generate(context) + right = self.right.generate(context) + if left is None or right is None: + return None + return int(eval(f"{left}{self.op.value}{right}")) + + +def unary_operation(self: behav.UnaryOperation, context): + right = self.right.generate(context) + return int(eval(f"{self.op.value}{right}")) diff --git a/m2isar/frontends/coredsl2_set/importer.py b/m2isar/frontends/coredsl2_set/importer.py new file mode 100644 index 00000000..7bbad2e2 --- /dev/null +++ b/m2isar/frontends/coredsl2_set/importer.py @@ -0,0 +1,143 @@ +# SPDX-License-Identifier: Apache-2.0 +# +# This file is part of the M2-ISA-R project: https://github.com/tum-ei-eda/M2-ISA-R +# +# Copyright (C) 2022 +# Chair of Electrical Design Automation +# Technical University of Munich + +"""Classes to recursively import files of a CoreDSL model.""" + +import logging +import pathlib + +from .parser_gen import CoreDSL2Listener, CoreDSL2Parser, CoreDSL2Visitor +from .utils import make_parser + + +class Importer(CoreDSL2Listener): + """ANTLR listener based importer. Bad on performance, as it traverses + the entire parse tree when it only has to look for import statements. + """ + + def __init__(self, search_path) -> None: + super().__init__() + self.imported = set() + self.new_children = [] + self.new_defs = [] + self.got_new = True + self.search_path = search_path + + def enterImport_file(self, ctx: CoreDSL2Parser.Import_fileContext): + """The actual import functionality. Extracts the filename to import, + constructs a new parser and parses the next file. + """ + + filename = ctx.RULE_STRING().getText().replace('"', "") + if filename not in self.imported: + print(f"importing file {filename}") + self.got_new = True + self.imported.add(filename) + + parser = make_parser(self.search_path / filename) + + tree = parser.description_content() + + self.new_children.extend(tree.children) + self.new_defs.extend(tree.definitions) + pass + + +def recursive_import(tree, search_path): + """Helper method to recursively process all import statements of a given + parse tree. The search path should be set to the directory of the root document. + """ + + path_extender = ImportPathExtender(search_path) + path_extender.visit(tree) + + importer = VisitImporter(search_path) + + while importer.got_new: + importer.new_imports.clear() + importer.new_defs.clear() + importer.new_children.clear() + importer.got_new = False + + importer.visit(tree) + + tree.imports = importer.new_imports + tree.imports + tree.definitions = importer.new_defs + tree.definitions + tree.children = importer.new_children + [ + x for x in tree.children if not isinstance(x, CoreDSL2Parser.Import_fileContext) + ] + + +class VisitImporter(CoreDSL2Visitor): + """Importer class based on an ANTLR Visitor. Only traverses the model tree + to the import statements and stops traversion after that. + """ + + def __init__(self, search_path) -> None: + super().__init__() + self.imported = set() + self.new_children = [] + self.new_imports = [] + self.new_defs = [] + self.got_new = True + self.search_path = search_path + self.logger = logging.getLogger("visit_importer") + + def visitDescription_content(self, ctx: CoreDSL2Parser.Description_contentContext): + for i in ctx.imports: + self.visit(i) + + def visitImport_file(self, ctx: CoreDSL2Parser.Import_fileContext): + """The actual import functionality. Extracts the filename to import, + constructs a new parser and parses the next file. + """ + + import_name = ctx.uri.text.replace('"', "") + filename = str(pathlib.Path(import_name).resolve()) + + # only import each file once + if filename not in self.imported: + self.logger.info("importing file %s", filename) + + # keep track that we imported something + self.got_new = True + self.imported.add(filename) + + # extract file path and search path + file_path = pathlib.Path(filename) + file_dir = file_path.parent + + parser = make_parser(file_path) + + # run ImportPathExtender on the new tree + tree = parser.description_content() + path_extender = ImportPathExtender(file_dir) + path_extender.visit(tree) + + # keep track of the new children + self.new_children.extend(tree.children) + self.new_imports.extend(tree.imports) + self.new_defs.extend(tree.definitions) + + +class ImportPathExtender(CoreDSL2Visitor): + """ANTLR visitor to resolve relative import paths. Replaces all import URIs + with their equivalent absolute path, relative to search_path. + """ + + def __init__(self, search_path: pathlib.Path) -> None: + super().__init__() + self.search_path = search_path + + def visitDescription_content(self, ctx: CoreDSL2Parser.Description_contentContext): + for i in ctx.imports: + self.visit(i) + + def visitImport_file(self, ctx: CoreDSL2Parser.Import_fileContext): + filename = self.search_path / ctx.uri.text.replace('"', "") + ctx.uri.text = str(filename) diff --git a/m2isar/frontends/coredsl2_set/load_order.py b/m2isar/frontends/coredsl2_set/load_order.py new file mode 100644 index 00000000..fbbd2bd2 --- /dev/null +++ b/m2isar/frontends/coredsl2_set/load_order.py @@ -0,0 +1,91 @@ +# SPDX-License-Identifier: Apache-2.0 +# +# This file is part of the M2-ISA-R project: https://github.com/tum-ei-eda/M2-ISA-R +# +# Copyright (C) 2022 +# Chair of Electrical Design Automation +# Technical University of Munich + +from antlr4 import ParserRuleContext + +from m2isar import M2DuplicateError +from .parser_gen import CoreDSL2Parser, CoreDSL2Visitor + + +class CoreContainerContext(ParserRuleContext): + pass + + +class LoadOrder(CoreDSL2Visitor): + def __init__(self) -> None: + super().__init__() + self.instruction_sets: "dict[str, CoreDSL2Parser.Instruction_setContext]" = {} + # self.core_defs = {} + self.stacks = {} + + def visitInstruction_set(self, ctx: CoreDSL2Parser.Instruction_setContext): + name = ctx.name.text + # print("set", name, [e.text for e in ctx.extension]) + + if name in self.instruction_sets: + raise M2DuplicateError(f"instruction set {name} specified more than once") + + self.instruction_sets[name] = ctx + stack = [] + for e in ctx.extension: + assert e.text in self.stacks, f"Set not found: {e.text}. Missing include?" + for x in self.stacks[e.text]: + if x not in stack: + stack.append(x) + stack.append(e.text) + self.stacks[name] = stack + # print("stacks", self.stacks) + + # def extend_ins_set(self, ins_set_name): + # if ins_set_name not in self.instruction_sets: + # raise M2NameError(f"instruction set {ins_set_name} is unknown") + + # extensions = [e.text for e in self.instruction_sets[ins_set_name].extension] + # if extensions: + # ret = [ins_set_name] + # for extension in extensions: + # ret = self.extend_ins_set(extension) + ret + # return ret + # else: + # return [ins_set_name] + + # def visitCore_def(self, ctx: CoreDSL2Parser.Core_defContext): + # name = ctx.name.text + # contributing_types = [c.text for c in ctx.contributing_types] + + # ins_set_queue = [] + # known_sets = set() + + # for ct in contributing_types: + # new_sets = self.extend_ins_set(ct) + # for new_set in new_sets: + # if new_set not in known_sets: + # known_sets.add(new_set) + # ins_set_queue.append(self.instruction_sets[new_set]) + + # ins_set_queue.append(ctx) + # self.core_defs[name] = ins_set_queue + + def visit(self, tree): + # print("visit", tree) + _ = super().visit(tree) + + ret = {} + + # for core_name, contents in self.core_defs.items(): + # container = CoreContainerContext() + # container.children = contents + # container.name = core_name + # ret[core_name] = container + for set_name, set_def in self.instruction_sets.items(): + container = CoreContainerContext() + container.children = [self.instruction_sets[x] for x in self.stacks[set_name]] + [set_def] + container.name = set_name + ret[set_name] = container + + return ret diff --git a/m2isar/frontends/coredsl2_set/parser.py b/m2isar/frontends/coredsl2_set/parser.py new file mode 100644 index 00000000..dd06187c --- /dev/null +++ b/m2isar/frontends/coredsl2_set/parser.py @@ -0,0 +1,323 @@ +# SPDX-License-Identifier: Apache-2.0 +# +# This file is part of the M2-ISA-R project: https://github.com/tum-ei-eda/M2-ISA-R +# +# Copyright (C) 2022 +# Chair of Electrical Design Automation +# Technical University of Munich + +import argparse +import itertools +import logging +import pathlib +import pickle +import sys + +from m2isar import M2Error, M2SyntaxError +from m2isar.metamodel import M2_METAMODEL_VERSION, M2Model, behav, patch_model +from m2isar.metamodel.code_info import CodeInfoBase +from . import expr_interpreter +from .architecture_model_builder import ArchitectureModelBuilder +from .behavior_model_builder import BehaviorModelBuilder +from .importer import recursive_import +from .load_order import LoadOrder +from .utils import make_parser + + +def main(): + parser = argparse.ArgumentParser() + parser.add_argument("top_level", help="The CoreDSL file.") + parser.add_argument("--log", default="info", choices=["critical", "error", "warning", "info", "debug"]) + parser.add_argument("--output", "-o", type=str, default=None) + + args = parser.parse_args() + + # app_dir = pathlib.Path(__file__).parent.resolve() + + logging.basicConfig(level=getattr(logging, args.log.upper())) + logger = logging.getLogger("parser") + + top_level = pathlib.Path(args.top_level) + abs_top_level = top_level.resolve() + search_path = abs_top_level.parent + + parser = make_parser(abs_top_level) + + try: + logger.info("parsing top level") + tree = parser.description_content() + + recursive_import(tree, search_path) + except M2SyntaxError as e: + logger.critical("Error during parsing: %s", e) + sys.exit(1) + + logger.info("reading instruction load order") + lo = LoadOrder() + try: + sets = lo.visit(tree) + except M2Error as e: + logger.critical("Error during load order building: %s", e) + sys.exit(1) + + if args.output is None: + model_path = search_path.joinpath("gen_model") + else: + model_path = pathlib.Path(args.output) + model_path.mkdir(exist_ok=True) + + temp_save = {} + + patch_model(expr_interpreter) + + for set_name, set_def in sets.items(): + logger.info(f"building architecture model for set {set_name}") + try: + arch_builder = ArchitectureModelBuilder() + s = arch_builder.visit(set_def) + if not isinstance(s, list): + s = [s] + # print("s", s) + except M2Error as e: + logger.critical("Error building architecture model of core", e) + + for orig, overwritten in arch_builder._overwritten_instrs: + logger.warning( + "instr %s from extension %s was overwritten by %s from %s", + orig.name, + orig.ext_name, + overwritten.name, + overwritten.ext_name, + ) + + temp_save[set_name] = (s, arch_builder) + + sets[set_name] = s[-1] + + for set_name, set_def in sets.items(): + logger.info("building behavior model for set %s", set_name) + # print("set", set_name, set_def, dir(set_def)) + + warned_fns = set() + + logger.debug("checking core constants") + unassigned_const = False + for const in set_def.constants.values(): + # print("const", const) + if const.value is None: + pass + # if const.name == "XLEN": + # if "32" in set_name: + # const.value = 32 + # elif "64" in set_name: + # const.value = 64 + # continue + # logger.critical("constant %s in set %s has no value assigned!", const.name, set_name) + # unassigned_const = True + # sys.exit(-1) + if unassigned_const: + sys.exit(-1) + + logger.debug("evaluating set parameters") + + for const_def in set_def.constants.values(): + const_def._value = const_def.value + + for mem_def in itertools.chain(set_def.memories.values(), set_def.memory_aliases.values()): + mem_def._size = mem_def.size + mem_def.range._lower_base = mem_def.range.lower_base + mem_def.range._upper_base = mem_def.range.upper_base + + for attr_name, attr_ops in mem_def.attributes.items(): + ops = [] + for attr_op in attr_ops: + try: + behav_builder = BehaviorModelBuilder( + set_def.constants, + set_def.memories, + set_def.memory_aliases, + {}, + set_def.functions, + warned_fns, + ) + op = behav_builder.visit(attr_op) + ops.append(op) + except M2Error as e: + logger.critical( + 'error processing attribute "%s" of memory "%s": %s', attr_name, mem_def.name, e + ) + sys.exit(1) + + mem_def.attributes[attr_name] = ops + + for fn_def in set_def.functions.values(): + if isinstance(fn_def.operation, behav.Operation) and not fn_def.extern: + raise M2SyntaxError(f"non-extern function {fn_def.name} has no body") + + fn_def._size = fn_def.size + for fn_arg in fn_def.args.values(): + fn_arg._size = fn_arg.size + fn_arg._width = fn_arg.width + + logger.debug("generating function behavior") + + for fn_name, fn_def in set_def.functions.items(): + logger.debug("generating function %s", fn_name) + logger.debug("generating attributes") + + for attr_name, attr_ops in fn_def.attributes.items(): + ops = [] + for attr_op in attr_ops: + try: + behav_builder = BehaviorModelBuilder( + set_def.constants, + set_def.memories, + set_def.memory_aliases, + fn_def.args, + set_def.functions, + warned_fns, + ) + op = behav_builder.visit(attr_op) + ops.append(op) + except M2Error as e: + logger.critical( + 'error processing attribute "%s" of function "%s": %s', attr_name, fn_def.name, e + ) + sys.exit(1) + + fn_def.attributes[attr_name] = ops + + behav_builder = BehaviorModelBuilder( + set_def.constants, set_def.memories, set_def.memory_aliases, fn_def.args, set_def.functions, warned_fns + ) + + if not isinstance(fn_def.operation, behav.Operation): + try: + op = behav_builder.visit(fn_def.operation) + except M2Error as e: + logger.critical("Error building behavior for function %s: %s", fn_name, e) + sys.exit() + + fn_def.scalars = behav_builder._scalars + + if isinstance(op, list): + fn_def.operation = behav.Operation(op) + else: + fn_def.operation = behav.Operation([op]) + + logger.debug("generating always blocks") + + always_block_statements = [] + + arch_builder = temp_save[set_name][1] + for block_def in arch_builder._always_blocks.values(): + logger.debug("generating always block %s", block_def.name) + logger.debug("generating attributes") + + for attr_name, attr_ops in block_def.attributes.items(): + ops = [] + for attr_op in attr_ops: + try: + behav_builder = BehaviorModelBuilder( + set_def.constants, + set_def.memories, + set_def.memory_aliases, + {}, + set_def.functions, + warned_fns, + ) + op = behav_builder.visit(attr_op) + ops.append(op) + except M2Error as e: + logger.critical( + 'error processing attribute "%s" of instruction "%s": %s', attr_name, block_def.name, e + ) + sys.exit(1) + + block_def.attributes[attr_name] = ops + + behav_builder = BehaviorModelBuilder( + set_def.constants, set_def.memories, set_def.memory_aliases, {}, set_def.functions, warned_fns + ) + + try: + op = behav_builder.visit(block_def.operation) + except M2Error as e: + logger.critical("error building behavior for always block %s: %s", block_def.name, e) + sys.exit(1) + + always_block_statements.append(op) + + logger.debug("generating instruction behavior") + + for instr_def in set_def.instructions.values(): + logger.debug("generating instruction %s", instr_def.name) + logger.debug("generating attributes") + + for attr_name, attr_ops in instr_def.attributes.items(): + ops = [] + for attr_op in attr_ops: + try: + behav_builder = BehaviorModelBuilder( + set_def.constants, + set_def.memories, + set_def.memory_aliases, + instr_def.fields, + set_def.functions, + warned_fns, + ) + op = behav_builder.visit(attr_op) + ops.append(op) + except M2Error as e: + logger.critical( + 'error processing attribute "%s" of instruction "%s": %s', attr_name, instr_def.name, e + ) + sys.exit(1) + + instr_def.attributes[attr_name] = ops + + behav_builder = BehaviorModelBuilder( + set_def.constants, + set_def.memories, + set_def.memory_aliases, + instr_def.fields, + set_def.functions, + warned_fns, + ) + + try: + op = behav_builder.visit(instr_def.operation) + except M2Error as e: + logger.critical( + "error building behavior for instruction %s::%s: %s", instr_def.ext_name, instr_def.name, e + ) + sys.exit(1) + + instr_def.scalars = behav_builder._scalars + + if isinstance(op, list): + op = behav.Operation(op) + else: + op = behav.Operation([op]) + + # pc_inc = behav.Assignment( + # behav.NamedReference(set_def.pc_memory), + # behav.BinaryOperation( + # behav.NamedReference(set_def.pc_memory), + # behav.Operator("+"), + # behav.IntLiteral(int(instr_def.size/8)) + # ) + # ) + + # op.statements.insert(0, pc_inc) + op.statements = always_block_statements + op.statements + instr_def.operation = op + + logger.info("dumping model") + with open(model_path / (abs_top_level.stem + ".m2isarmodel"), "wb") as f: + model_obj = M2Model(M2_METAMODEL_VERSION, {}, sets, CodeInfoBase.database) + pickle.dump(model_obj, f) + + +if __name__ == "__main__": + main() diff --git a/m2isar/frontends/coredsl2_set/parser_gen/.gitignore b/m2isar/frontends/coredsl2_set/parser_gen/.gitignore new file mode 100644 index 00000000..6e009160 --- /dev/null +++ b/m2isar/frontends/coredsl2_set/parser_gen/.gitignore @@ -0,0 +1,12 @@ +# SPDX-License-Identifier: Apache-2.0 +# +# This file is part of the M2-ISA-R project: https://github.com/tum-ei-eda/M2-ISA-R +# +# Copyright (C) 2022 +# Chair of Electrical Design Automation +# Technical University of Munich + +*.interp +*.tokens +!.gitignore +!__init__.py \ No newline at end of file diff --git a/m2isar/frontends/coredsl2_set/parser_gen/CoreDSL2Lexer.py b/m2isar/frontends/coredsl2_set/parser_gen/CoreDSL2Lexer.py new file mode 100644 index 00000000..934187ef --- /dev/null +++ b/m2isar/frontends/coredsl2_set/parser_gen/CoreDSL2Lexer.py @@ -0,0 +1,510 @@ +# Generated from CoreDSL2.g4 by ANTLR 4.13.1 +from antlr4 import * +from io import StringIO +import sys +if sys.version_info[1] > 5: + from typing import TextIO +else: + from typing.io import TextIO + + +def serializedATN(): + return [ + 4,0,102,900,6,-1,2,0,7,0,2,1,7,1,2,2,7,2,2,3,7,3,2,4,7,4,2,5,7,5, + 2,6,7,6,2,7,7,7,2,8,7,8,2,9,7,9,2,10,7,10,2,11,7,11,2,12,7,12,2, + 13,7,13,2,14,7,14,2,15,7,15,2,16,7,16,2,17,7,17,2,18,7,18,2,19,7, + 19,2,20,7,20,2,21,7,21,2,22,7,22,2,23,7,23,2,24,7,24,2,25,7,25,2, + 26,7,26,2,27,7,27,2,28,7,28,2,29,7,29,2,30,7,30,2,31,7,31,2,32,7, + 32,2,33,7,33,2,34,7,34,2,35,7,35,2,36,7,36,2,37,7,37,2,38,7,38,2, + 39,7,39,2,40,7,40,2,41,7,41,2,42,7,42,2,43,7,43,2,44,7,44,2,45,7, + 45,2,46,7,46,2,47,7,47,2,48,7,48,2,49,7,49,2,50,7,50,2,51,7,51,2, + 52,7,52,2,53,7,53,2,54,7,54,2,55,7,55,2,56,7,56,2,57,7,57,2,58,7, + 58,2,59,7,59,2,60,7,60,2,61,7,61,2,62,7,62,2,63,7,63,2,64,7,64,2, + 65,7,65,2,66,7,66,2,67,7,67,2,68,7,68,2,69,7,69,2,70,7,70,2,71,7, + 71,2,72,7,72,2,73,7,73,2,74,7,74,2,75,7,75,2,76,7,76,2,77,7,77,2, + 78,7,78,2,79,7,79,2,80,7,80,2,81,7,81,2,82,7,82,2,83,7,83,2,84,7, + 84,2,85,7,85,2,86,7,86,2,87,7,87,2,88,7,88,2,89,7,89,2,90,7,90,2, + 91,7,91,2,92,7,92,2,93,7,93,2,94,7,94,2,95,7,95,2,96,7,96,2,97,7, + 97,2,98,7,98,2,99,7,99,2,100,7,100,2,101,7,101,2,102,7,102,2,103, + 7,103,2,104,7,104,2,105,7,105,2,106,7,106,1,0,1,0,1,0,1,0,1,0,1, + 0,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, + 1,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,3,1,3,1,4,1,4,1,5,1,5,1,6,1, + 6,1,6,1,6,1,6,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,8,1,8,1,8,1, + 8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1, + 8,1,9,1,9,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,11, + 1,11,1,11,1,11,1,11,1,11,1,11,1,11,1,11,1,11,1,11,1,11,1,11,1,12, + 1,12,1,12,1,12,1,12,1,12,1,12,1,13,1,13,1,13,1,13,1,13,1,13,1,13, + 1,13,1,13,1,14,1,14,1,15,1,15,1,15,1,16,1,16,1,16,1,16,1,16,1,16, + 1,16,1,16,1,16,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,18, + 1,18,1,18,1,18,1,18,1,18,1,18,1,19,1,19,1,20,1,20,1,21,1,21,1,21, + 1,22,1,22,1,22,1,22,1,22,1,23,1,23,1,23,1,23,1,24,1,24,1,24,1,24, + 1,24,1,24,1,25,1,25,1,25,1,26,1,26,1,26,1,26,1,26,1,26,1,26,1,27, + 1,27,1,27,1,27,1,27,1,27,1,27,1,28,1,28,1,28,1,28,1,28,1,28,1,29, + 1,29,1,29,1,29,1,29,1,29,1,29,1,29,1,29,1,30,1,30,1,30,1,30,1,30, + 1,30,1,31,1,31,1,31,1,31,1,31,1,32,1,32,1,32,1,32,1,32,1,32,1,32, + 1,32,1,33,1,33,1,34,1,34,1,35,1,35,1,36,1,36,1,37,1,37,1,37,1,37, + 1,37,1,38,1,38,1,38,1,38,1,38,1,39,1,39,1,39,1,39,1,39,1,40,1,40, + 1,40,1,40,1,40,1,40,1,40,1,40,1,40,1,41,1,41,1,41,1,41,1,41,1,41, + 1,41,1,42,1,42,1,42,1,42,1,42,1,43,1,43,1,43,1,43,1,43,1,43,1,44, + 1,44,1,44,1,44,1,45,1,45,1,45,1,45,1,45,1,46,1,46,1,46,1,46,1,46, + 1,46,1,47,1,47,1,47,1,47,1,47,1,47,1,47,1,48,1,48,1,48,1,49,1,49, + 1,50,1,50,1,50,1,51,1,51,1,52,1,52,1,52,1,53,1,53,1,53,1,54,1,54, + 1,54,1,55,1,55,1,56,1,56,1,57,1,57,1,58,1,58,1,59,1,59,1,60,1,60, + 1,61,1,61,1,61,1,62,1,62,1,62,1,63,1,63,1,63,1,64,1,64,1,64,1,65, + 1,65,1,65,1,66,1,66,1,66,1,67,1,67,1,68,1,68,1,69,1,69,1,69,1,70, + 1,70,1,70,1,71,1,71,1,72,1,72,1,72,1,73,1,73,1,73,1,74,1,74,1,74, + 1,75,1,75,1,75,1,76,1,76,1,76,1,77,1,77,1,77,1,78,1,78,1,78,1,79, + 1,79,1,79,1,79,1,80,1,80,1,80,1,80,1,80,1,81,1,81,1,81,1,81,1,82, + 1,82,1,82,1,83,1,83,1,83,1,83,1,83,1,83,1,84,1,84,1,84,1,84,1,84, + 1,84,1,85,1,85,1,85,1,85,1,85,1,85,1,85,1,85,1,85,1,86,1,86,1,86, + 1,86,1,86,1,86,1,86,1,87,1,87,1,87,1,87,1,87,1,87,1,87,1,87,1,87, + 1,88,1,88,1,88,1,88,1,88,1,88,1,88,1,89,1,89,1,89,1,89,1,89,1,89, + 1,90,1,90,1,91,1,91,1,92,1,92,1,92,1,92,1,92,1,92,1,92,1,92,1,92, + 3,92,663,8,92,1,93,4,93,666,8,93,11,93,12,93,667,1,93,1,93,5,93, + 672,8,93,10,93,12,93,675,9,93,1,93,1,93,3,93,679,8,93,1,93,4,93, + 682,8,93,11,93,12,93,683,3,93,686,8,93,1,93,3,93,689,8,93,1,94,1, + 94,1,94,1,94,1,94,3,94,696,8,94,1,94,3,94,699,8,94,1,94,1,94,3,94, + 703,8,94,3,94,705,8,94,1,95,1,95,1,95,1,95,3,95,711,8,95,1,95,1, + 95,3,95,715,8,95,1,95,5,95,718,8,95,10,95,12,95,721,9,95,1,96,1, + 96,3,96,725,8,96,1,96,1,96,3,96,729,8,96,1,96,5,96,732,8,96,10,96, + 12,96,735,9,96,1,97,1,97,1,97,3,97,740,8,97,1,97,5,97,743,8,97,10, + 97,12,97,746,9,97,3,97,748,8,97,1,98,1,98,1,98,1,98,3,98,754,8,98, + 1,98,1,98,3,98,758,8,98,1,98,5,98,761,8,98,10,98,12,98,764,9,98, + 1,99,4,99,767,8,99,11,99,12,99,768,1,99,1,99,3,99,773,8,99,1,99, + 1,99,4,99,777,8,99,11,99,12,99,778,1,99,1,99,4,99,783,8,99,11,99, + 12,99,784,1,99,1,99,4,99,789,8,99,11,99,12,99,790,1,99,1,99,4,99, + 795,8,99,11,99,12,99,796,3,99,799,8,99,1,100,3,100,802,8,100,1,100, + 1,100,5,100,806,8,100,10,100,12,100,809,9,100,1,101,3,101,812,8, + 101,1,101,1,101,1,101,1,101,5,101,818,8,101,10,101,12,101,821,9, + 101,1,101,1,101,1,102,1,102,1,102,3,102,828,8,102,1,102,1,102,1, + 102,1,102,5,102,834,8,102,10,102,12,102,837,9,102,1,102,1,102,1, + 103,1,103,1,103,1,103,5,103,845,8,103,10,103,12,103,848,9,103,1, + 103,1,103,1,103,1,103,1,103,5,103,855,8,103,10,103,12,103,858,9, + 103,1,103,3,103,861,8,103,1,104,1,104,1,104,1,104,5,104,867,8,104, + 10,104,12,104,870,9,104,1,104,1,104,1,104,1,104,1,104,1,105,1,105, + 1,105,1,105,5,105,881,8,105,10,105,12,105,884,9,105,1,105,3,105, + 887,8,105,1,105,3,105,890,8,105,1,105,1,105,1,106,4,106,895,8,106, + 11,106,12,106,896,1,106,1,106,1,868,0,107,1,1,3,2,5,3,7,4,9,5,11, + 6,13,7,15,8,17,9,19,10,21,11,23,12,25,13,27,14,29,15,31,16,33,17, + 35,18,37,19,39,20,41,21,43,22,45,23,47,24,49,25,51,26,53,27,55,28, + 57,29,59,30,61,31,63,32,65,33,67,34,69,35,71,36,73,37,75,38,77,39, + 79,40,81,41,83,42,85,43,87,44,89,45,91,46,93,47,95,48,97,49,99,50, + 101,51,103,52,105,53,107,54,109,55,111,56,113,57,115,58,117,59,119, + 60,121,61,123,62,125,63,127,64,129,65,131,66,133,67,135,68,137,69, + 139,70,141,71,143,72,145,73,147,74,149,75,151,76,153,77,155,78,157, + 79,159,80,161,81,163,82,165,83,167,84,169,85,171,86,173,87,175,88, + 177,89,179,90,181,91,183,92,185,93,187,94,189,95,191,0,193,0,195, + 0,197,0,199,0,201,96,203,97,205,98,207,99,209,100,211,101,213,102, + 1,0,13,2,0,69,69,101,101,2,0,43,43,45,45,4,0,70,70,76,76,102,102, + 108,108,2,0,85,85,117,117,2,0,76,76,108,108,3,0,48,57,65,70,97,102, + 3,0,65,90,95,95,97,122,4,0,48,57,65,90,95,95,97,122,3,0,76,76,85, + 85,117,117,2,0,39,39,92,92,2,0,34,34,92,92,2,0,10,10,13,13,3,0,9, + 10,13,13,32,32,947,0,1,1,0,0,0,0,3,1,0,0,0,0,5,1,0,0,0,0,7,1,0,0, + 0,0,9,1,0,0,0,0,11,1,0,0,0,0,13,1,0,0,0,0,15,1,0,0,0,0,17,1,0,0, + 0,0,19,1,0,0,0,0,21,1,0,0,0,0,23,1,0,0,0,0,25,1,0,0,0,0,27,1,0,0, + 0,0,29,1,0,0,0,0,31,1,0,0,0,0,33,1,0,0,0,0,35,1,0,0,0,0,37,1,0,0, + 0,0,39,1,0,0,0,0,41,1,0,0,0,0,43,1,0,0,0,0,45,1,0,0,0,0,47,1,0,0, + 0,0,49,1,0,0,0,0,51,1,0,0,0,0,53,1,0,0,0,0,55,1,0,0,0,0,57,1,0,0, + 0,0,59,1,0,0,0,0,61,1,0,0,0,0,63,1,0,0,0,0,65,1,0,0,0,0,67,1,0,0, + 0,0,69,1,0,0,0,0,71,1,0,0,0,0,73,1,0,0,0,0,75,1,0,0,0,0,77,1,0,0, + 0,0,79,1,0,0,0,0,81,1,0,0,0,0,83,1,0,0,0,0,85,1,0,0,0,0,87,1,0,0, + 0,0,89,1,0,0,0,0,91,1,0,0,0,0,93,1,0,0,0,0,95,1,0,0,0,0,97,1,0,0, + 0,0,99,1,0,0,0,0,101,1,0,0,0,0,103,1,0,0,0,0,105,1,0,0,0,0,107,1, + 0,0,0,0,109,1,0,0,0,0,111,1,0,0,0,0,113,1,0,0,0,0,115,1,0,0,0,0, + 117,1,0,0,0,0,119,1,0,0,0,0,121,1,0,0,0,0,123,1,0,0,0,0,125,1,0, + 0,0,0,127,1,0,0,0,0,129,1,0,0,0,0,131,1,0,0,0,0,133,1,0,0,0,0,135, + 1,0,0,0,0,137,1,0,0,0,0,139,1,0,0,0,0,141,1,0,0,0,0,143,1,0,0,0, + 0,145,1,0,0,0,0,147,1,0,0,0,0,149,1,0,0,0,0,151,1,0,0,0,0,153,1, + 0,0,0,0,155,1,0,0,0,0,157,1,0,0,0,0,159,1,0,0,0,0,161,1,0,0,0,0, + 163,1,0,0,0,0,165,1,0,0,0,0,167,1,0,0,0,0,169,1,0,0,0,0,171,1,0, + 0,0,0,173,1,0,0,0,0,175,1,0,0,0,0,177,1,0,0,0,0,179,1,0,0,0,0,181, + 1,0,0,0,0,183,1,0,0,0,0,185,1,0,0,0,0,187,1,0,0,0,0,189,1,0,0,0, + 0,201,1,0,0,0,0,203,1,0,0,0,0,205,1,0,0,0,0,207,1,0,0,0,0,209,1, + 0,0,0,0,211,1,0,0,0,0,213,1,0,0,0,1,215,1,0,0,0,3,222,1,0,0,0,5, + 237,1,0,0,0,7,245,1,0,0,0,9,247,1,0,0,0,11,249,1,0,0,0,13,251,1, + 0,0,0,15,256,1,0,0,0,17,265,1,0,0,0,19,285,1,0,0,0,21,287,1,0,0, + 0,23,297,1,0,0,0,25,310,1,0,0,0,27,317,1,0,0,0,29,326,1,0,0,0,31, + 328,1,0,0,0,33,331,1,0,0,0,35,340,1,0,0,0,37,349,1,0,0,0,39,356, + 1,0,0,0,41,358,1,0,0,0,43,360,1,0,0,0,45,363,1,0,0,0,47,368,1,0, + 0,0,49,372,1,0,0,0,51,378,1,0,0,0,53,381,1,0,0,0,55,388,1,0,0,0, + 57,395,1,0,0,0,59,401,1,0,0,0,61,410,1,0,0,0,63,416,1,0,0,0,65,421, + 1,0,0,0,67,429,1,0,0,0,69,431,1,0,0,0,71,433,1,0,0,0,73,435,1,0, + 0,0,75,437,1,0,0,0,77,442,1,0,0,0,79,447,1,0,0,0,81,452,1,0,0,0, + 83,461,1,0,0,0,85,468,1,0,0,0,87,473,1,0,0,0,89,479,1,0,0,0,91,483, + 1,0,0,0,93,488,1,0,0,0,95,494,1,0,0,0,97,501,1,0,0,0,99,504,1,0, + 0,0,101,506,1,0,0,0,103,509,1,0,0,0,105,511,1,0,0,0,107,514,1,0, + 0,0,109,517,1,0,0,0,111,520,1,0,0,0,113,522,1,0,0,0,115,524,1,0, + 0,0,117,526,1,0,0,0,119,528,1,0,0,0,121,530,1,0,0,0,123,532,1,0, + 0,0,125,535,1,0,0,0,127,538,1,0,0,0,129,541,1,0,0,0,131,544,1,0, + 0,0,133,547,1,0,0,0,135,550,1,0,0,0,137,552,1,0,0,0,139,554,1,0, + 0,0,141,557,1,0,0,0,143,560,1,0,0,0,145,562,1,0,0,0,147,565,1,0, + 0,0,149,568,1,0,0,0,151,571,1,0,0,0,153,574,1,0,0,0,155,577,1,0, + 0,0,157,580,1,0,0,0,159,583,1,0,0,0,161,587,1,0,0,0,163,592,1,0, + 0,0,165,596,1,0,0,0,167,599,1,0,0,0,169,605,1,0,0,0,171,611,1,0, + 0,0,173,620,1,0,0,0,175,627,1,0,0,0,177,636,1,0,0,0,179,643,1,0, + 0,0,181,649,1,0,0,0,183,651,1,0,0,0,185,662,1,0,0,0,187,665,1,0, + 0,0,189,695,1,0,0,0,191,710,1,0,0,0,193,722,1,0,0,0,195,747,1,0, + 0,0,197,753,1,0,0,0,199,766,1,0,0,0,201,801,1,0,0,0,203,811,1,0, + 0,0,205,827,1,0,0,0,207,860,1,0,0,0,209,862,1,0,0,0,211,876,1,0, + 0,0,213,894,1,0,0,0,215,216,5,105,0,0,216,217,5,109,0,0,217,218, + 5,112,0,0,218,219,5,111,0,0,219,220,5,114,0,0,220,221,5,116,0,0, + 221,2,1,0,0,0,222,223,5,73,0,0,223,224,5,110,0,0,224,225,5,115,0, + 0,225,226,5,116,0,0,226,227,5,114,0,0,227,228,5,117,0,0,228,229, + 5,99,0,0,229,230,5,116,0,0,230,231,5,105,0,0,231,232,5,111,0,0,232, + 233,5,110,0,0,233,234,5,83,0,0,234,235,5,101,0,0,235,236,5,116,0, + 0,236,4,1,0,0,0,237,238,5,101,0,0,238,239,5,120,0,0,239,240,5,116, + 0,0,240,241,5,101,0,0,241,242,5,110,0,0,242,243,5,100,0,0,243,244, + 5,115,0,0,244,6,1,0,0,0,245,246,5,44,0,0,246,8,1,0,0,0,247,248,5, + 123,0,0,248,10,1,0,0,0,249,250,5,125,0,0,250,12,1,0,0,0,251,252, + 5,67,0,0,252,253,5,111,0,0,253,254,5,114,0,0,254,255,5,101,0,0,255, + 14,1,0,0,0,256,257,5,112,0,0,257,258,5,114,0,0,258,259,5,111,0,0, + 259,260,5,118,0,0,260,261,5,105,0,0,261,262,5,100,0,0,262,263,5, + 101,0,0,263,264,5,115,0,0,264,16,1,0,0,0,265,266,5,97,0,0,266,267, + 5,114,0,0,267,268,5,99,0,0,268,269,5,104,0,0,269,270,5,105,0,0,270, + 271,5,116,0,0,271,272,5,101,0,0,272,273,5,99,0,0,273,274,5,116,0, + 0,274,275,5,117,0,0,275,276,5,114,0,0,276,277,5,97,0,0,277,278,5, + 108,0,0,278,279,5,95,0,0,279,280,5,115,0,0,280,281,5,116,0,0,281, + 282,5,97,0,0,282,283,5,116,0,0,283,284,5,101,0,0,284,18,1,0,0,0, + 285,286,5,59,0,0,286,20,1,0,0,0,287,288,5,102,0,0,288,289,5,117, + 0,0,289,290,5,110,0,0,290,291,5,99,0,0,291,292,5,116,0,0,292,293, + 5,105,0,0,293,294,5,111,0,0,294,295,5,110,0,0,295,296,5,115,0,0, + 296,22,1,0,0,0,297,298,5,105,0,0,298,299,5,110,0,0,299,300,5,115, + 0,0,300,301,5,116,0,0,301,302,5,114,0,0,302,303,5,117,0,0,303,304, + 5,99,0,0,304,305,5,116,0,0,305,306,5,105,0,0,306,307,5,111,0,0,307, + 308,5,110,0,0,308,309,5,115,0,0,309,24,1,0,0,0,310,311,5,97,0,0, + 311,312,5,108,0,0,312,313,5,119,0,0,313,314,5,97,0,0,314,315,5,121, + 0,0,315,316,5,115,0,0,316,26,1,0,0,0,317,318,5,101,0,0,318,319,5, + 110,0,0,319,320,5,99,0,0,320,321,5,111,0,0,321,322,5,100,0,0,322, + 323,5,105,0,0,323,324,5,110,0,0,324,325,5,103,0,0,325,28,1,0,0,0, + 326,327,5,58,0,0,327,30,1,0,0,0,328,329,5,58,0,0,329,330,5,58,0, + 0,330,32,1,0,0,0,331,332,5,97,0,0,332,333,5,115,0,0,333,334,5,115, + 0,0,334,335,5,101,0,0,335,336,5,109,0,0,336,337,5,98,0,0,337,338, + 5,108,0,0,338,339,5,121,0,0,339,34,1,0,0,0,340,341,5,98,0,0,341, + 342,5,101,0,0,342,343,5,104,0,0,343,344,5,97,0,0,344,345,5,118,0, + 0,345,346,5,105,0,0,346,347,5,111,0,0,347,348,5,114,0,0,348,36,1, + 0,0,0,349,350,5,101,0,0,350,351,5,120,0,0,351,352,5,116,0,0,352, + 353,5,101,0,0,353,354,5,114,0,0,354,355,5,110,0,0,355,38,1,0,0,0, + 356,357,5,40,0,0,357,40,1,0,0,0,358,359,5,41,0,0,359,42,1,0,0,0, + 360,361,5,105,0,0,361,362,5,102,0,0,362,44,1,0,0,0,363,364,5,101, + 0,0,364,365,5,108,0,0,365,366,5,115,0,0,366,367,5,101,0,0,367,46, + 1,0,0,0,368,369,5,102,0,0,369,370,5,111,0,0,370,371,5,114,0,0,371, + 48,1,0,0,0,372,373,5,119,0,0,373,374,5,104,0,0,374,375,5,105,0,0, + 375,376,5,108,0,0,376,377,5,101,0,0,377,50,1,0,0,0,378,379,5,100, + 0,0,379,380,5,111,0,0,380,52,1,0,0,0,381,382,5,115,0,0,382,383,5, + 119,0,0,383,384,5,105,0,0,384,385,5,116,0,0,385,386,5,99,0,0,386, + 387,5,104,0,0,387,54,1,0,0,0,388,389,5,114,0,0,389,390,5,101,0,0, + 390,391,5,116,0,0,391,392,5,117,0,0,392,393,5,114,0,0,393,394,5, + 110,0,0,394,56,1,0,0,0,395,396,5,98,0,0,396,397,5,114,0,0,397,398, + 5,101,0,0,398,399,5,97,0,0,399,400,5,107,0,0,400,58,1,0,0,0,401, + 402,5,99,0,0,402,403,5,111,0,0,403,404,5,110,0,0,404,405,5,116,0, + 0,405,406,5,105,0,0,406,407,5,110,0,0,407,408,5,117,0,0,408,409, + 5,101,0,0,409,60,1,0,0,0,410,411,5,115,0,0,411,412,5,112,0,0,412, + 413,5,97,0,0,413,414,5,119,0,0,414,415,5,110,0,0,415,62,1,0,0,0, + 416,417,5,99,0,0,417,418,5,97,0,0,418,419,5,115,0,0,419,420,5,101, + 0,0,420,64,1,0,0,0,421,422,5,100,0,0,422,423,5,101,0,0,423,424,5, + 102,0,0,424,425,5,97,0,0,425,426,5,117,0,0,426,427,5,108,0,0,427, + 428,5,116,0,0,428,66,1,0,0,0,429,430,5,42,0,0,430,68,1,0,0,0,431, + 432,5,38,0,0,432,70,1,0,0,0,433,434,5,60,0,0,434,72,1,0,0,0,435, + 436,5,62,0,0,436,74,1,0,0,0,437,438,5,98,0,0,438,439,5,111,0,0,439, + 440,5,111,0,0,440,441,5,108,0,0,441,76,1,0,0,0,442,443,5,118,0,0, + 443,444,5,111,0,0,444,445,5,105,0,0,445,446,5,100,0,0,446,78,1,0, + 0,0,447,448,5,101,0,0,448,449,5,110,0,0,449,450,5,117,0,0,450,451, + 5,109,0,0,451,80,1,0,0,0,452,453,5,117,0,0,453,454,5,110,0,0,454, + 455,5,115,0,0,455,456,5,105,0,0,456,457,5,103,0,0,457,458,5,110, + 0,0,458,459,5,101,0,0,459,460,5,100,0,0,460,82,1,0,0,0,461,462,5, + 115,0,0,462,463,5,105,0,0,463,464,5,103,0,0,464,465,5,110,0,0,465, + 466,5,101,0,0,466,467,5,100,0,0,467,84,1,0,0,0,468,469,5,99,0,0, + 469,470,5,104,0,0,470,471,5,97,0,0,471,472,5,114,0,0,472,86,1,0, + 0,0,473,474,5,115,0,0,474,475,5,104,0,0,475,476,5,111,0,0,476,477, + 5,114,0,0,477,478,5,116,0,0,478,88,1,0,0,0,479,480,5,105,0,0,480, + 481,5,110,0,0,481,482,5,116,0,0,482,90,1,0,0,0,483,484,5,108,0,0, + 484,485,5,111,0,0,485,486,5,110,0,0,486,487,5,103,0,0,487,92,1,0, + 0,0,488,489,5,102,0,0,489,490,5,108,0,0,490,491,5,111,0,0,491,492, + 5,97,0,0,492,493,5,116,0,0,493,94,1,0,0,0,494,495,5,100,0,0,495, + 496,5,111,0,0,496,497,5,117,0,0,497,498,5,98,0,0,498,499,5,108,0, + 0,499,500,5,101,0,0,500,96,1,0,0,0,501,502,5,91,0,0,502,503,5,91, + 0,0,503,98,1,0,0,0,504,505,5,61,0,0,505,100,1,0,0,0,506,507,5,93, + 0,0,507,508,5,93,0,0,508,102,1,0,0,0,509,510,5,46,0,0,510,104,1, + 0,0,0,511,512,5,45,0,0,512,513,5,62,0,0,513,106,1,0,0,0,514,515, + 5,43,0,0,515,516,5,43,0,0,516,108,1,0,0,0,517,518,5,45,0,0,518,519, + 5,45,0,0,519,110,1,0,0,0,520,521,5,43,0,0,521,112,1,0,0,0,522,523, + 5,45,0,0,523,114,1,0,0,0,524,525,5,126,0,0,525,116,1,0,0,0,526,527, + 5,33,0,0,527,118,1,0,0,0,528,529,5,47,0,0,529,120,1,0,0,0,530,531, + 5,37,0,0,531,122,1,0,0,0,532,533,5,60,0,0,533,534,5,60,0,0,534,124, + 1,0,0,0,535,536,5,62,0,0,536,537,5,62,0,0,537,126,1,0,0,0,538,539, + 5,60,0,0,539,540,5,61,0,0,540,128,1,0,0,0,541,542,5,62,0,0,542,543, + 5,61,0,0,543,130,1,0,0,0,544,545,5,61,0,0,545,546,5,61,0,0,546,132, + 1,0,0,0,547,548,5,33,0,0,548,549,5,61,0,0,549,134,1,0,0,0,550,551, + 5,94,0,0,551,136,1,0,0,0,552,553,5,124,0,0,553,138,1,0,0,0,554,555, + 5,38,0,0,555,556,5,38,0,0,556,140,1,0,0,0,557,558,5,124,0,0,558, + 559,5,124,0,0,559,142,1,0,0,0,560,561,5,63,0,0,561,144,1,0,0,0,562, + 563,5,43,0,0,563,564,5,61,0,0,564,146,1,0,0,0,565,566,5,45,0,0,566, + 567,5,61,0,0,567,148,1,0,0,0,568,569,5,42,0,0,569,570,5,61,0,0,570, + 150,1,0,0,0,571,572,5,47,0,0,572,573,5,61,0,0,573,152,1,0,0,0,574, + 575,5,38,0,0,575,576,5,61,0,0,576,154,1,0,0,0,577,578,5,124,0,0, + 578,579,5,61,0,0,579,156,1,0,0,0,580,581,5,94,0,0,581,582,5,61,0, + 0,582,158,1,0,0,0,583,584,5,62,0,0,584,585,5,62,0,0,585,586,5,61, + 0,0,586,160,1,0,0,0,587,588,5,62,0,0,588,589,5,62,0,0,589,590,5, + 62,0,0,590,591,5,61,0,0,591,162,1,0,0,0,592,593,5,60,0,0,593,594, + 5,60,0,0,594,595,5,61,0,0,595,164,1,0,0,0,596,597,5,37,0,0,597,598, + 5,61,0,0,598,166,1,0,0,0,599,600,5,97,0,0,600,601,5,108,0,0,601, + 602,5,105,0,0,602,603,5,97,0,0,603,604,5,115,0,0,604,168,1,0,0,0, + 605,606,5,99,0,0,606,607,5,111,0,0,607,608,5,110,0,0,608,609,5,115, + 0,0,609,610,5,116,0,0,610,170,1,0,0,0,611,612,5,118,0,0,612,613, + 5,111,0,0,613,614,5,108,0,0,614,615,5,97,0,0,615,616,5,116,0,0,616, + 617,5,105,0,0,617,618,5,108,0,0,618,619,5,101,0,0,619,172,1,0,0, + 0,620,621,5,115,0,0,621,622,5,116,0,0,622,623,5,97,0,0,623,624,5, + 116,0,0,624,625,5,105,0,0,625,626,5,99,0,0,626,174,1,0,0,0,627,628, + 5,114,0,0,628,629,5,101,0,0,629,630,5,103,0,0,630,631,5,105,0,0, + 631,632,5,115,0,0,632,633,5,116,0,0,633,634,5,101,0,0,634,635,5, + 114,0,0,635,176,1,0,0,0,636,637,5,115,0,0,637,638,5,116,0,0,638, + 639,5,114,0,0,639,640,5,117,0,0,640,641,5,99,0,0,641,642,5,116,0, + 0,642,178,1,0,0,0,643,644,5,117,0,0,644,645,5,110,0,0,645,646,5, + 105,0,0,646,647,5,111,0,0,647,648,5,110,0,0,648,180,1,0,0,0,649, + 650,5,91,0,0,650,182,1,0,0,0,651,652,5,93,0,0,652,184,1,0,0,0,653, + 654,5,116,0,0,654,655,5,114,0,0,655,656,5,117,0,0,656,663,5,101, + 0,0,657,658,5,102,0,0,658,659,5,97,0,0,659,660,5,108,0,0,660,661, + 5,115,0,0,661,663,5,101,0,0,662,653,1,0,0,0,662,657,1,0,0,0,663, + 186,1,0,0,0,664,666,2,48,57,0,665,664,1,0,0,0,666,667,1,0,0,0,667, + 665,1,0,0,0,667,668,1,0,0,0,668,669,1,0,0,0,669,673,5,46,0,0,670, + 672,2,48,57,0,671,670,1,0,0,0,672,675,1,0,0,0,673,671,1,0,0,0,673, + 674,1,0,0,0,674,685,1,0,0,0,675,673,1,0,0,0,676,678,7,0,0,0,677, + 679,7,1,0,0,678,677,1,0,0,0,678,679,1,0,0,0,679,681,1,0,0,0,680, + 682,2,48,57,0,681,680,1,0,0,0,682,683,1,0,0,0,683,681,1,0,0,0,683, + 684,1,0,0,0,684,686,1,0,0,0,685,676,1,0,0,0,685,686,1,0,0,0,686, + 688,1,0,0,0,687,689,7,2,0,0,688,687,1,0,0,0,688,689,1,0,0,0,689, + 188,1,0,0,0,690,696,3,191,95,0,691,696,3,197,98,0,692,696,3,193, + 96,0,693,696,3,195,97,0,694,696,3,199,99,0,695,690,1,0,0,0,695,691, + 1,0,0,0,695,692,1,0,0,0,695,693,1,0,0,0,695,694,1,0,0,0,696,698, + 1,0,0,0,697,699,7,3,0,0,698,697,1,0,0,0,698,699,1,0,0,0,699,704, + 1,0,0,0,700,702,7,4,0,0,701,703,7,4,0,0,702,701,1,0,0,0,702,703, + 1,0,0,0,703,705,1,0,0,0,704,700,1,0,0,0,704,705,1,0,0,0,705,190, + 1,0,0,0,706,707,5,48,0,0,707,711,5,98,0,0,708,709,5,48,0,0,709,711, + 5,66,0,0,710,706,1,0,0,0,710,708,1,0,0,0,711,712,1,0,0,0,712,719, + 2,48,49,0,713,715,5,95,0,0,714,713,1,0,0,0,714,715,1,0,0,0,715,716, + 1,0,0,0,716,718,2,48,49,0,717,714,1,0,0,0,718,721,1,0,0,0,719,717, + 1,0,0,0,719,720,1,0,0,0,720,192,1,0,0,0,721,719,1,0,0,0,722,724, + 5,48,0,0,723,725,5,95,0,0,724,723,1,0,0,0,724,725,1,0,0,0,725,726, + 1,0,0,0,726,733,2,48,55,0,727,729,5,95,0,0,728,727,1,0,0,0,728,729, + 1,0,0,0,729,730,1,0,0,0,730,732,2,48,55,0,731,728,1,0,0,0,732,735, + 1,0,0,0,733,731,1,0,0,0,733,734,1,0,0,0,734,194,1,0,0,0,735,733, + 1,0,0,0,736,748,5,48,0,0,737,744,2,49,57,0,738,740,5,95,0,0,739, + 738,1,0,0,0,739,740,1,0,0,0,740,741,1,0,0,0,741,743,2,48,57,0,742, + 739,1,0,0,0,743,746,1,0,0,0,744,742,1,0,0,0,744,745,1,0,0,0,745, + 748,1,0,0,0,746,744,1,0,0,0,747,736,1,0,0,0,747,737,1,0,0,0,748, + 196,1,0,0,0,749,750,5,48,0,0,750,754,5,120,0,0,751,752,5,48,0,0, + 752,754,5,88,0,0,753,749,1,0,0,0,753,751,1,0,0,0,754,755,1,0,0,0, + 755,762,7,5,0,0,756,758,5,95,0,0,757,756,1,0,0,0,757,758,1,0,0,0, + 758,759,1,0,0,0,759,761,7,5,0,0,760,757,1,0,0,0,761,764,1,0,0,0, + 762,760,1,0,0,0,762,763,1,0,0,0,763,198,1,0,0,0,764,762,1,0,0,0, + 765,767,2,48,57,0,766,765,1,0,0,0,767,768,1,0,0,0,768,766,1,0,0, + 0,768,769,1,0,0,0,769,770,1,0,0,0,770,772,5,39,0,0,771,773,5,115, + 0,0,772,771,1,0,0,0,772,773,1,0,0,0,773,798,1,0,0,0,774,776,5,98, + 0,0,775,777,2,48,49,0,776,775,1,0,0,0,777,778,1,0,0,0,778,776,1, + 0,0,0,778,779,1,0,0,0,779,799,1,0,0,0,780,782,5,111,0,0,781,783, + 2,48,55,0,782,781,1,0,0,0,783,784,1,0,0,0,784,782,1,0,0,0,784,785, + 1,0,0,0,785,799,1,0,0,0,786,788,5,100,0,0,787,789,2,48,57,0,788, + 787,1,0,0,0,789,790,1,0,0,0,790,788,1,0,0,0,790,791,1,0,0,0,791, + 799,1,0,0,0,792,794,5,104,0,0,793,795,7,5,0,0,794,793,1,0,0,0,795, + 796,1,0,0,0,796,794,1,0,0,0,796,797,1,0,0,0,797,799,1,0,0,0,798, + 774,1,0,0,0,798,780,1,0,0,0,798,786,1,0,0,0,798,792,1,0,0,0,799, + 200,1,0,0,0,800,802,5,94,0,0,801,800,1,0,0,0,801,802,1,0,0,0,802, + 803,1,0,0,0,803,807,7,6,0,0,804,806,7,7,0,0,805,804,1,0,0,0,806, + 809,1,0,0,0,807,805,1,0,0,0,807,808,1,0,0,0,808,202,1,0,0,0,809, + 807,1,0,0,0,810,812,7,8,0,0,811,810,1,0,0,0,811,812,1,0,0,0,812, + 813,1,0,0,0,813,819,5,39,0,0,814,815,5,92,0,0,815,818,9,0,0,0,816, + 818,8,9,0,0,817,814,1,0,0,0,817,816,1,0,0,0,818,821,1,0,0,0,819, + 817,1,0,0,0,819,820,1,0,0,0,820,822,1,0,0,0,821,819,1,0,0,0,822, + 823,5,39,0,0,823,204,1,0,0,0,824,825,5,117,0,0,825,828,5,56,0,0, + 826,828,7,8,0,0,827,824,1,0,0,0,827,826,1,0,0,0,828,829,1,0,0,0, + 829,835,5,34,0,0,830,831,5,92,0,0,831,834,9,0,0,0,832,834,8,10,0, + 0,833,830,1,0,0,0,833,832,1,0,0,0,834,837,1,0,0,0,835,833,1,0,0, + 0,835,836,1,0,0,0,836,838,1,0,0,0,837,835,1,0,0,0,838,839,5,34,0, + 0,839,206,1,0,0,0,840,846,5,34,0,0,841,842,5,92,0,0,842,845,9,0, + 0,0,843,845,8,10,0,0,844,841,1,0,0,0,844,843,1,0,0,0,845,848,1,0, + 0,0,846,844,1,0,0,0,846,847,1,0,0,0,847,849,1,0,0,0,848,846,1,0, + 0,0,849,861,5,34,0,0,850,856,5,39,0,0,851,852,5,92,0,0,852,855,9, + 0,0,0,853,855,8,9,0,0,854,851,1,0,0,0,854,853,1,0,0,0,855,858,1, + 0,0,0,856,854,1,0,0,0,856,857,1,0,0,0,857,859,1,0,0,0,858,856,1, + 0,0,0,859,861,5,39,0,0,860,840,1,0,0,0,860,850,1,0,0,0,861,208,1, + 0,0,0,862,863,5,47,0,0,863,864,5,42,0,0,864,868,1,0,0,0,865,867, + 9,0,0,0,866,865,1,0,0,0,867,870,1,0,0,0,868,869,1,0,0,0,868,866, + 1,0,0,0,869,871,1,0,0,0,870,868,1,0,0,0,871,872,5,42,0,0,872,873, + 5,47,0,0,873,874,1,0,0,0,874,875,6,104,0,0,875,210,1,0,0,0,876,877, + 5,47,0,0,877,878,5,47,0,0,878,882,1,0,0,0,879,881,8,11,0,0,880,879, + 1,0,0,0,881,884,1,0,0,0,882,880,1,0,0,0,882,883,1,0,0,0,883,889, + 1,0,0,0,884,882,1,0,0,0,885,887,5,13,0,0,886,885,1,0,0,0,886,887, + 1,0,0,0,887,888,1,0,0,0,888,890,5,10,0,0,889,886,1,0,0,0,889,890, + 1,0,0,0,890,891,1,0,0,0,891,892,6,105,0,0,892,212,1,0,0,0,893,895, + 7,12,0,0,894,893,1,0,0,0,895,896,1,0,0,0,896,894,1,0,0,0,896,897, + 1,0,0,0,897,898,1,0,0,0,898,899,6,106,0,0,899,214,1,0,0,0,49,0,662, + 667,673,678,683,685,688,695,698,702,704,710,714,719,724,728,733, + 739,744,747,753,757,762,768,772,778,784,790,796,798,801,807,811, + 817,819,827,833,835,844,846,854,856,860,868,882,886,889,896,1,6, + 0,0 + ] + +class CoreDSL2Lexer(Lexer): + + atn = ATNDeserializer().deserialize(serializedATN()) + + decisionsToDFA = [ DFA(ds, i) for i, ds in enumerate(atn.decisionToState) ] + + T__0 = 1 + T__1 = 2 + T__2 = 3 + T__3 = 4 + T__4 = 5 + T__5 = 6 + T__6 = 7 + T__7 = 8 + T__8 = 9 + T__9 = 10 + T__10 = 11 + T__11 = 12 + T__12 = 13 + T__13 = 14 + T__14 = 15 + T__15 = 16 + T__16 = 17 + T__17 = 18 + T__18 = 19 + T__19 = 20 + T__20 = 21 + T__21 = 22 + T__22 = 23 + T__23 = 24 + T__24 = 25 + T__25 = 26 + T__26 = 27 + T__27 = 28 + T__28 = 29 + T__29 = 30 + T__30 = 31 + T__31 = 32 + T__32 = 33 + T__33 = 34 + T__34 = 35 + T__35 = 36 + T__36 = 37 + T__37 = 38 + T__38 = 39 + T__39 = 40 + T__40 = 41 + T__41 = 42 + T__42 = 43 + T__43 = 44 + T__44 = 45 + T__45 = 46 + T__46 = 47 + T__47 = 48 + T__48 = 49 + T__49 = 50 + T__50 = 51 + T__51 = 52 + T__52 = 53 + T__53 = 54 + T__54 = 55 + T__55 = 56 + T__56 = 57 + T__57 = 58 + T__58 = 59 + T__59 = 60 + T__60 = 61 + T__61 = 62 + T__62 = 63 + T__63 = 64 + T__64 = 65 + T__65 = 66 + T__66 = 67 + T__67 = 68 + T__68 = 69 + T__69 = 70 + T__70 = 71 + T__71 = 72 + T__72 = 73 + T__73 = 74 + T__74 = 75 + T__75 = 76 + T__76 = 77 + T__77 = 78 + T__78 = 79 + T__79 = 80 + T__80 = 81 + T__81 = 82 + T__82 = 83 + T__83 = 84 + T__84 = 85 + T__85 = 86 + T__86 = 87 + T__87 = 88 + T__88 = 89 + T__89 = 90 + LEFT_BR = 91 + RIGHT_BR = 92 + BOOLEAN = 93 + FLOAT = 94 + INTEGER = 95 + IDENTIFIER = 96 + CHARCONST = 97 + ENCSTRINGCONST = 98 + STRING = 99 + ML_COMMENT = 100 + SL_COMMENT = 101 + WS = 102 + + channelNames = [ u"DEFAULT_TOKEN_CHANNEL", u"HIDDEN" ] + + modeNames = [ "DEFAULT_MODE" ] + + literalNames = [ "", + "'import'", "'InstructionSet'", "'extends'", "','", "'{'", "'}'", + "'Core'", "'provides'", "'architectural_state'", "';'", "'functions'", + "'instructions'", "'always'", "'encoding'", "':'", "'::'", "'assembly'", + "'behavior'", "'extern'", "'('", "')'", "'if'", "'else'", "'for'", + "'while'", "'do'", "'switch'", "'return'", "'break'", "'continue'", + "'spawn'", "'case'", "'default'", "'*'", "'&'", "'<'", "'>'", + "'bool'", "'void'", "'enum'", "'unsigned'", "'signed'", "'char'", + "'short'", "'int'", "'long'", "'float'", "'double'", "'[['", + "'='", "']]'", "'.'", "'->'", "'++'", "'--'", "'+'", "'-'", + "'~'", "'!'", "'/'", "'%'", "'<<'", "'>>'", "'<='", "'>='", + "'=='", "'!='", "'^'", "'|'", "'&&'", "'||'", "'?'", "'+='", + "'-='", "'*='", "'/='", "'&='", "'|='", "'^='", "'>>='", "'>>>='", + "'<<='", "'%='", "'alias'", "'const'", "'volatile'", "'static'", + "'register'", "'struct'", "'union'", "'['", "']'" ] + + symbolicNames = [ "", + "LEFT_BR", "RIGHT_BR", "BOOLEAN", "FLOAT", "INTEGER", "IDENTIFIER", + "CHARCONST", "ENCSTRINGCONST", "STRING", "ML_COMMENT", "SL_COMMENT", + "WS" ] + + ruleNames = [ "T__0", "T__1", "T__2", "T__3", "T__4", "T__5", "T__6", + "T__7", "T__8", "T__9", "T__10", "T__11", "T__12", "T__13", + "T__14", "T__15", "T__16", "T__17", "T__18", "T__19", + "T__20", "T__21", "T__22", "T__23", "T__24", "T__25", + "T__26", "T__27", "T__28", "T__29", "T__30", "T__31", + "T__32", "T__33", "T__34", "T__35", "T__36", "T__37", + "T__38", "T__39", "T__40", "T__41", "T__42", "T__43", + "T__44", "T__45", "T__46", "T__47", "T__48", "T__49", + "T__50", "T__51", "T__52", "T__53", "T__54", "T__55", + "T__56", "T__57", "T__58", "T__59", "T__60", "T__61", + "T__62", "T__63", "T__64", "T__65", "T__66", "T__67", + "T__68", "T__69", "T__70", "T__71", "T__72", "T__73", + "T__74", "T__75", "T__76", "T__77", "T__78", "T__79", + "T__80", "T__81", "T__82", "T__83", "T__84", "T__85", + "T__86", "T__87", "T__88", "T__89", "LEFT_BR", "RIGHT_BR", + "BOOLEAN", "FLOAT", "INTEGER", "BINARYINT", "OCTALINT", + "DECIMALINT", "HEXADECIMALINT", "VLOGINT", "IDENTIFIER", + "CHARCONST", "ENCSTRINGCONST", "STRING", "ML_COMMENT", + "SL_COMMENT", "WS" ] + + grammarFileName = "CoreDSL2.g4" + + def __init__(self, input=None, output:TextIO = sys.stdout): + super().__init__(input, output) + self.checkVersion("4.13.1") + self._interp = LexerATNSimulator(self, self.atn, self.decisionsToDFA, PredictionContextCache()) + self._actions = None + self._predicates = None + + diff --git a/m2isar/frontends/coredsl2_set/parser_gen/CoreDSL2Listener.py b/m2isar/frontends/coredsl2_set/parser_gen/CoreDSL2Listener.py new file mode 100644 index 00000000..f8a03bdd --- /dev/null +++ b/m2isar/frontends/coredsl2_set/parser_gen/CoreDSL2Listener.py @@ -0,0 +1,786 @@ +# Generated from CoreDSL2.g4 by ANTLR 4.13.1 +from antlr4 import * +if "." in __name__: + from .CoreDSL2Parser import CoreDSL2Parser +else: + from CoreDSL2Parser import CoreDSL2Parser + +# This class defines a complete listener for a parse tree produced by CoreDSL2Parser. +class CoreDSL2Listener(ParseTreeListener): + + # Enter a parse tree produced by CoreDSL2Parser#description_content. + def enterDescription_content(self, ctx:CoreDSL2Parser.Description_contentContext): + pass + + # Exit a parse tree produced by CoreDSL2Parser#description_content. + def exitDescription_content(self, ctx:CoreDSL2Parser.Description_contentContext): + pass + + + # Enter a parse tree produced by CoreDSL2Parser#import_file. + def enterImport_file(self, ctx:CoreDSL2Parser.Import_fileContext): + pass + + # Exit a parse tree produced by CoreDSL2Parser#import_file. + def exitImport_file(self, ctx:CoreDSL2Parser.Import_fileContext): + pass + + + # Enter a parse tree produced by CoreDSL2Parser#instruction_set. + def enterInstruction_set(self, ctx:CoreDSL2Parser.Instruction_setContext): + pass + + # Exit a parse tree produced by CoreDSL2Parser#instruction_set. + def exitInstruction_set(self, ctx:CoreDSL2Parser.Instruction_setContext): + pass + + + # Enter a parse tree produced by CoreDSL2Parser#core_def. + def enterCore_def(self, ctx:CoreDSL2Parser.Core_defContext): + pass + + # Exit a parse tree produced by CoreDSL2Parser#core_def. + def exitCore_def(self, ctx:CoreDSL2Parser.Core_defContext): + pass + + + # Enter a parse tree produced by CoreDSL2Parser#section_arch_state. + def enterSection_arch_state(self, ctx:CoreDSL2Parser.Section_arch_stateContext): + pass + + # Exit a parse tree produced by CoreDSL2Parser#section_arch_state. + def exitSection_arch_state(self, ctx:CoreDSL2Parser.Section_arch_stateContext): + pass + + + # Enter a parse tree produced by CoreDSL2Parser#section_functions. + def enterSection_functions(self, ctx:CoreDSL2Parser.Section_functionsContext): + pass + + # Exit a parse tree produced by CoreDSL2Parser#section_functions. + def exitSection_functions(self, ctx:CoreDSL2Parser.Section_functionsContext): + pass + + + # Enter a parse tree produced by CoreDSL2Parser#section_instructions. + def enterSection_instructions(self, ctx:CoreDSL2Parser.Section_instructionsContext): + pass + + # Exit a parse tree produced by CoreDSL2Parser#section_instructions. + def exitSection_instructions(self, ctx:CoreDSL2Parser.Section_instructionsContext): + pass + + + # Enter a parse tree produced by CoreDSL2Parser#section_always. + def enterSection_always(self, ctx:CoreDSL2Parser.Section_alwaysContext): + pass + + # Exit a parse tree produced by CoreDSL2Parser#section_always. + def exitSection_always(self, ctx:CoreDSL2Parser.Section_alwaysContext): + pass + + + # Enter a parse tree produced by CoreDSL2Parser#always_block. + def enterAlways_block(self, ctx:CoreDSL2Parser.Always_blockContext): + pass + + # Exit a parse tree produced by CoreDSL2Parser#always_block. + def exitAlways_block(self, ctx:CoreDSL2Parser.Always_blockContext): + pass + + + # Enter a parse tree produced by CoreDSL2Parser#instruction. + def enterInstruction(self, ctx:CoreDSL2Parser.InstructionContext): + pass + + # Exit a parse tree produced by CoreDSL2Parser#instruction. + def exitInstruction(self, ctx:CoreDSL2Parser.InstructionContext): + pass + + + # Enter a parse tree produced by CoreDSL2Parser#rule_encoding. + def enterRule_encoding(self, ctx:CoreDSL2Parser.Rule_encodingContext): + pass + + # Exit a parse tree produced by CoreDSL2Parser#rule_encoding. + def exitRule_encoding(self, ctx:CoreDSL2Parser.Rule_encodingContext): + pass + + + # Enter a parse tree produced by CoreDSL2Parser#bit_value. + def enterBit_value(self, ctx:CoreDSL2Parser.Bit_valueContext): + pass + + # Exit a parse tree produced by CoreDSL2Parser#bit_value. + def exitBit_value(self, ctx:CoreDSL2Parser.Bit_valueContext): + pass + + + # Enter a parse tree produced by CoreDSL2Parser#bit_field. + def enterBit_field(self, ctx:CoreDSL2Parser.Bit_fieldContext): + pass + + # Exit a parse tree produced by CoreDSL2Parser#bit_field. + def exitBit_field(self, ctx:CoreDSL2Parser.Bit_fieldContext): + pass + + + # Enter a parse tree produced by CoreDSL2Parser#function_definition. + def enterFunction_definition(self, ctx:CoreDSL2Parser.Function_definitionContext): + pass + + # Exit a parse tree produced by CoreDSL2Parser#function_definition. + def exitFunction_definition(self, ctx:CoreDSL2Parser.Function_definitionContext): + pass + + + # Enter a parse tree produced by CoreDSL2Parser#parameter_list. + def enterParameter_list(self, ctx:CoreDSL2Parser.Parameter_listContext): + pass + + # Exit a parse tree produced by CoreDSL2Parser#parameter_list. + def exitParameter_list(self, ctx:CoreDSL2Parser.Parameter_listContext): + pass + + + # Enter a parse tree produced by CoreDSL2Parser#parameter_declaration. + def enterParameter_declaration(self, ctx:CoreDSL2Parser.Parameter_declarationContext): + pass + + # Exit a parse tree produced by CoreDSL2Parser#parameter_declaration. + def exitParameter_declaration(self, ctx:CoreDSL2Parser.Parameter_declarationContext): + pass + + + # Enter a parse tree produced by CoreDSL2Parser#block_statement. + def enterBlock_statement(self, ctx:CoreDSL2Parser.Block_statementContext): + pass + + # Exit a parse tree produced by CoreDSL2Parser#block_statement. + def exitBlock_statement(self, ctx:CoreDSL2Parser.Block_statementContext): + pass + + + # Enter a parse tree produced by CoreDSL2Parser#procedure_call. + def enterProcedure_call(self, ctx:CoreDSL2Parser.Procedure_callContext): + pass + + # Exit a parse tree produced by CoreDSL2Parser#procedure_call. + def exitProcedure_call(self, ctx:CoreDSL2Parser.Procedure_callContext): + pass + + + # Enter a parse tree produced by CoreDSL2Parser#if_statement. + def enterIf_statement(self, ctx:CoreDSL2Parser.If_statementContext): + pass + + # Exit a parse tree produced by CoreDSL2Parser#if_statement. + def exitIf_statement(self, ctx:CoreDSL2Parser.If_statementContext): + pass + + + # Enter a parse tree produced by CoreDSL2Parser#for_statement. + def enterFor_statement(self, ctx:CoreDSL2Parser.For_statementContext): + pass + + # Exit a parse tree produced by CoreDSL2Parser#for_statement. + def exitFor_statement(self, ctx:CoreDSL2Parser.For_statementContext): + pass + + + # Enter a parse tree produced by CoreDSL2Parser#while_statement. + def enterWhile_statement(self, ctx:CoreDSL2Parser.While_statementContext): + pass + + # Exit a parse tree produced by CoreDSL2Parser#while_statement. + def exitWhile_statement(self, ctx:CoreDSL2Parser.While_statementContext): + pass + + + # Enter a parse tree produced by CoreDSL2Parser#do_statement. + def enterDo_statement(self, ctx:CoreDSL2Parser.Do_statementContext): + pass + + # Exit a parse tree produced by CoreDSL2Parser#do_statement. + def exitDo_statement(self, ctx:CoreDSL2Parser.Do_statementContext): + pass + + + # Enter a parse tree produced by CoreDSL2Parser#switch_statement. + def enterSwitch_statement(self, ctx:CoreDSL2Parser.Switch_statementContext): + pass + + # Exit a parse tree produced by CoreDSL2Parser#switch_statement. + def exitSwitch_statement(self, ctx:CoreDSL2Parser.Switch_statementContext): + pass + + + # Enter a parse tree produced by CoreDSL2Parser#return_statement. + def enterReturn_statement(self, ctx:CoreDSL2Parser.Return_statementContext): + pass + + # Exit a parse tree produced by CoreDSL2Parser#return_statement. + def exitReturn_statement(self, ctx:CoreDSL2Parser.Return_statementContext): + pass + + + # Enter a parse tree produced by CoreDSL2Parser#break_statement. + def enterBreak_statement(self, ctx:CoreDSL2Parser.Break_statementContext): + pass + + # Exit a parse tree produced by CoreDSL2Parser#break_statement. + def exitBreak_statement(self, ctx:CoreDSL2Parser.Break_statementContext): + pass + + + # Enter a parse tree produced by CoreDSL2Parser#continue_statement. + def enterContinue_statement(self, ctx:CoreDSL2Parser.Continue_statementContext): + pass + + # Exit a parse tree produced by CoreDSL2Parser#continue_statement. + def exitContinue_statement(self, ctx:CoreDSL2Parser.Continue_statementContext): + pass + + + # Enter a parse tree produced by CoreDSL2Parser#spawn_statement. + def enterSpawn_statement(self, ctx:CoreDSL2Parser.Spawn_statementContext): + pass + + # Exit a parse tree produced by CoreDSL2Parser#spawn_statement. + def exitSpawn_statement(self, ctx:CoreDSL2Parser.Spawn_statementContext): + pass + + + # Enter a parse tree produced by CoreDSL2Parser#expression_statement. + def enterExpression_statement(self, ctx:CoreDSL2Parser.Expression_statementContext): + pass + + # Exit a parse tree produced by CoreDSL2Parser#expression_statement. + def exitExpression_statement(self, ctx:CoreDSL2Parser.Expression_statementContext): + pass + + + # Enter a parse tree produced by CoreDSL2Parser#switch_block_statement_group. + def enterSwitch_block_statement_group(self, ctx:CoreDSL2Parser.Switch_block_statement_groupContext): + pass + + # Exit a parse tree produced by CoreDSL2Parser#switch_block_statement_group. + def exitSwitch_block_statement_group(self, ctx:CoreDSL2Parser.Switch_block_statement_groupContext): + pass + + + # Enter a parse tree produced by CoreDSL2Parser#switch_label. + def enterSwitch_label(self, ctx:CoreDSL2Parser.Switch_labelContext): + pass + + # Exit a parse tree produced by CoreDSL2Parser#switch_label. + def exitSwitch_label(self, ctx:CoreDSL2Parser.Switch_labelContext): + pass + + + # Enter a parse tree produced by CoreDSL2Parser#block. + def enterBlock(self, ctx:CoreDSL2Parser.BlockContext): + pass + + # Exit a parse tree produced by CoreDSL2Parser#block. + def exitBlock(self, ctx:CoreDSL2Parser.BlockContext): + pass + + + # Enter a parse tree produced by CoreDSL2Parser#block_item. + def enterBlock_item(self, ctx:CoreDSL2Parser.Block_itemContext): + pass + + # Exit a parse tree produced by CoreDSL2Parser#block_item. + def exitBlock_item(self, ctx:CoreDSL2Parser.Block_itemContext): + pass + + + # Enter a parse tree produced by CoreDSL2Parser#for_condition. + def enterFor_condition(self, ctx:CoreDSL2Parser.For_conditionContext): + pass + + # Exit a parse tree produced by CoreDSL2Parser#for_condition. + def exitFor_condition(self, ctx:CoreDSL2Parser.For_conditionContext): + pass + + + # Enter a parse tree produced by CoreDSL2Parser#declaration. + def enterDeclaration(self, ctx:CoreDSL2Parser.DeclarationContext): + pass + + # Exit a parse tree produced by CoreDSL2Parser#declaration. + def exitDeclaration(self, ctx:CoreDSL2Parser.DeclarationContext): + pass + + + # Enter a parse tree produced by CoreDSL2Parser#type_specifier. + def enterType_specifier(self, ctx:CoreDSL2Parser.Type_specifierContext): + pass + + # Exit a parse tree produced by CoreDSL2Parser#type_specifier. + def exitType_specifier(self, ctx:CoreDSL2Parser.Type_specifierContext): + pass + + + # Enter a parse tree produced by CoreDSL2Parser#integer_type. + def enterInteger_type(self, ctx:CoreDSL2Parser.Integer_typeContext): + pass + + # Exit a parse tree produced by CoreDSL2Parser#integer_type. + def exitInteger_type(self, ctx:CoreDSL2Parser.Integer_typeContext): + pass + + + # Enter a parse tree produced by CoreDSL2Parser#float_type. + def enterFloat_type(self, ctx:CoreDSL2Parser.Float_typeContext): + pass + + # Exit a parse tree produced by CoreDSL2Parser#float_type. + def exitFloat_type(self, ctx:CoreDSL2Parser.Float_typeContext): + pass + + + # Enter a parse tree produced by CoreDSL2Parser#bool_type. + def enterBool_type(self, ctx:CoreDSL2Parser.Bool_typeContext): + pass + + # Exit a parse tree produced by CoreDSL2Parser#bool_type. + def exitBool_type(self, ctx:CoreDSL2Parser.Bool_typeContext): + pass + + + # Enter a parse tree produced by CoreDSL2Parser#void_type. + def enterVoid_type(self, ctx:CoreDSL2Parser.Void_typeContext): + pass + + # Exit a parse tree produced by CoreDSL2Parser#void_type. + def exitVoid_type(self, ctx:CoreDSL2Parser.Void_typeContext): + pass + + + # Enter a parse tree produced by CoreDSL2Parser#composite_declaration. + def enterComposite_declaration(self, ctx:CoreDSL2Parser.Composite_declarationContext): + pass + + # Exit a parse tree produced by CoreDSL2Parser#composite_declaration. + def exitComposite_declaration(self, ctx:CoreDSL2Parser.Composite_declarationContext): + pass + + + # Enter a parse tree produced by CoreDSL2Parser#composite_reference. + def enterComposite_reference(self, ctx:CoreDSL2Parser.Composite_referenceContext): + pass + + # Exit a parse tree produced by CoreDSL2Parser#composite_reference. + def exitComposite_reference(self, ctx:CoreDSL2Parser.Composite_referenceContext): + pass + + + # Enter a parse tree produced by CoreDSL2Parser#enum_declaration. + def enterEnum_declaration(self, ctx:CoreDSL2Parser.Enum_declarationContext): + pass + + # Exit a parse tree produced by CoreDSL2Parser#enum_declaration. + def exitEnum_declaration(self, ctx:CoreDSL2Parser.Enum_declarationContext): + pass + + + # Enter a parse tree produced by CoreDSL2Parser#enum_reference. + def enterEnum_reference(self, ctx:CoreDSL2Parser.Enum_referenceContext): + pass + + # Exit a parse tree produced by CoreDSL2Parser#enum_reference. + def exitEnum_reference(self, ctx:CoreDSL2Parser.Enum_referenceContext): + pass + + + # Enter a parse tree produced by CoreDSL2Parser#integer_signedness. + def enterInteger_signedness(self, ctx:CoreDSL2Parser.Integer_signednessContext): + pass + + # Exit a parse tree produced by CoreDSL2Parser#integer_signedness. + def exitInteger_signedness(self, ctx:CoreDSL2Parser.Integer_signednessContext): + pass + + + # Enter a parse tree produced by CoreDSL2Parser#integer_shorthand. + def enterInteger_shorthand(self, ctx:CoreDSL2Parser.Integer_shorthandContext): + pass + + # Exit a parse tree produced by CoreDSL2Parser#integer_shorthand. + def exitInteger_shorthand(self, ctx:CoreDSL2Parser.Integer_shorthandContext): + pass + + + # Enter a parse tree produced by CoreDSL2Parser#float_shorthand. + def enterFloat_shorthand(self, ctx:CoreDSL2Parser.Float_shorthandContext): + pass + + # Exit a parse tree produced by CoreDSL2Parser#float_shorthand. + def exitFloat_shorthand(self, ctx:CoreDSL2Parser.Float_shorthandContext): + pass + + + # Enter a parse tree produced by CoreDSL2Parser#attribute. + def enterAttribute(self, ctx:CoreDSL2Parser.AttributeContext): + pass + + # Exit a parse tree produced by CoreDSL2Parser#attribute. + def exitAttribute(self, ctx:CoreDSL2Parser.AttributeContext): + pass + + + # Enter a parse tree produced by CoreDSL2Parser#bit_size_specifier. + def enterBit_size_specifier(self, ctx:CoreDSL2Parser.Bit_size_specifierContext): + pass + + # Exit a parse tree produced by CoreDSL2Parser#bit_size_specifier. + def exitBit_size_specifier(self, ctx:CoreDSL2Parser.Bit_size_specifierContext): + pass + + + # Enter a parse tree produced by CoreDSL2Parser#enumerator_list. + def enterEnumerator_list(self, ctx:CoreDSL2Parser.Enumerator_listContext): + pass + + # Exit a parse tree produced by CoreDSL2Parser#enumerator_list. + def exitEnumerator_list(self, ctx:CoreDSL2Parser.Enumerator_listContext): + pass + + + # Enter a parse tree produced by CoreDSL2Parser#enumerator. + def enterEnumerator(self, ctx:CoreDSL2Parser.EnumeratorContext): + pass + + # Exit a parse tree produced by CoreDSL2Parser#enumerator. + def exitEnumerator(self, ctx:CoreDSL2Parser.EnumeratorContext): + pass + + + # Enter a parse tree produced by CoreDSL2Parser#struct_declaration. + def enterStruct_declaration(self, ctx:CoreDSL2Parser.Struct_declarationContext): + pass + + # Exit a parse tree produced by CoreDSL2Parser#struct_declaration. + def exitStruct_declaration(self, ctx:CoreDSL2Parser.Struct_declarationContext): + pass + + + # Enter a parse tree produced by CoreDSL2Parser#struct_declaration_specifier. + def enterStruct_declaration_specifier(self, ctx:CoreDSL2Parser.Struct_declaration_specifierContext): + pass + + # Exit a parse tree produced by CoreDSL2Parser#struct_declaration_specifier. + def exitStruct_declaration_specifier(self, ctx:CoreDSL2Parser.Struct_declaration_specifierContext): + pass + + + # Enter a parse tree produced by CoreDSL2Parser#declarator. + def enterDeclarator(self, ctx:CoreDSL2Parser.DeclaratorContext): + pass + + # Exit a parse tree produced by CoreDSL2Parser#declarator. + def exitDeclarator(self, ctx:CoreDSL2Parser.DeclaratorContext): + pass + + + # Enter a parse tree produced by CoreDSL2Parser#initializer. + def enterInitializer(self, ctx:CoreDSL2Parser.InitializerContext): + pass + + # Exit a parse tree produced by CoreDSL2Parser#initializer. + def exitInitializer(self, ctx:CoreDSL2Parser.InitializerContext): + pass + + + # Enter a parse tree produced by CoreDSL2Parser#initializerList. + def enterInitializerList(self, ctx:CoreDSL2Parser.InitializerListContext): + pass + + # Exit a parse tree produced by CoreDSL2Parser#initializerList. + def exitInitializerList(self, ctx:CoreDSL2Parser.InitializerListContext): + pass + + + # Enter a parse tree produced by CoreDSL2Parser#designated_initializer. + def enterDesignated_initializer(self, ctx:CoreDSL2Parser.Designated_initializerContext): + pass + + # Exit a parse tree produced by CoreDSL2Parser#designated_initializer. + def exitDesignated_initializer(self, ctx:CoreDSL2Parser.Designated_initializerContext): + pass + + + # Enter a parse tree produced by CoreDSL2Parser#designator. + def enterDesignator(self, ctx:CoreDSL2Parser.DesignatorContext): + pass + + # Exit a parse tree produced by CoreDSL2Parser#designator. + def exitDesignator(self, ctx:CoreDSL2Parser.DesignatorContext): + pass + + + # Enter a parse tree produced by CoreDSL2Parser#cast_expression. + def enterCast_expression(self, ctx:CoreDSL2Parser.Cast_expressionContext): + pass + + # Exit a parse tree produced by CoreDSL2Parser#cast_expression. + def exitCast_expression(self, ctx:CoreDSL2Parser.Cast_expressionContext): + pass + + + # Enter a parse tree produced by CoreDSL2Parser#binary_expression. + def enterBinary_expression(self, ctx:CoreDSL2Parser.Binary_expressionContext): + pass + + # Exit a parse tree produced by CoreDSL2Parser#binary_expression. + def exitBinary_expression(self, ctx:CoreDSL2Parser.Binary_expressionContext): + pass + + + # Enter a parse tree produced by CoreDSL2Parser#preinc_expression. + def enterPreinc_expression(self, ctx:CoreDSL2Parser.Preinc_expressionContext): + pass + + # Exit a parse tree produced by CoreDSL2Parser#preinc_expression. + def exitPreinc_expression(self, ctx:CoreDSL2Parser.Preinc_expressionContext): + pass + + + # Enter a parse tree produced by CoreDSL2Parser#conditional_expression. + def enterConditional_expression(self, ctx:CoreDSL2Parser.Conditional_expressionContext): + pass + + # Exit a parse tree produced by CoreDSL2Parser#conditional_expression. + def exitConditional_expression(self, ctx:CoreDSL2Parser.Conditional_expressionContext): + pass + + + # Enter a parse tree produced by CoreDSL2Parser#deref_expression. + def enterDeref_expression(self, ctx:CoreDSL2Parser.Deref_expressionContext): + pass + + # Exit a parse tree produced by CoreDSL2Parser#deref_expression. + def exitDeref_expression(self, ctx:CoreDSL2Parser.Deref_expressionContext): + pass + + + # Enter a parse tree produced by CoreDSL2Parser#prefix_expression. + def enterPrefix_expression(self, ctx:CoreDSL2Parser.Prefix_expressionContext): + pass + + # Exit a parse tree produced by CoreDSL2Parser#prefix_expression. + def exitPrefix_expression(self, ctx:CoreDSL2Parser.Prefix_expressionContext): + pass + + + # Enter a parse tree produced by CoreDSL2Parser#postinc_expression. + def enterPostinc_expression(self, ctx:CoreDSL2Parser.Postinc_expressionContext): + pass + + # Exit a parse tree produced by CoreDSL2Parser#postinc_expression. + def exitPostinc_expression(self, ctx:CoreDSL2Parser.Postinc_expressionContext): + pass + + + # Enter a parse tree produced by CoreDSL2Parser#concat_expression. + def enterConcat_expression(self, ctx:CoreDSL2Parser.Concat_expressionContext): + pass + + # Exit a parse tree produced by CoreDSL2Parser#concat_expression. + def exitConcat_expression(self, ctx:CoreDSL2Parser.Concat_expressionContext): + pass + + + # Enter a parse tree produced by CoreDSL2Parser#assignment_expression. + def enterAssignment_expression(self, ctx:CoreDSL2Parser.Assignment_expressionContext): + pass + + # Exit a parse tree produced by CoreDSL2Parser#assignment_expression. + def exitAssignment_expression(self, ctx:CoreDSL2Parser.Assignment_expressionContext): + pass + + + # Enter a parse tree produced by CoreDSL2Parser#method_call. + def enterMethod_call(self, ctx:CoreDSL2Parser.Method_callContext): + pass + + # Exit a parse tree produced by CoreDSL2Parser#method_call. + def exitMethod_call(self, ctx:CoreDSL2Parser.Method_callContext): + pass + + + # Enter a parse tree produced by CoreDSL2Parser#primary_expression. + def enterPrimary_expression(self, ctx:CoreDSL2Parser.Primary_expressionContext): + pass + + # Exit a parse tree produced by CoreDSL2Parser#primary_expression. + def exitPrimary_expression(self, ctx:CoreDSL2Parser.Primary_expressionContext): + pass + + + # Enter a parse tree produced by CoreDSL2Parser#slice_expression. + def enterSlice_expression(self, ctx:CoreDSL2Parser.Slice_expressionContext): + pass + + # Exit a parse tree produced by CoreDSL2Parser#slice_expression. + def exitSlice_expression(self, ctx:CoreDSL2Parser.Slice_expressionContext): + pass + + + # Enter a parse tree produced by CoreDSL2Parser#reference_expression. + def enterReference_expression(self, ctx:CoreDSL2Parser.Reference_expressionContext): + pass + + # Exit a parse tree produced by CoreDSL2Parser#reference_expression. + def exitReference_expression(self, ctx:CoreDSL2Parser.Reference_expressionContext): + pass + + + # Enter a parse tree produced by CoreDSL2Parser#constant_expression. + def enterConstant_expression(self, ctx:CoreDSL2Parser.Constant_expressionContext): + pass + + # Exit a parse tree produced by CoreDSL2Parser#constant_expression. + def exitConstant_expression(self, ctx:CoreDSL2Parser.Constant_expressionContext): + pass + + + # Enter a parse tree produced by CoreDSL2Parser#literal_expression. + def enterLiteral_expression(self, ctx:CoreDSL2Parser.Literal_expressionContext): + pass + + # Exit a parse tree produced by CoreDSL2Parser#literal_expression. + def exitLiteral_expression(self, ctx:CoreDSL2Parser.Literal_expressionContext): + pass + + + # Enter a parse tree produced by CoreDSL2Parser#parens_expression. + def enterParens_expression(self, ctx:CoreDSL2Parser.Parens_expressionContext): + pass + + # Exit a parse tree produced by CoreDSL2Parser#parens_expression. + def exitParens_expression(self, ctx:CoreDSL2Parser.Parens_expressionContext): + pass + + + # Enter a parse tree produced by CoreDSL2Parser#string_literal. + def enterString_literal(self, ctx:CoreDSL2Parser.String_literalContext): + pass + + # Exit a parse tree produced by CoreDSL2Parser#string_literal. + def exitString_literal(self, ctx:CoreDSL2Parser.String_literalContext): + pass + + + # Enter a parse tree produced by CoreDSL2Parser#constant. + def enterConstant(self, ctx:CoreDSL2Parser.ConstantContext): + pass + + # Exit a parse tree produced by CoreDSL2Parser#constant. + def exitConstant(self, ctx:CoreDSL2Parser.ConstantContext): + pass + + + # Enter a parse tree produced by CoreDSL2Parser#integer_constant. + def enterInteger_constant(self, ctx:CoreDSL2Parser.Integer_constantContext): + pass + + # Exit a parse tree produced by CoreDSL2Parser#integer_constant. + def exitInteger_constant(self, ctx:CoreDSL2Parser.Integer_constantContext): + pass + + + # Enter a parse tree produced by CoreDSL2Parser#floating_constant. + def enterFloating_constant(self, ctx:CoreDSL2Parser.Floating_constantContext): + pass + + # Exit a parse tree produced by CoreDSL2Parser#floating_constant. + def exitFloating_constant(self, ctx:CoreDSL2Parser.Floating_constantContext): + pass + + + # Enter a parse tree produced by CoreDSL2Parser#bool_constant. + def enterBool_constant(self, ctx:CoreDSL2Parser.Bool_constantContext): + pass + + # Exit a parse tree produced by CoreDSL2Parser#bool_constant. + def exitBool_constant(self, ctx:CoreDSL2Parser.Bool_constantContext): + pass + + + # Enter a parse tree produced by CoreDSL2Parser#character_constant. + def enterCharacter_constant(self, ctx:CoreDSL2Parser.Character_constantContext): + pass + + # Exit a parse tree produced by CoreDSL2Parser#character_constant. + def exitCharacter_constant(self, ctx:CoreDSL2Parser.Character_constantContext): + pass + + + # Enter a parse tree produced by CoreDSL2Parser#string_constant. + def enterString_constant(self, ctx:CoreDSL2Parser.String_constantContext): + pass + + # Exit a parse tree produced by CoreDSL2Parser#string_constant. + def exitString_constant(self, ctx:CoreDSL2Parser.String_constantContext): + pass + + + # Enter a parse tree produced by CoreDSL2Parser#double_left_bracket. + def enterDouble_left_bracket(self, ctx:CoreDSL2Parser.Double_left_bracketContext): + pass + + # Exit a parse tree produced by CoreDSL2Parser#double_left_bracket. + def exitDouble_left_bracket(self, ctx:CoreDSL2Parser.Double_left_bracketContext): + pass + + + # Enter a parse tree produced by CoreDSL2Parser#double_right_bracket. + def enterDouble_right_bracket(self, ctx:CoreDSL2Parser.Double_right_bracketContext): + pass + + # Exit a parse tree produced by CoreDSL2Parser#double_right_bracket. + def exitDouble_right_bracket(self, ctx:CoreDSL2Parser.Double_right_bracketContext): + pass + + + # Enter a parse tree produced by CoreDSL2Parser#data_types. + def enterData_types(self, ctx:CoreDSL2Parser.Data_typesContext): + pass + + # Exit a parse tree produced by CoreDSL2Parser#data_types. + def exitData_types(self, ctx:CoreDSL2Parser.Data_typesContext): + pass + + + # Enter a parse tree produced by CoreDSL2Parser#type_qualifier. + def enterType_qualifier(self, ctx:CoreDSL2Parser.Type_qualifierContext): + pass + + # Exit a parse tree produced by CoreDSL2Parser#type_qualifier. + def exitType_qualifier(self, ctx:CoreDSL2Parser.Type_qualifierContext): + pass + + + # Enter a parse tree produced by CoreDSL2Parser#storage_class_specifier. + def enterStorage_class_specifier(self, ctx:CoreDSL2Parser.Storage_class_specifierContext): + pass + + # Exit a parse tree produced by CoreDSL2Parser#storage_class_specifier. + def exitStorage_class_specifier(self, ctx:CoreDSL2Parser.Storage_class_specifierContext): + pass + + + # Enter a parse tree produced by CoreDSL2Parser#struct_or_union. + def enterStruct_or_union(self, ctx:CoreDSL2Parser.Struct_or_unionContext): + pass + + # Exit a parse tree produced by CoreDSL2Parser#struct_or_union. + def exitStruct_or_union(self, ctx:CoreDSL2Parser.Struct_or_unionContext): + pass + + + +del CoreDSL2Parser \ No newline at end of file diff --git a/m2isar/frontends/coredsl2_set/parser_gen/CoreDSL2Parser.py b/m2isar/frontends/coredsl2_set/parser_gen/CoreDSL2Parser.py new file mode 100644 index 00000000..22021ef8 --- /dev/null +++ b/m2isar/frontends/coredsl2_set/parser_gen/CoreDSL2Parser.py @@ -0,0 +1,6378 @@ +# Generated from CoreDSL2.g4 by ANTLR 4.13.1 +# encoding: utf-8 +from antlr4 import * +from io import StringIO +import sys +if sys.version_info[1] > 5: + from typing import TextIO +else: + from typing.io import TextIO + +def serializedATN(): + return [ + 4,1,102,797,2,0,7,0,2,1,7,1,2,2,7,2,2,3,7,3,2,4,7,4,2,5,7,5,2,6, + 7,6,2,7,7,7,2,8,7,8,2,9,7,9,2,10,7,10,2,11,7,11,2,12,7,12,2,13,7, + 13,2,14,7,14,2,15,7,15,2,16,7,16,2,17,7,17,2,18,7,18,2,19,7,19,2, + 20,7,20,2,21,7,21,2,22,7,22,2,23,7,23,2,24,7,24,2,25,7,25,2,26,7, + 26,2,27,7,27,2,28,7,28,2,29,7,29,2,30,7,30,2,31,7,31,2,32,7,32,2, + 33,7,33,2,34,7,34,2,35,7,35,2,36,7,36,2,37,7,37,2,38,7,38,2,39,7, + 39,2,40,7,40,2,41,7,41,2,42,7,42,2,43,7,43,2,44,7,44,2,45,7,45,2, + 46,7,46,2,47,7,47,2,48,7,48,1,0,5,0,100,8,0,10,0,12,0,103,9,0,1, + 0,4,0,106,8,0,11,0,12,0,107,1,1,1,1,1,1,1,2,1,2,1,2,1,2,1,2,1,2, + 5,2,119,8,2,10,2,12,2,122,9,2,3,2,124,8,2,1,2,1,2,4,2,128,8,2,11, + 2,12,2,129,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,5,2,140,8,2,10,2,12,2, + 143,9,2,3,2,145,8,2,1,2,1,2,5,2,149,8,2,10,2,12,2,152,9,2,1,2,3, + 2,155,8,2,1,3,1,3,1,3,1,3,1,3,1,3,4,3,163,8,3,11,3,12,3,164,1,3, + 1,3,1,3,1,3,1,3,5,3,172,8,3,10,3,12,3,175,9,3,1,3,1,3,1,3,5,3,180, + 8,3,10,3,12,3,183,9,3,1,3,1,3,5,3,187,8,3,10,3,12,3,190,9,3,1,3, + 1,3,1,3,5,3,195,8,3,10,3,12,3,198,9,3,1,3,1,3,4,3,202,8,3,11,3,12, + 3,203,1,3,1,3,3,3,208,8,3,1,4,1,4,5,4,212,8,4,10,4,12,4,215,9,4, + 1,4,1,4,1,5,1,5,5,5,221,8,5,10,5,12,5,224,9,5,1,5,1,5,1,5,1,5,1, + 5,1,5,5,5,232,8,5,10,5,12,5,235,9,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5, + 1,5,1,5,3,5,246,8,5,1,5,3,5,249,8,5,1,5,1,5,1,5,1,5,1,5,1,6,1,6, + 1,6,5,6,259,8,6,10,6,12,6,262,9,6,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1, + 7,3,7,272,8,7,1,8,1,8,1,8,1,8,1,8,3,8,279,8,8,1,8,1,8,5,8,283,8, + 8,10,8,12,8,286,9,8,1,8,1,8,1,8,1,8,1,8,1,8,3,8,294,8,8,1,8,1,8, + 5,8,298,8,8,10,8,12,8,301,9,8,1,8,1,8,3,8,305,8,8,3,8,307,8,8,1, + 9,1,9,1,9,5,9,312,8,9,10,9,12,9,315,9,9,1,10,1,10,3,10,319,8,10, + 1,11,1,11,1,11,1,11,1,11,1,11,5,11,327,8,11,10,11,12,11,330,9,11, + 3,11,332,8,11,1,11,1,11,1,11,1,11,1,11,1,11,1,11,1,11,1,11,1,11, + 1,11,1,11,1,11,1,11,5,11,348,8,11,10,11,12,11,351,9,11,1,11,1,11, + 3,11,355,8,11,1,11,1,11,1,11,1,11,1,11,1,11,1,11,1,11,1,11,1,11, + 1,11,1,11,1,11,1,11,1,11,1,11,1,11,1,11,1,11,1,11,1,11,1,11,1,11, + 1,11,1,11,1,11,5,11,383,8,11,10,11,12,11,386,9,11,1,11,5,11,389, + 8,11,10,11,12,11,392,9,11,1,11,1,11,1,11,1,11,3,11,398,8,11,1,11, + 1,11,1,11,1,11,1,11,1,11,1,11,1,11,1,11,1,11,3,11,410,8,11,1,12, + 4,12,413,8,12,11,12,12,12,414,1,12,4,12,418,8,12,11,12,12,12,419, + 1,13,1,13,1,13,1,13,1,13,1,13,3,13,428,8,13,1,14,1,14,5,14,432,8, + 14,10,14,12,14,435,9,14,1,14,1,14,1,15,1,15,3,15,441,8,15,1,16,1, + 16,3,16,445,8,16,1,16,3,16,448,8,16,1,16,3,16,451,8,16,1,16,1,16, + 1,16,1,16,5,16,457,8,16,10,16,12,16,460,9,16,3,16,462,8,16,1,17, + 1,17,1,17,5,17,467,8,17,10,17,12,17,470,9,17,1,17,1,17,1,17,1,17, + 5,17,476,8,17,10,17,12,17,479,9,17,3,17,481,8,17,1,17,1,17,1,18, + 1,18,1,18,3,18,488,8,18,1,19,1,19,1,19,1,19,1,19,1,19,3,19,496,8, + 19,1,19,1,19,1,19,1,19,1,19,1,19,3,19,504,8,19,1,19,1,19,5,19,508, + 8,19,10,19,12,19,511,9,19,1,19,1,19,1,19,1,19,1,19,1,19,1,19,3,19, + 520,8,19,1,19,1,19,1,19,3,19,525,8,19,1,19,1,19,1,19,1,19,3,19,531, + 8,19,1,20,1,20,1,21,1,21,1,22,1,22,1,23,1,23,1,23,1,23,1,23,1,23, + 1,23,1,23,5,23,547,8,23,10,23,12,23,550,9,23,1,23,1,23,3,23,554, + 8,23,1,23,1,23,1,24,1,24,1,24,1,24,1,24,1,24,1,24,1,24,1,24,3,24, + 567,8,24,1,24,1,24,1,25,1,25,1,25,5,25,574,8,25,10,25,12,25,577, + 9,25,1,26,1,26,1,26,1,26,3,26,583,8,26,1,27,1,27,1,27,1,27,5,27, + 589,8,27,10,27,12,27,592,9,27,1,27,1,27,1,28,1,28,3,28,598,8,28, + 1,29,1,29,1,29,1,29,1,29,5,29,605,8,29,10,29,12,29,608,9,29,1,29, + 5,29,611,8,29,10,29,12,29,614,9,29,1,29,1,29,3,29,618,8,29,1,30, + 1,30,1,30,1,30,3,30,624,8,30,1,30,1,30,3,30,628,8,30,1,31,1,31,3, + 31,632,8,31,1,31,1,31,1,31,3,31,637,8,31,5,31,639,8,31,10,31,12, + 31,642,9,31,1,32,4,32,645,8,32,11,32,12,32,646,1,32,1,32,1,32,1, + 33,1,33,1,33,1,33,1,33,1,33,3,33,658,8,33,1,34,1,34,1,34,1,34,1, + 34,1,34,1,34,1,34,1,34,5,34,669,8,34,10,34,12,34,672,9,34,3,34,674, + 8,34,1,34,1,34,1,34,1,34,1,34,1,34,1,34,1,34,1,34,1,34,3,34,686, + 8,34,1,34,1,34,1,34,3,34,691,8,34,1,34,1,34,1,34,1,34,1,34,1,34, + 1,34,1,34,1,34,1,34,1,34,1,34,1,34,1,34,1,34,1,34,1,34,1,34,1,34, + 1,34,1,34,1,34,1,34,1,34,1,34,1,34,1,34,1,34,1,34,1,34,1,34,1,34, + 1,34,1,34,1,34,1,34,1,34,1,34,1,34,1,34,1,34,1,34,1,34,1,34,1,34, + 1,34,1,34,3,34,740,8,34,1,34,1,34,1,34,1,34,5,34,746,8,34,10,34, + 12,34,749,9,34,1,35,1,35,1,35,4,35,754,8,35,11,35,12,35,755,1,35, + 1,35,1,35,1,35,3,35,762,8,35,1,36,1,36,1,37,1,37,1,37,1,37,1,37, + 3,37,771,8,37,1,38,1,38,1,39,1,39,1,40,1,40,1,41,1,41,1,42,1,42, + 1,43,1,43,1,43,1,44,1,44,1,44,1,45,1,45,1,46,1,46,1,47,1,47,1,48, + 1,48,1,48,0,1,68,49,0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32, + 34,36,38,40,42,44,46,48,50,52,54,56,58,60,62,64,66,68,70,72,74,76, + 78,80,82,84,86,88,90,92,94,96,0,18,1,0,41,42,1,0,43,46,1,0,47,48, + 1,0,52,53,1,0,54,55,2,0,34,35,56,57,1,0,58,59,2,0,34,34,60,61,1, + 0,56,57,1,0,62,63,2,0,36,37,64,65,1,0,66,67,2,0,50,50,73,83,1,0, + 98,99,3,0,38,39,41,48,84,84,1,0,85,86,2,0,19,19,87,88,1,0,89,90, + 880,0,101,1,0,0,0,2,109,1,0,0,0,4,154,1,0,0,0,6,207,1,0,0,0,8,209, + 1,0,0,0,10,218,1,0,0,0,12,255,1,0,0,0,14,271,1,0,0,0,16,306,1,0, + 0,0,18,308,1,0,0,0,20,316,1,0,0,0,22,409,1,0,0,0,24,412,1,0,0,0, + 26,427,1,0,0,0,28,429,1,0,0,0,30,440,1,0,0,0,32,447,1,0,0,0,34,468, + 1,0,0,0,36,484,1,0,0,0,38,530,1,0,0,0,40,532,1,0,0,0,42,534,1,0, + 0,0,44,536,1,0,0,0,46,538,1,0,0,0,48,557,1,0,0,0,50,570,1,0,0,0, + 52,582,1,0,0,0,54,584,1,0,0,0,56,597,1,0,0,0,58,599,1,0,0,0,60,627, + 1,0,0,0,62,631,1,0,0,0,64,644,1,0,0,0,66,657,1,0,0,0,68,690,1,0, + 0,0,70,761,1,0,0,0,72,763,1,0,0,0,74,770,1,0,0,0,76,772,1,0,0,0, + 78,774,1,0,0,0,80,776,1,0,0,0,82,778,1,0,0,0,84,780,1,0,0,0,86,782, + 1,0,0,0,88,785,1,0,0,0,90,788,1,0,0,0,92,790,1,0,0,0,94,792,1,0, + 0,0,96,794,1,0,0,0,98,100,3,2,1,0,99,98,1,0,0,0,100,103,1,0,0,0, + 101,99,1,0,0,0,101,102,1,0,0,0,102,105,1,0,0,0,103,101,1,0,0,0,104, + 106,3,4,2,0,105,104,1,0,0,0,106,107,1,0,0,0,107,105,1,0,0,0,107, + 108,1,0,0,0,108,1,1,0,0,0,109,110,5,1,0,0,110,111,5,99,0,0,111,3, + 1,0,0,0,112,113,5,2,0,0,113,123,5,96,0,0,114,115,5,3,0,0,115,120, + 5,96,0,0,116,117,5,4,0,0,117,119,5,96,0,0,118,116,1,0,0,0,119,122, + 1,0,0,0,120,118,1,0,0,0,120,121,1,0,0,0,121,124,1,0,0,0,122,120, + 1,0,0,0,123,114,1,0,0,0,123,124,1,0,0,0,124,125,1,0,0,0,125,127, + 5,5,0,0,126,128,3,6,3,0,127,126,1,0,0,0,128,129,1,0,0,0,129,127, + 1,0,0,0,129,130,1,0,0,0,130,131,1,0,0,0,131,132,5,6,0,0,132,155, + 1,0,0,0,133,134,5,7,0,0,134,144,5,96,0,0,135,136,5,8,0,0,136,141, + 5,96,0,0,137,138,5,4,0,0,138,140,5,96,0,0,139,137,1,0,0,0,140,143, + 1,0,0,0,141,139,1,0,0,0,141,142,1,0,0,0,142,145,1,0,0,0,143,141, + 1,0,0,0,144,135,1,0,0,0,144,145,1,0,0,0,145,146,1,0,0,0,146,150, + 5,5,0,0,147,149,3,6,3,0,148,147,1,0,0,0,149,152,1,0,0,0,150,148, + 1,0,0,0,150,151,1,0,0,0,151,153,1,0,0,0,152,150,1,0,0,0,153,155, + 5,6,0,0,154,112,1,0,0,0,154,133,1,0,0,0,155,5,1,0,0,0,156,157,5, + 9,0,0,157,162,5,5,0,0,158,163,3,34,17,0,159,160,3,68,34,0,160,161, + 5,10,0,0,161,163,1,0,0,0,162,158,1,0,0,0,162,159,1,0,0,0,163,164, + 1,0,0,0,164,162,1,0,0,0,164,165,1,0,0,0,165,166,1,0,0,0,166,167, + 5,6,0,0,167,208,1,0,0,0,168,169,5,11,0,0,169,173,5,5,0,0,170,172, + 3,16,8,0,171,170,1,0,0,0,172,175,1,0,0,0,173,171,1,0,0,0,173,174, + 1,0,0,0,174,176,1,0,0,0,175,173,1,0,0,0,176,208,5,6,0,0,177,181, + 5,12,0,0,178,180,3,46,23,0,179,178,1,0,0,0,180,183,1,0,0,0,181,179, + 1,0,0,0,181,182,1,0,0,0,182,184,1,0,0,0,183,181,1,0,0,0,184,188, + 5,5,0,0,185,187,3,10,5,0,186,185,1,0,0,0,187,190,1,0,0,0,188,186, + 1,0,0,0,188,189,1,0,0,0,189,191,1,0,0,0,190,188,1,0,0,0,191,208, + 5,6,0,0,192,196,5,13,0,0,193,195,3,46,23,0,194,193,1,0,0,0,195,198, + 1,0,0,0,196,194,1,0,0,0,196,197,1,0,0,0,197,199,1,0,0,0,198,196, + 1,0,0,0,199,201,5,5,0,0,200,202,3,8,4,0,201,200,1,0,0,0,202,203, + 1,0,0,0,203,201,1,0,0,0,203,204,1,0,0,0,204,205,1,0,0,0,205,206, + 5,6,0,0,206,208,1,0,0,0,207,156,1,0,0,0,207,168,1,0,0,0,207,177, + 1,0,0,0,207,192,1,0,0,0,208,7,1,0,0,0,209,213,5,96,0,0,210,212,3, + 46,23,0,211,210,1,0,0,0,212,215,1,0,0,0,213,211,1,0,0,0,213,214, + 1,0,0,0,214,216,1,0,0,0,215,213,1,0,0,0,216,217,3,28,14,0,217,9, + 1,0,0,0,218,222,5,96,0,0,219,221,3,46,23,0,220,219,1,0,0,0,221,224, + 1,0,0,0,222,220,1,0,0,0,222,223,1,0,0,0,223,225,1,0,0,0,224,222, + 1,0,0,0,225,226,5,5,0,0,226,227,5,14,0,0,227,228,5,15,0,0,228,233, + 3,14,7,0,229,230,5,16,0,0,230,232,3,14,7,0,231,229,1,0,0,0,232,235, + 1,0,0,0,233,231,1,0,0,0,233,234,1,0,0,0,234,236,1,0,0,0,235,233, + 1,0,0,0,236,248,5,10,0,0,237,238,5,17,0,0,238,245,5,15,0,0,239,246, + 5,99,0,0,240,241,5,5,0,0,241,242,5,99,0,0,242,243,5,4,0,0,243,244, + 5,99,0,0,244,246,5,6,0,0,245,239,1,0,0,0,245,240,1,0,0,0,246,247, + 1,0,0,0,247,249,5,10,0,0,248,237,1,0,0,0,248,249,1,0,0,0,249,250, + 1,0,0,0,250,251,5,18,0,0,251,252,5,15,0,0,252,253,3,22,11,0,253, + 254,5,6,0,0,254,11,1,0,0,0,255,260,3,14,7,0,256,257,5,16,0,0,257, + 259,3,14,7,0,258,256,1,0,0,0,259,262,1,0,0,0,260,258,1,0,0,0,260, + 261,1,0,0,0,261,13,1,0,0,0,262,260,1,0,0,0,263,272,3,76,38,0,264, + 265,5,96,0,0,265,266,5,91,0,0,266,267,3,76,38,0,267,268,5,15,0,0, + 268,269,3,76,38,0,269,270,5,92,0,0,270,272,1,0,0,0,271,263,1,0,0, + 0,271,264,1,0,0,0,272,15,1,0,0,0,273,274,5,19,0,0,274,275,3,36,18, + 0,275,276,5,96,0,0,276,278,5,20,0,0,277,279,3,18,9,0,278,277,1,0, + 0,0,278,279,1,0,0,0,279,280,1,0,0,0,280,284,5,21,0,0,281,283,3,46, + 23,0,282,281,1,0,0,0,283,286,1,0,0,0,284,282,1,0,0,0,284,285,1,0, + 0,0,285,287,1,0,0,0,286,284,1,0,0,0,287,288,5,10,0,0,288,307,1,0, + 0,0,289,290,3,36,18,0,290,291,5,96,0,0,291,293,5,20,0,0,292,294, + 3,18,9,0,293,292,1,0,0,0,293,294,1,0,0,0,294,295,1,0,0,0,295,299, + 5,21,0,0,296,298,3,46,23,0,297,296,1,0,0,0,298,301,1,0,0,0,299,297, + 1,0,0,0,299,300,1,0,0,0,300,304,1,0,0,0,301,299,1,0,0,0,302,305, + 3,28,14,0,303,305,5,10,0,0,304,302,1,0,0,0,304,303,1,0,0,0,305,307, + 1,0,0,0,306,273,1,0,0,0,306,289,1,0,0,0,307,17,1,0,0,0,308,313,3, + 20,10,0,309,310,5,4,0,0,310,312,3,20,10,0,311,309,1,0,0,0,312,315, + 1,0,0,0,313,311,1,0,0,0,313,314,1,0,0,0,314,19,1,0,0,0,315,313,1, + 0,0,0,316,318,3,36,18,0,317,319,3,58,29,0,318,317,1,0,0,0,318,319, + 1,0,0,0,319,21,1,0,0,0,320,410,3,28,14,0,321,322,5,96,0,0,322,331, + 5,20,0,0,323,328,3,68,34,0,324,325,5,4,0,0,325,327,3,68,34,0,326, + 324,1,0,0,0,327,330,1,0,0,0,328,326,1,0,0,0,328,329,1,0,0,0,329, + 332,1,0,0,0,330,328,1,0,0,0,331,323,1,0,0,0,331,332,1,0,0,0,332, + 333,1,0,0,0,333,334,5,21,0,0,334,410,5,10,0,0,335,336,5,22,0,0,336, + 337,5,20,0,0,337,338,3,68,34,0,338,339,5,21,0,0,339,349,3,22,11, + 0,340,341,5,23,0,0,341,342,5,22,0,0,342,343,5,20,0,0,343,344,3,68, + 34,0,344,345,5,21,0,0,345,346,3,22,11,0,346,348,1,0,0,0,347,340, + 1,0,0,0,348,351,1,0,0,0,349,347,1,0,0,0,349,350,1,0,0,0,350,354, + 1,0,0,0,351,349,1,0,0,0,352,353,5,23,0,0,353,355,3,22,11,0,354,352, + 1,0,0,0,354,355,1,0,0,0,355,410,1,0,0,0,356,357,5,24,0,0,357,358, + 5,20,0,0,358,359,3,32,16,0,359,360,5,21,0,0,360,361,3,22,11,0,361, + 410,1,0,0,0,362,363,5,25,0,0,363,364,5,20,0,0,364,365,3,68,34,0, + 365,366,5,21,0,0,366,367,3,22,11,0,367,410,1,0,0,0,368,369,5,26, + 0,0,369,370,3,22,11,0,370,371,5,25,0,0,371,372,5,20,0,0,372,373, + 3,68,34,0,373,374,5,21,0,0,374,375,5,10,0,0,375,410,1,0,0,0,376, + 377,5,27,0,0,377,378,5,20,0,0,378,379,3,68,34,0,379,380,5,21,0,0, + 380,384,5,5,0,0,381,383,3,24,12,0,382,381,1,0,0,0,383,386,1,0,0, + 0,384,382,1,0,0,0,384,385,1,0,0,0,385,390,1,0,0,0,386,384,1,0,0, + 0,387,389,3,26,13,0,388,387,1,0,0,0,389,392,1,0,0,0,390,388,1,0, + 0,0,390,391,1,0,0,0,391,393,1,0,0,0,392,390,1,0,0,0,393,394,5,6, + 0,0,394,410,1,0,0,0,395,397,5,28,0,0,396,398,3,68,34,0,397,396,1, + 0,0,0,397,398,1,0,0,0,398,399,1,0,0,0,399,410,5,10,0,0,400,401,5, + 29,0,0,401,410,5,10,0,0,402,403,5,30,0,0,403,410,5,10,0,0,404,405, + 5,31,0,0,405,410,3,22,11,0,406,407,3,68,34,0,407,408,5,10,0,0,408, + 410,1,0,0,0,409,320,1,0,0,0,409,321,1,0,0,0,409,335,1,0,0,0,409, + 356,1,0,0,0,409,362,1,0,0,0,409,368,1,0,0,0,409,376,1,0,0,0,409, + 395,1,0,0,0,409,400,1,0,0,0,409,402,1,0,0,0,409,404,1,0,0,0,409, + 406,1,0,0,0,410,23,1,0,0,0,411,413,3,26,13,0,412,411,1,0,0,0,413, + 414,1,0,0,0,414,412,1,0,0,0,414,415,1,0,0,0,415,417,1,0,0,0,416, + 418,3,22,11,0,417,416,1,0,0,0,418,419,1,0,0,0,419,417,1,0,0,0,419, + 420,1,0,0,0,420,25,1,0,0,0,421,422,5,32,0,0,422,423,3,68,34,0,423, + 424,5,15,0,0,424,428,1,0,0,0,425,426,5,33,0,0,426,428,5,15,0,0,427, + 421,1,0,0,0,427,425,1,0,0,0,428,27,1,0,0,0,429,433,5,5,0,0,430,432, + 3,30,15,0,431,430,1,0,0,0,432,435,1,0,0,0,433,431,1,0,0,0,433,434, + 1,0,0,0,434,436,1,0,0,0,435,433,1,0,0,0,436,437,5,6,0,0,437,29,1, + 0,0,0,438,441,3,22,11,0,439,441,3,34,17,0,440,438,1,0,0,0,440,439, + 1,0,0,0,441,31,1,0,0,0,442,448,3,34,17,0,443,445,3,68,34,0,444,443, + 1,0,0,0,444,445,1,0,0,0,445,446,1,0,0,0,446,448,5,10,0,0,447,442, + 1,0,0,0,447,444,1,0,0,0,448,450,1,0,0,0,449,451,3,68,34,0,450,449, + 1,0,0,0,450,451,1,0,0,0,451,452,1,0,0,0,452,461,5,10,0,0,453,458, + 3,68,34,0,454,455,5,4,0,0,455,457,3,68,34,0,456,454,1,0,0,0,457, + 460,1,0,0,0,458,456,1,0,0,0,458,459,1,0,0,0,459,462,1,0,0,0,460, + 458,1,0,0,0,461,453,1,0,0,0,461,462,1,0,0,0,462,33,1,0,0,0,463,467, + 3,94,47,0,464,467,3,92,46,0,465,467,3,46,23,0,466,463,1,0,0,0,466, + 464,1,0,0,0,466,465,1,0,0,0,467,470,1,0,0,0,468,466,1,0,0,0,468, + 469,1,0,0,0,469,471,1,0,0,0,470,468,1,0,0,0,471,480,3,36,18,0,472, + 477,3,58,29,0,473,474,5,4,0,0,474,476,3,58,29,0,475,473,1,0,0,0, + 476,479,1,0,0,0,477,475,1,0,0,0,477,478,1,0,0,0,478,481,1,0,0,0, + 479,477,1,0,0,0,480,472,1,0,0,0,480,481,1,0,0,0,481,482,1,0,0,0, + 482,483,5,10,0,0,483,35,1,0,0,0,484,487,3,38,19,0,485,488,5,34,0, + 0,486,488,5,35,0,0,487,485,1,0,0,0,487,486,1,0,0,0,487,488,1,0,0, + 0,488,37,1,0,0,0,489,495,3,40,20,0,490,496,3,42,21,0,491,492,5,36, + 0,0,492,493,3,70,35,0,493,494,5,37,0,0,494,496,1,0,0,0,495,490,1, + 0,0,0,495,491,1,0,0,0,496,531,1,0,0,0,497,531,3,42,21,0,498,531, + 3,44,22,0,499,531,5,38,0,0,500,531,5,39,0,0,501,503,3,96,48,0,502, + 504,5,96,0,0,503,502,1,0,0,0,503,504,1,0,0,0,504,505,1,0,0,0,505, + 509,5,5,0,0,506,508,3,54,27,0,507,506,1,0,0,0,508,511,1,0,0,0,509, + 507,1,0,0,0,509,510,1,0,0,0,510,512,1,0,0,0,511,509,1,0,0,0,512, + 513,5,6,0,0,513,531,1,0,0,0,514,515,3,96,48,0,515,516,5,96,0,0,516, + 531,1,0,0,0,517,519,5,40,0,0,518,520,5,96,0,0,519,518,1,0,0,0,519, + 520,1,0,0,0,520,521,1,0,0,0,521,522,5,5,0,0,522,524,3,50,25,0,523, + 525,5,4,0,0,524,523,1,0,0,0,524,525,1,0,0,0,525,526,1,0,0,0,526, + 527,5,6,0,0,527,531,1,0,0,0,528,529,5,40,0,0,529,531,5,96,0,0,530, + 489,1,0,0,0,530,497,1,0,0,0,530,498,1,0,0,0,530,499,1,0,0,0,530, + 500,1,0,0,0,530,501,1,0,0,0,530,514,1,0,0,0,530,517,1,0,0,0,530, + 528,1,0,0,0,531,39,1,0,0,0,532,533,7,0,0,0,533,41,1,0,0,0,534,535, + 7,1,0,0,535,43,1,0,0,0,536,537,7,2,0,0,537,45,1,0,0,0,538,539,5, + 49,0,0,539,553,5,96,0,0,540,541,5,50,0,0,541,554,3,68,34,0,542,543, + 5,20,0,0,543,548,3,68,34,0,544,545,5,4,0,0,545,547,3,68,34,0,546, + 544,1,0,0,0,547,550,1,0,0,0,548,546,1,0,0,0,548,549,1,0,0,0,549, + 551,1,0,0,0,550,548,1,0,0,0,551,552,5,21,0,0,552,554,1,0,0,0,553, + 540,1,0,0,0,553,542,1,0,0,0,553,554,1,0,0,0,554,555,1,0,0,0,555, + 556,5,51,0,0,556,47,1,0,0,0,557,558,5,36,0,0,558,566,3,70,35,0,559, + 560,5,4,0,0,560,561,3,70,35,0,561,562,5,4,0,0,562,563,3,70,35,0, + 563,564,5,4,0,0,564,565,3,70,35,0,565,567,1,0,0,0,566,559,1,0,0, + 0,566,567,1,0,0,0,567,568,1,0,0,0,568,569,5,37,0,0,569,49,1,0,0, + 0,570,575,3,52,26,0,571,572,5,4,0,0,572,574,3,52,26,0,573,571,1, + 0,0,0,574,577,1,0,0,0,575,573,1,0,0,0,575,576,1,0,0,0,576,51,1,0, + 0,0,577,575,1,0,0,0,578,583,5,96,0,0,579,580,5,96,0,0,580,581,5, + 50,0,0,581,583,3,68,34,0,582,578,1,0,0,0,582,579,1,0,0,0,583,53, + 1,0,0,0,584,585,3,56,28,0,585,590,3,58,29,0,586,587,5,4,0,0,587, + 589,3,58,29,0,588,586,1,0,0,0,589,592,1,0,0,0,590,588,1,0,0,0,590, + 591,1,0,0,0,591,593,1,0,0,0,592,590,1,0,0,0,593,594,5,10,0,0,594, + 55,1,0,0,0,595,598,3,36,18,0,596,598,3,92,46,0,597,595,1,0,0,0,597, + 596,1,0,0,0,598,57,1,0,0,0,599,606,5,96,0,0,600,601,5,91,0,0,601, + 602,3,68,34,0,602,603,5,92,0,0,603,605,1,0,0,0,604,600,1,0,0,0,605, + 608,1,0,0,0,606,604,1,0,0,0,606,607,1,0,0,0,607,612,1,0,0,0,608, + 606,1,0,0,0,609,611,3,46,23,0,610,609,1,0,0,0,611,614,1,0,0,0,612, + 610,1,0,0,0,612,613,1,0,0,0,613,617,1,0,0,0,614,612,1,0,0,0,615, + 616,5,50,0,0,616,618,3,60,30,0,617,615,1,0,0,0,617,618,1,0,0,0,618, + 59,1,0,0,0,619,628,3,68,34,0,620,621,5,5,0,0,621,623,3,62,31,0,622, + 624,5,4,0,0,623,622,1,0,0,0,623,624,1,0,0,0,624,625,1,0,0,0,625, + 626,5,6,0,0,626,628,1,0,0,0,627,619,1,0,0,0,627,620,1,0,0,0,628, + 61,1,0,0,0,629,632,3,64,32,0,630,632,3,60,30,0,631,629,1,0,0,0,631, + 630,1,0,0,0,632,640,1,0,0,0,633,636,5,4,0,0,634,637,3,64,32,0,635, + 637,3,60,30,0,636,634,1,0,0,0,636,635,1,0,0,0,637,639,1,0,0,0,638, + 633,1,0,0,0,639,642,1,0,0,0,640,638,1,0,0,0,640,641,1,0,0,0,641, + 63,1,0,0,0,642,640,1,0,0,0,643,645,3,66,33,0,644,643,1,0,0,0,645, + 646,1,0,0,0,646,644,1,0,0,0,646,647,1,0,0,0,647,648,1,0,0,0,648, + 649,5,50,0,0,649,650,3,60,30,0,650,65,1,0,0,0,651,652,5,91,0,0,652, + 653,3,68,34,0,653,654,5,92,0,0,654,658,1,0,0,0,655,656,5,52,0,0, + 656,658,5,96,0,0,657,651,1,0,0,0,657,655,1,0,0,0,658,67,1,0,0,0, + 659,660,6,34,-1,0,660,691,3,70,35,0,661,662,7,3,0,0,662,691,5,96, + 0,0,663,664,5,96,0,0,664,673,5,20,0,0,665,670,3,68,34,0,666,667, + 5,4,0,0,667,669,3,68,34,0,668,666,1,0,0,0,669,672,1,0,0,0,670,668, + 1,0,0,0,670,671,1,0,0,0,671,674,1,0,0,0,672,670,1,0,0,0,673,665, + 1,0,0,0,673,674,1,0,0,0,674,675,1,0,0,0,675,691,5,21,0,0,676,677, + 7,4,0,0,677,691,3,68,34,17,678,679,7,5,0,0,679,691,3,68,34,16,680, + 681,7,6,0,0,681,691,3,68,34,15,682,685,5,20,0,0,683,686,3,36,18, + 0,684,686,3,40,20,0,685,683,1,0,0,0,685,684,1,0,0,0,686,687,1,0, + 0,0,687,688,5,21,0,0,688,689,3,68,34,14,689,691,1,0,0,0,690,659, + 1,0,0,0,690,661,1,0,0,0,690,663,1,0,0,0,690,676,1,0,0,0,690,678, + 1,0,0,0,690,680,1,0,0,0,690,682,1,0,0,0,691,747,1,0,0,0,692,693, + 10,13,0,0,693,694,7,7,0,0,694,746,3,68,34,14,695,696,10,12,0,0,696, + 697,7,8,0,0,697,746,3,68,34,13,698,699,10,11,0,0,699,700,7,9,0,0, + 700,746,3,68,34,12,701,702,10,10,0,0,702,703,7,10,0,0,703,746,3, + 68,34,11,704,705,10,9,0,0,705,706,7,11,0,0,706,746,3,68,34,10,707, + 708,10,8,0,0,708,709,5,35,0,0,709,746,3,68,34,9,710,711,10,7,0,0, + 711,712,5,68,0,0,712,746,3,68,34,8,713,714,10,6,0,0,714,715,5,69, + 0,0,715,746,3,68,34,7,716,717,10,5,0,0,717,718,5,70,0,0,718,746, + 3,68,34,6,719,720,10,4,0,0,720,721,5,71,0,0,721,746,3,68,34,5,722, + 723,10,3,0,0,723,724,5,16,0,0,724,746,3,68,34,4,725,726,10,2,0,0, + 726,727,5,72,0,0,727,728,3,68,34,0,728,729,5,15,0,0,729,730,3,68, + 34,2,730,746,1,0,0,0,731,732,10,1,0,0,732,733,7,12,0,0,733,746,3, + 68,34,1,734,735,10,20,0,0,735,736,5,91,0,0,736,739,3,68,34,0,737, + 738,5,15,0,0,738,740,3,68,34,0,739,737,1,0,0,0,739,740,1,0,0,0,740, + 741,1,0,0,0,741,742,5,92,0,0,742,746,1,0,0,0,743,744,10,18,0,0,744, + 746,7,4,0,0,745,692,1,0,0,0,745,695,1,0,0,0,745,698,1,0,0,0,745, + 701,1,0,0,0,745,704,1,0,0,0,745,707,1,0,0,0,745,710,1,0,0,0,745, + 713,1,0,0,0,745,716,1,0,0,0,745,719,1,0,0,0,745,722,1,0,0,0,745, + 725,1,0,0,0,745,731,1,0,0,0,745,734,1,0,0,0,745,743,1,0,0,0,746, + 749,1,0,0,0,747,745,1,0,0,0,747,748,1,0,0,0,748,69,1,0,0,0,749,747, + 1,0,0,0,750,762,5,96,0,0,751,762,3,74,37,0,752,754,3,72,36,0,753, + 752,1,0,0,0,754,755,1,0,0,0,755,753,1,0,0,0,755,756,1,0,0,0,756, + 762,1,0,0,0,757,758,5,20,0,0,758,759,3,68,34,0,759,760,5,21,0,0, + 760,762,1,0,0,0,761,750,1,0,0,0,761,751,1,0,0,0,761,753,1,0,0,0, + 761,757,1,0,0,0,762,71,1,0,0,0,763,764,7,13,0,0,764,73,1,0,0,0,765, + 771,3,76,38,0,766,771,3,78,39,0,767,771,3,82,41,0,768,771,3,84,42, + 0,769,771,3,80,40,0,770,765,1,0,0,0,770,766,1,0,0,0,770,767,1,0, + 0,0,770,768,1,0,0,0,770,769,1,0,0,0,771,75,1,0,0,0,772,773,5,95, + 0,0,773,77,1,0,0,0,774,775,5,94,0,0,775,79,1,0,0,0,776,777,5,93, + 0,0,777,81,1,0,0,0,778,779,5,97,0,0,779,83,1,0,0,0,780,781,5,99, + 0,0,781,85,1,0,0,0,782,783,5,91,0,0,783,784,5,91,0,0,784,87,1,0, + 0,0,785,786,5,92,0,0,786,787,5,92,0,0,787,89,1,0,0,0,788,789,7,14, + 0,0,789,91,1,0,0,0,790,791,7,15,0,0,791,93,1,0,0,0,792,793,7,16, + 0,0,793,95,1,0,0,0,794,795,7,17,0,0,795,97,1,0,0,0,88,101,107,120, + 123,129,141,144,150,154,162,164,173,181,188,196,203,207,213,222, + 233,245,248,260,271,278,284,293,299,304,306,313,318,328,331,349, + 354,384,390,397,409,414,419,427,433,440,444,447,450,458,461,466, + 468,477,480,487,495,503,509,519,524,530,548,553,566,575,582,590, + 597,606,612,617,623,627,631,636,640,646,657,670,673,685,690,739, + 745,747,755,761,770 + ] + +class CoreDSL2Parser ( Parser ): + + grammarFileName = "CoreDSL2.g4" + + atn = ATNDeserializer().deserialize(serializedATN()) + + decisionsToDFA = [ DFA(ds, i) for i, ds in enumerate(atn.decisionToState) ] + + sharedContextCache = PredictionContextCache() + + literalNames = [ "", "'import'", "'InstructionSet'", "'extends'", + "','", "'{'", "'}'", "'Core'", "'provides'", "'architectural_state'", + "';'", "'functions'", "'instructions'", "'always'", + "'encoding'", "':'", "'::'", "'assembly'", "'behavior'", + "'extern'", "'('", "')'", "'if'", "'else'", "'for'", + "'while'", "'do'", "'switch'", "'return'", "'break'", + "'continue'", "'spawn'", "'case'", "'default'", "'*'", + "'&'", "'<'", "'>'", "'bool'", "'void'", "'enum'", + "'unsigned'", "'signed'", "'char'", "'short'", "'int'", + "'long'", "'float'", "'double'", "'[['", "'='", "']]'", + "'.'", "'->'", "'++'", "'--'", "'+'", "'-'", "'~'", + "'!'", "'/'", "'%'", "'<<'", "'>>'", "'<='", "'>='", + "'=='", "'!='", "'^'", "'|'", "'&&'", "'||'", "'?'", + "'+='", "'-='", "'*='", "'/='", "'&='", "'|='", "'^='", + "'>>='", "'>>>='", "'<<='", "'%='", "'alias'", "'const'", + "'volatile'", "'static'", "'register'", "'struct'", + "'union'", "'['", "']'" ] + + symbolicNames = [ "", "", "", "", + "", "", "", "", + "", "", "", "", + "", "", "", "", + "", "", "", "", + "", "", "", "", + "", "", "", "", + "", "", "", "", + "", "", "", "", + "", "", "", "", + "", "", "", "", + "", "", "", "", + "", "", "", "", + "", "", "", "", + "", "", "", "", + "", "", "", "", + "", "", "", "", + "", "", "", "", + "", "", "", "", + "", "", "", "", + "", "", "", "", + "", "", "", "", + "", "", "", "LEFT_BR", + "RIGHT_BR", "BOOLEAN", "FLOAT", "INTEGER", "IDENTIFIER", + "CHARCONST", "ENCSTRINGCONST", "STRING", "ML_COMMENT", + "SL_COMMENT", "WS" ] + + RULE_description_content = 0 + RULE_import_file = 1 + RULE_isa = 2 + RULE_section = 3 + RULE_always_block = 4 + RULE_instruction = 5 + RULE_rule_encoding = 6 + RULE_encoding_entry = 7 + RULE_function_definition = 8 + RULE_parameter_list = 9 + RULE_parameter_declaration = 10 + RULE_statement = 11 + RULE_switch_block_statement_group = 12 + RULE_switch_label = 13 + RULE_block = 14 + RULE_block_item = 15 + RULE_for_condition = 16 + RULE_declaration = 17 + RULE_type_specifier = 18 + RULE_value_type_specifier = 19 + RULE_integer_signedness = 20 + RULE_integer_shorthand = 21 + RULE_float_shorthand = 22 + RULE_attribute = 23 + RULE_bit_size_specifier = 24 + RULE_enumerator_list = 25 + RULE_enumerator = 26 + RULE_struct_declaration = 27 + RULE_struct_declaration_specifier = 28 + RULE_declarator = 29 + RULE_initializer = 30 + RULE_initializerList = 31 + RULE_designated_initializer = 32 + RULE_designator = 33 + RULE_expression = 34 + RULE_primary = 35 + RULE_string_literal = 36 + RULE_constant = 37 + RULE_integer_constant = 38 + RULE_floating_constant = 39 + RULE_bool_constant = 40 + RULE_character_constant = 41 + RULE_string_constant = 42 + RULE_double_left_bracket = 43 + RULE_double_right_bracket = 44 + RULE_data_types = 45 + RULE_type_qualifier = 46 + RULE_storage_class_specifier = 47 + RULE_struct_or_union = 48 + + ruleNames = [ "description_content", "import_file", "isa", "section", + "always_block", "instruction", "rule_encoding", "encoding_entry", + "function_definition", "parameter_list", "parameter_declaration", + "statement", "switch_block_statement_group", "switch_label", + "block", "block_item", "for_condition", "declaration", + "type_specifier", "value_type_specifier", "integer_signedness", + "integer_shorthand", "float_shorthand", "attribute", + "bit_size_specifier", "enumerator_list", "enumerator", + "struct_declaration", "struct_declaration_specifier", + "declarator", "initializer", "initializerList", "designated_initializer", + "designator", "expression", "primary", "string_literal", + "constant", "integer_constant", "floating_constant", + "bool_constant", "character_constant", "string_constant", + "double_left_bracket", "double_right_bracket", "data_types", + "type_qualifier", "storage_class_specifier", "struct_or_union" ] + + EOF = Token.EOF + T__0=1 + T__1=2 + T__2=3 + T__3=4 + T__4=5 + T__5=6 + T__6=7 + T__7=8 + T__8=9 + T__9=10 + T__10=11 + T__11=12 + T__12=13 + T__13=14 + T__14=15 + T__15=16 + T__16=17 + T__17=18 + T__18=19 + T__19=20 + T__20=21 + T__21=22 + T__22=23 + T__23=24 + T__24=25 + T__25=26 + T__26=27 + T__27=28 + T__28=29 + T__29=30 + T__30=31 + T__31=32 + T__32=33 + T__33=34 + T__34=35 + T__35=36 + T__36=37 + T__37=38 + T__38=39 + T__39=40 + T__40=41 + T__41=42 + T__42=43 + T__43=44 + T__44=45 + T__45=46 + T__46=47 + T__47=48 + T__48=49 + T__49=50 + T__50=51 + T__51=52 + T__52=53 + T__53=54 + T__54=55 + T__55=56 + T__56=57 + T__57=58 + T__58=59 + T__59=60 + T__60=61 + T__61=62 + T__62=63 + T__63=64 + T__64=65 + T__65=66 + T__66=67 + T__67=68 + T__68=69 + T__69=70 + T__70=71 + T__71=72 + T__72=73 + T__73=74 + T__74=75 + T__75=76 + T__76=77 + T__77=78 + T__78=79 + T__79=80 + T__80=81 + T__81=82 + T__82=83 + T__83=84 + T__84=85 + T__85=86 + T__86=87 + T__87=88 + T__88=89 + T__89=90 + LEFT_BR=91 + RIGHT_BR=92 + BOOLEAN=93 + FLOAT=94 + INTEGER=95 + IDENTIFIER=96 + CHARCONST=97 + ENCSTRINGCONST=98 + STRING=99 + ML_COMMENT=100 + SL_COMMENT=101 + WS=102 + + def __init__(self, input:TokenStream, output:TextIO = sys.stdout): + super().__init__(input, output) + self.checkVersion("4.13.1") + self._interp = ParserATNSimulator(self, self.atn, self.decisionsToDFA, self.sharedContextCache) + self._predicates = None + + + + + class Description_contentContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + self._import_file = None # Import_fileContext + self.imports = list() # of Import_fileContexts + self._isa = None # IsaContext + self.definitions = list() # of IsaContexts + + def import_file(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(CoreDSL2Parser.Import_fileContext) + else: + return self.getTypedRuleContext(CoreDSL2Parser.Import_fileContext,i) + + + def isa(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(CoreDSL2Parser.IsaContext) + else: + return self.getTypedRuleContext(CoreDSL2Parser.IsaContext,i) + + + def getRuleIndex(self): + return CoreDSL2Parser.RULE_description_content + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterDescription_content" ): + listener.enterDescription_content(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitDescription_content" ): + listener.exitDescription_content(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitDescription_content" ): + return visitor.visitDescription_content(self) + else: + return visitor.visitChildren(self) + + + + + def description_content(self): + + localctx = CoreDSL2Parser.Description_contentContext(self, self._ctx, self.state) + self.enterRule(localctx, 0, self.RULE_description_content) + self._la = 0 # Token type + try: + self.enterOuterAlt(localctx, 1) + self.state = 101 + self._errHandler.sync(self) + _la = self._input.LA(1) + while _la==1: + self.state = 98 + localctx._import_file = self.import_file() + localctx.imports.append(localctx._import_file) + self.state = 103 + self._errHandler.sync(self) + _la = self._input.LA(1) + + self.state = 105 + self._errHandler.sync(self) + _la = self._input.LA(1) + while True: + self.state = 104 + localctx._isa = self.isa() + localctx.definitions.append(localctx._isa) + self.state = 107 + self._errHandler.sync(self) + _la = self._input.LA(1) + if not (_la==2 or _la==7): + break + + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class Import_fileContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + self.uri = None # Token + + def STRING(self): + return self.getToken(CoreDSL2Parser.STRING, 0) + + def getRuleIndex(self): + return CoreDSL2Parser.RULE_import_file + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterImport_file" ): + listener.enterImport_file(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitImport_file" ): + listener.exitImport_file(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitImport_file" ): + return visitor.visitImport_file(self) + else: + return visitor.visitChildren(self) + + + + + def import_file(self): + + localctx = CoreDSL2Parser.Import_fileContext(self, self._ctx, self.state) + self.enterRule(localctx, 2, self.RULE_import_file) + try: + self.enterOuterAlt(localctx, 1) + self.state = 109 + self.match(CoreDSL2Parser.T__0) + self.state = 110 + localctx.uri = self.match(CoreDSL2Parser.STRING) + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class IsaContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + + def getRuleIndex(self): + return CoreDSL2Parser.RULE_isa + + + def copyFrom(self, ctx:ParserRuleContext): + super().copyFrom(ctx) + + + + class Instruction_setContext(IsaContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a CoreDSL2Parser.IsaContext + super().__init__(parser) + self.name = None # Token + self._IDENTIFIER = None # Token + self.extension = list() # of Tokens + self._section = None # SectionContext + self.sections = list() # of SectionContexts + self.copyFrom(ctx) + + def IDENTIFIER(self, i:int=None): + if i is None: + return self.getTokens(CoreDSL2Parser.IDENTIFIER) + else: + return self.getToken(CoreDSL2Parser.IDENTIFIER, i) + def section(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(CoreDSL2Parser.SectionContext) + else: + return self.getTypedRuleContext(CoreDSL2Parser.SectionContext,i) + + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterInstruction_set" ): + listener.enterInstruction_set(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitInstruction_set" ): + listener.exitInstruction_set(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitInstruction_set" ): + return visitor.visitInstruction_set(self) + else: + return visitor.visitChildren(self) + + + class Core_defContext(IsaContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a CoreDSL2Parser.IsaContext + super().__init__(parser) + self.name = None # Token + self._IDENTIFIER = None # Token + self.contributing_types = list() # of Tokens + self._section = None # SectionContext + self.sections = list() # of SectionContexts + self.copyFrom(ctx) + + def IDENTIFIER(self, i:int=None): + if i is None: + return self.getTokens(CoreDSL2Parser.IDENTIFIER) + else: + return self.getToken(CoreDSL2Parser.IDENTIFIER, i) + def section(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(CoreDSL2Parser.SectionContext) + else: + return self.getTypedRuleContext(CoreDSL2Parser.SectionContext,i) + + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterCore_def" ): + listener.enterCore_def(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitCore_def" ): + listener.exitCore_def(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitCore_def" ): + return visitor.visitCore_def(self) + else: + return visitor.visitChildren(self) + + + + def isa(self): + + localctx = CoreDSL2Parser.IsaContext(self, self._ctx, self.state) + self.enterRule(localctx, 4, self.RULE_isa) + self._la = 0 # Token type + try: + self.state = 154 + self._errHandler.sync(self) + token = self._input.LA(1) + if token in [2]: + localctx = CoreDSL2Parser.Instruction_setContext(self, localctx) + self.enterOuterAlt(localctx, 1) + self.state = 112 + self.match(CoreDSL2Parser.T__1) + self.state = 113 + localctx.name = self.match(CoreDSL2Parser.IDENTIFIER) + self.state = 123 + self._errHandler.sync(self) + _la = self._input.LA(1) + if _la==3: + self.state = 114 + self.match(CoreDSL2Parser.T__2) + self.state = 115 + localctx._IDENTIFIER = self.match(CoreDSL2Parser.IDENTIFIER) + localctx.extension.append(localctx._IDENTIFIER) + self.state = 120 + self._errHandler.sync(self) + _la = self._input.LA(1) + while _la==4: + self.state = 116 + self.match(CoreDSL2Parser.T__3) + self.state = 117 + localctx._IDENTIFIER = self.match(CoreDSL2Parser.IDENTIFIER) + localctx.extension.append(localctx._IDENTIFIER) + self.state = 122 + self._errHandler.sync(self) + _la = self._input.LA(1) + + + + self.state = 125 + self.match(CoreDSL2Parser.T__4) + self.state = 127 + self._errHandler.sync(self) + _la = self._input.LA(1) + while True: + self.state = 126 + localctx._section = self.section() + localctx.sections.append(localctx._section) + self.state = 129 + self._errHandler.sync(self) + _la = self._input.LA(1) + if not ((((_la) & ~0x3f) == 0 and ((1 << _la) & 14848) != 0)): + break + + self.state = 131 + self.match(CoreDSL2Parser.T__5) + pass + elif token in [7]: + localctx = CoreDSL2Parser.Core_defContext(self, localctx) + self.enterOuterAlt(localctx, 2) + self.state = 133 + self.match(CoreDSL2Parser.T__6) + self.state = 134 + localctx.name = self.match(CoreDSL2Parser.IDENTIFIER) + self.state = 144 + self._errHandler.sync(self) + _la = self._input.LA(1) + if _la==8: + self.state = 135 + self.match(CoreDSL2Parser.T__7) + self.state = 136 + localctx._IDENTIFIER = self.match(CoreDSL2Parser.IDENTIFIER) + localctx.contributing_types.append(localctx._IDENTIFIER) + self.state = 141 + self._errHandler.sync(self) + _la = self._input.LA(1) + while _la==4: + self.state = 137 + self.match(CoreDSL2Parser.T__3) + self.state = 138 + localctx._IDENTIFIER = self.match(CoreDSL2Parser.IDENTIFIER) + localctx.contributing_types.append(localctx._IDENTIFIER) + self.state = 143 + self._errHandler.sync(self) + _la = self._input.LA(1) + + + + self.state = 146 + self.match(CoreDSL2Parser.T__4) + self.state = 150 + self._errHandler.sync(self) + _la = self._input.LA(1) + while (((_la) & ~0x3f) == 0 and ((1 << _la) & 14848) != 0): + self.state = 147 + localctx._section = self.section() + localctx.sections.append(localctx._section) + self.state = 152 + self._errHandler.sync(self) + _la = self._input.LA(1) + + self.state = 153 + self.match(CoreDSL2Parser.T__5) + pass + else: + raise NoViableAltException(self) + + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class SectionContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + + def getRuleIndex(self): + return CoreDSL2Parser.RULE_section + + + def copyFrom(self, ctx:ParserRuleContext): + super().copyFrom(ctx) + + + + class Section_instructionsContext(SectionContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a CoreDSL2Parser.SectionContext + super().__init__(parser) + self.type_ = None # Token + self._attribute = None # AttributeContext + self.attributes = list() # of AttributeContexts + self._instruction = None # InstructionContext + self.instructions = list() # of InstructionContexts + self.copyFrom(ctx) + + def attribute(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(CoreDSL2Parser.AttributeContext) + else: + return self.getTypedRuleContext(CoreDSL2Parser.AttributeContext,i) + + def instruction(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(CoreDSL2Parser.InstructionContext) + else: + return self.getTypedRuleContext(CoreDSL2Parser.InstructionContext,i) + + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterSection_instructions" ): + listener.enterSection_instructions(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitSection_instructions" ): + listener.exitSection_instructions(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitSection_instructions" ): + return visitor.visitSection_instructions(self) + else: + return visitor.visitChildren(self) + + + class Section_alwaysContext(SectionContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a CoreDSL2Parser.SectionContext + super().__init__(parser) + self.type_ = None # Token + self._attribute = None # AttributeContext + self.attributes = list() # of AttributeContexts + self._always_block = None # Always_blockContext + self.always_blocks = list() # of Always_blockContexts + self.copyFrom(ctx) + + def attribute(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(CoreDSL2Parser.AttributeContext) + else: + return self.getTypedRuleContext(CoreDSL2Parser.AttributeContext,i) + + def always_block(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(CoreDSL2Parser.Always_blockContext) + else: + return self.getTypedRuleContext(CoreDSL2Parser.Always_blockContext,i) + + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterSection_always" ): + listener.enterSection_always(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitSection_always" ): + listener.exitSection_always(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitSection_always" ): + return visitor.visitSection_always(self) + else: + return visitor.visitChildren(self) + + + class Section_functionsContext(SectionContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a CoreDSL2Parser.SectionContext + super().__init__(parser) + self.type_ = None # Token + self._function_definition = None # Function_definitionContext + self.functions = list() # of Function_definitionContexts + self.copyFrom(ctx) + + def function_definition(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(CoreDSL2Parser.Function_definitionContext) + else: + return self.getTypedRuleContext(CoreDSL2Parser.Function_definitionContext,i) + + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterSection_functions" ): + listener.enterSection_functions(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitSection_functions" ): + listener.exitSection_functions(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitSection_functions" ): + return visitor.visitSection_functions(self) + else: + return visitor.visitChildren(self) + + + class Section_arch_stateContext(SectionContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a CoreDSL2Parser.SectionContext + super().__init__(parser) + self.type_ = None # Token + self._declaration = None # DeclarationContext + self.declarations = list() # of DeclarationContexts + self._expression = None # ExpressionContext + self.expressions = list() # of ExpressionContexts + self.copyFrom(ctx) + + def declaration(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(CoreDSL2Parser.DeclarationContext) + else: + return self.getTypedRuleContext(CoreDSL2Parser.DeclarationContext,i) + + def expression(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(CoreDSL2Parser.ExpressionContext) + else: + return self.getTypedRuleContext(CoreDSL2Parser.ExpressionContext,i) + + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterSection_arch_state" ): + listener.enterSection_arch_state(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitSection_arch_state" ): + listener.exitSection_arch_state(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitSection_arch_state" ): + return visitor.visitSection_arch_state(self) + else: + return visitor.visitChildren(self) + + + + def section(self): + + localctx = CoreDSL2Parser.SectionContext(self, self._ctx, self.state) + self.enterRule(localctx, 6, self.RULE_section) + self._la = 0 # Token type + try: + self.state = 207 + self._errHandler.sync(self) + token = self._input.LA(1) + if token in [9]: + localctx = CoreDSL2Parser.Section_arch_stateContext(self, localctx) + self.enterOuterAlt(localctx, 1) + self.state = 156 + localctx.type_ = self.match(CoreDSL2Parser.T__8) + self.state = 157 + self.match(CoreDSL2Parser.T__4) + self.state = 162 + self._errHandler.sync(self) + _la = self._input.LA(1) + while True: + self.state = 162 + self._errHandler.sync(self) + token = self._input.LA(1) + if token in [19, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 85, 86, 87, 88, 89, 90]: + self.state = 158 + localctx._declaration = self.declaration() + localctx.declarations.append(localctx._declaration) + pass + elif token in [20, 34, 35, 52, 53, 54, 55, 56, 57, 58, 59, 93, 94, 95, 96, 97, 98, 99]: + self.state = 159 + localctx._expression = self.expression(0) + localctx.expressions.append(localctx._expression) + self.state = 160 + self.match(CoreDSL2Parser.T__9) + pass + else: + raise NoViableAltException(self) + + self.state = 164 + self._errHandler.sync(self) + _la = self._input.LA(1) + if not ((((_la) & ~0x3f) == 0 and ((1 << _la) & 1149543581549592576) != 0) or ((((_la - 85)) & ~0x3f) == 0 and ((1 << (_la - 85)) & 32575) != 0)): + break + + self.state = 166 + self.match(CoreDSL2Parser.T__5) + pass + elif token in [11]: + localctx = CoreDSL2Parser.Section_functionsContext(self, localctx) + self.enterOuterAlt(localctx, 2) + self.state = 168 + localctx.type_ = self.match(CoreDSL2Parser.T__10) + self.state = 169 + self.match(CoreDSL2Parser.T__4) + self.state = 173 + self._errHandler.sync(self) + _la = self._input.LA(1) + while (((_la) & ~0x3f) == 0 and ((1 << _la) & 562675076038656) != 0) or _la==89 or _la==90: + self.state = 170 + localctx._function_definition = self.function_definition() + localctx.functions.append(localctx._function_definition) + self.state = 175 + self._errHandler.sync(self) + _la = self._input.LA(1) + + self.state = 176 + self.match(CoreDSL2Parser.T__5) + pass + elif token in [12]: + localctx = CoreDSL2Parser.Section_instructionsContext(self, localctx) + self.enterOuterAlt(localctx, 3) + self.state = 177 + localctx.type_ = self.match(CoreDSL2Parser.T__11) + self.state = 181 + self._errHandler.sync(self) + _la = self._input.LA(1) + while _la==49: + self.state = 178 + localctx._attribute = self.attribute() + localctx.attributes.append(localctx._attribute) + self.state = 183 + self._errHandler.sync(self) + _la = self._input.LA(1) + + self.state = 184 + self.match(CoreDSL2Parser.T__4) + self.state = 188 + self._errHandler.sync(self) + _la = self._input.LA(1) + while _la==96: + self.state = 185 + localctx._instruction = self.instruction() + localctx.instructions.append(localctx._instruction) + self.state = 190 + self._errHandler.sync(self) + _la = self._input.LA(1) + + self.state = 191 + self.match(CoreDSL2Parser.T__5) + pass + elif token in [13]: + localctx = CoreDSL2Parser.Section_alwaysContext(self, localctx) + self.enterOuterAlt(localctx, 4) + self.state = 192 + localctx.type_ = self.match(CoreDSL2Parser.T__12) + self.state = 196 + self._errHandler.sync(self) + _la = self._input.LA(1) + while _la==49: + self.state = 193 + localctx._attribute = self.attribute() + localctx.attributes.append(localctx._attribute) + self.state = 198 + self._errHandler.sync(self) + _la = self._input.LA(1) + + self.state = 199 + self.match(CoreDSL2Parser.T__4) + self.state = 201 + self._errHandler.sync(self) + _la = self._input.LA(1) + while True: + self.state = 200 + localctx._always_block = self.always_block() + localctx.always_blocks.append(localctx._always_block) + self.state = 203 + self._errHandler.sync(self) + _la = self._input.LA(1) + if not (_la==96): + break + + self.state = 205 + self.match(CoreDSL2Parser.T__5) + pass + else: + raise NoViableAltException(self) + + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class Always_blockContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + self.name = None # Token + self._attribute = None # AttributeContext + self.attributes = list() # of AttributeContexts + self.behavior = None # BlockContext + + def IDENTIFIER(self): + return self.getToken(CoreDSL2Parser.IDENTIFIER, 0) + + def block(self): + return self.getTypedRuleContext(CoreDSL2Parser.BlockContext,0) + + + def attribute(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(CoreDSL2Parser.AttributeContext) + else: + return self.getTypedRuleContext(CoreDSL2Parser.AttributeContext,i) + + + def getRuleIndex(self): + return CoreDSL2Parser.RULE_always_block + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterAlways_block" ): + listener.enterAlways_block(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitAlways_block" ): + listener.exitAlways_block(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitAlways_block" ): + return visitor.visitAlways_block(self) + else: + return visitor.visitChildren(self) + + + + + def always_block(self): + + localctx = CoreDSL2Parser.Always_blockContext(self, self._ctx, self.state) + self.enterRule(localctx, 8, self.RULE_always_block) + self._la = 0 # Token type + try: + self.enterOuterAlt(localctx, 1) + self.state = 209 + localctx.name = self.match(CoreDSL2Parser.IDENTIFIER) + self.state = 213 + self._errHandler.sync(self) + _la = self._input.LA(1) + while _la==49: + self.state = 210 + localctx._attribute = self.attribute() + localctx.attributes.append(localctx._attribute) + self.state = 215 + self._errHandler.sync(self) + _la = self._input.LA(1) + + self.state = 216 + localctx.behavior = self.block() + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class InstructionContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + self.name = None # Token + self._attribute = None # AttributeContext + self.attributes = list() # of AttributeContexts + self._encoding_entry = None # Encoding_entryContext + self.encoding = list() # of Encoding_entryContexts + self.assembly = None # Token + self.mnemonic = None # Token + self.behavior = None # StatementContext + + def IDENTIFIER(self): + return self.getToken(CoreDSL2Parser.IDENTIFIER, 0) + + def encoding_entry(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(CoreDSL2Parser.Encoding_entryContext) + else: + return self.getTypedRuleContext(CoreDSL2Parser.Encoding_entryContext,i) + + + def statement(self): + return self.getTypedRuleContext(CoreDSL2Parser.StatementContext,0) + + + def attribute(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(CoreDSL2Parser.AttributeContext) + else: + return self.getTypedRuleContext(CoreDSL2Parser.AttributeContext,i) + + + def STRING(self, i:int=None): + if i is None: + return self.getTokens(CoreDSL2Parser.STRING) + else: + return self.getToken(CoreDSL2Parser.STRING, i) + + def getRuleIndex(self): + return CoreDSL2Parser.RULE_instruction + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterInstruction" ): + listener.enterInstruction(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitInstruction" ): + listener.exitInstruction(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitInstruction" ): + return visitor.visitInstruction(self) + else: + return visitor.visitChildren(self) + + + + + def instruction(self): + + localctx = CoreDSL2Parser.InstructionContext(self, self._ctx, self.state) + self.enterRule(localctx, 10, self.RULE_instruction) + self._la = 0 # Token type + try: + self.enterOuterAlt(localctx, 1) + self.state = 218 + localctx.name = self.match(CoreDSL2Parser.IDENTIFIER) + self.state = 222 + self._errHandler.sync(self) + _la = self._input.LA(1) + while _la==49: + self.state = 219 + localctx._attribute = self.attribute() + localctx.attributes.append(localctx._attribute) + self.state = 224 + self._errHandler.sync(self) + _la = self._input.LA(1) + + self.state = 225 + self.match(CoreDSL2Parser.T__4) + self.state = 226 + self.match(CoreDSL2Parser.T__13) + self.state = 227 + self.match(CoreDSL2Parser.T__14) + self.state = 228 + localctx._encoding_entry = self.encoding_entry() + localctx.encoding.append(localctx._encoding_entry) + self.state = 233 + self._errHandler.sync(self) + _la = self._input.LA(1) + while _la==16: + self.state = 229 + self.match(CoreDSL2Parser.T__15) + self.state = 230 + localctx._encoding_entry = self.encoding_entry() + localctx.encoding.append(localctx._encoding_entry) + self.state = 235 + self._errHandler.sync(self) + _la = self._input.LA(1) + + self.state = 236 + self.match(CoreDSL2Parser.T__9) + self.state = 248 + self._errHandler.sync(self) + _la = self._input.LA(1) + if _la==17: + self.state = 237 + self.match(CoreDSL2Parser.T__16) + self.state = 238 + self.match(CoreDSL2Parser.T__14) + self.state = 245 + self._errHandler.sync(self) + token = self._input.LA(1) + if token in [99]: + self.state = 239 + localctx.assembly = self.match(CoreDSL2Parser.STRING) + pass + elif token in [5]: + self.state = 240 + self.match(CoreDSL2Parser.T__4) + self.state = 241 + localctx.mnemonic = self.match(CoreDSL2Parser.STRING) + self.state = 242 + self.match(CoreDSL2Parser.T__3) + self.state = 243 + localctx.assembly = self.match(CoreDSL2Parser.STRING) + self.state = 244 + self.match(CoreDSL2Parser.T__5) + pass + else: + raise NoViableAltException(self) + + self.state = 247 + self.match(CoreDSL2Parser.T__9) + + + self.state = 250 + self.match(CoreDSL2Parser.T__17) + self.state = 251 + self.match(CoreDSL2Parser.T__14) + self.state = 252 + localctx.behavior = self.statement() + self.state = 253 + self.match(CoreDSL2Parser.T__5) + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class Rule_encodingContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + self._encoding_entry = None # Encoding_entryContext + self.fields = list() # of Encoding_entryContexts + + def encoding_entry(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(CoreDSL2Parser.Encoding_entryContext) + else: + return self.getTypedRuleContext(CoreDSL2Parser.Encoding_entryContext,i) + + + def getRuleIndex(self): + return CoreDSL2Parser.RULE_rule_encoding + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterRule_encoding" ): + listener.enterRule_encoding(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitRule_encoding" ): + listener.exitRule_encoding(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitRule_encoding" ): + return visitor.visitRule_encoding(self) + else: + return visitor.visitChildren(self) + + + + + def rule_encoding(self): + + localctx = CoreDSL2Parser.Rule_encodingContext(self, self._ctx, self.state) + self.enterRule(localctx, 12, self.RULE_rule_encoding) + self._la = 0 # Token type + try: + self.enterOuterAlt(localctx, 1) + self.state = 255 + localctx._encoding_entry = self.encoding_entry() + localctx.fields.append(localctx._encoding_entry) + self.state = 260 + self._errHandler.sync(self) + _la = self._input.LA(1) + while _la==16: + self.state = 256 + self.match(CoreDSL2Parser.T__15) + self.state = 257 + localctx._encoding_entry = self.encoding_entry() + localctx.fields.append(localctx._encoding_entry) + self.state = 262 + self._errHandler.sync(self) + _la = self._input.LA(1) + + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class Encoding_entryContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + + def getRuleIndex(self): + return CoreDSL2Parser.RULE_encoding_entry + + + def copyFrom(self, ctx:ParserRuleContext): + super().copyFrom(ctx) + + + + class Bit_fieldContext(Encoding_entryContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a CoreDSL2Parser.Encoding_entryContext + super().__init__(parser) + self.name = None # Token + self.left = None # Integer_constantContext + self.right = None # Integer_constantContext + self.copyFrom(ctx) + + def LEFT_BR(self): + return self.getToken(CoreDSL2Parser.LEFT_BR, 0) + def RIGHT_BR(self): + return self.getToken(CoreDSL2Parser.RIGHT_BR, 0) + def IDENTIFIER(self): + return self.getToken(CoreDSL2Parser.IDENTIFIER, 0) + def integer_constant(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(CoreDSL2Parser.Integer_constantContext) + else: + return self.getTypedRuleContext(CoreDSL2Parser.Integer_constantContext,i) + + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterBit_field" ): + listener.enterBit_field(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitBit_field" ): + listener.exitBit_field(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitBit_field" ): + return visitor.visitBit_field(self) + else: + return visitor.visitChildren(self) + + + class Bit_valueContext(Encoding_entryContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a CoreDSL2Parser.Encoding_entryContext + super().__init__(parser) + self.value = None # Integer_constantContext + self.copyFrom(ctx) + + def integer_constant(self): + return self.getTypedRuleContext(CoreDSL2Parser.Integer_constantContext,0) + + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterBit_value" ): + listener.enterBit_value(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitBit_value" ): + listener.exitBit_value(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitBit_value" ): + return visitor.visitBit_value(self) + else: + return visitor.visitChildren(self) + + + + def encoding_entry(self): + + localctx = CoreDSL2Parser.Encoding_entryContext(self, self._ctx, self.state) + self.enterRule(localctx, 14, self.RULE_encoding_entry) + try: + self.state = 271 + self._errHandler.sync(self) + token = self._input.LA(1) + if token in [95]: + localctx = CoreDSL2Parser.Bit_valueContext(self, localctx) + self.enterOuterAlt(localctx, 1) + self.state = 263 + localctx.value = self.integer_constant() + pass + elif token in [96]: + localctx = CoreDSL2Parser.Bit_fieldContext(self, localctx) + self.enterOuterAlt(localctx, 2) + self.state = 264 + localctx.name = self.match(CoreDSL2Parser.IDENTIFIER) + self.state = 265 + self.match(CoreDSL2Parser.LEFT_BR) + self.state = 266 + localctx.left = self.integer_constant() + self.state = 267 + self.match(CoreDSL2Parser.T__14) + self.state = 268 + localctx.right = self.integer_constant() + self.state = 269 + self.match(CoreDSL2Parser.RIGHT_BR) + pass + else: + raise NoViableAltException(self) + + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class Function_definitionContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + self.extern = None # Token + self.type_ = None # Type_specifierContext + self.name = None # Token + self.params = None # Parameter_listContext + self._attribute = None # AttributeContext + self.attributes = list() # of AttributeContexts + self.behavior = None # BlockContext + + def type_specifier(self): + return self.getTypedRuleContext(CoreDSL2Parser.Type_specifierContext,0) + + + def IDENTIFIER(self): + return self.getToken(CoreDSL2Parser.IDENTIFIER, 0) + + def parameter_list(self): + return self.getTypedRuleContext(CoreDSL2Parser.Parameter_listContext,0) + + + def attribute(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(CoreDSL2Parser.AttributeContext) + else: + return self.getTypedRuleContext(CoreDSL2Parser.AttributeContext,i) + + + def block(self): + return self.getTypedRuleContext(CoreDSL2Parser.BlockContext,0) + + + def getRuleIndex(self): + return CoreDSL2Parser.RULE_function_definition + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterFunction_definition" ): + listener.enterFunction_definition(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitFunction_definition" ): + listener.exitFunction_definition(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitFunction_definition" ): + return visitor.visitFunction_definition(self) + else: + return visitor.visitChildren(self) + + + + + def function_definition(self): + + localctx = CoreDSL2Parser.Function_definitionContext(self, self._ctx, self.state) + self.enterRule(localctx, 16, self.RULE_function_definition) + self._la = 0 # Token type + try: + self.state = 306 + self._errHandler.sync(self) + token = self._input.LA(1) + if token in [19]: + self.enterOuterAlt(localctx, 1) + self.state = 273 + localctx.extern = self.match(CoreDSL2Parser.T__18) + self.state = 274 + localctx.type_ = self.type_specifier() + self.state = 275 + localctx.name = self.match(CoreDSL2Parser.IDENTIFIER) + self.state = 276 + self.match(CoreDSL2Parser.T__19) + self.state = 278 + self._errHandler.sync(self) + _la = self._input.LA(1) + if ((((_la - 38)) & ~0x3f) == 0 and ((1 << (_la - 38)) & 6755399441057791) != 0): + self.state = 277 + localctx.params = self.parameter_list() + + + self.state = 280 + self.match(CoreDSL2Parser.T__20) + self.state = 284 + self._errHandler.sync(self) + _la = self._input.LA(1) + while _la==49: + self.state = 281 + localctx._attribute = self.attribute() + localctx.attributes.append(localctx._attribute) + self.state = 286 + self._errHandler.sync(self) + _la = self._input.LA(1) + + self.state = 287 + self.match(CoreDSL2Parser.T__9) + pass + elif token in [38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 89, 90]: + self.enterOuterAlt(localctx, 2) + self.state = 289 + localctx.type_ = self.type_specifier() + self.state = 290 + localctx.name = self.match(CoreDSL2Parser.IDENTIFIER) + self.state = 291 + self.match(CoreDSL2Parser.T__19) + self.state = 293 + self._errHandler.sync(self) + _la = self._input.LA(1) + if ((((_la - 38)) & ~0x3f) == 0 and ((1 << (_la - 38)) & 6755399441057791) != 0): + self.state = 292 + localctx.params = self.parameter_list() + + + self.state = 295 + self.match(CoreDSL2Parser.T__20) + self.state = 299 + self._errHandler.sync(self) + _la = self._input.LA(1) + while _la==49: + self.state = 296 + localctx._attribute = self.attribute() + localctx.attributes.append(localctx._attribute) + self.state = 301 + self._errHandler.sync(self) + _la = self._input.LA(1) + + self.state = 304 + self._errHandler.sync(self) + token = self._input.LA(1) + if token in [5]: + self.state = 302 + localctx.behavior = self.block() + pass + elif token in [10]: + self.state = 303 + self.match(CoreDSL2Parser.T__9) + pass + else: + raise NoViableAltException(self) + + pass + else: + raise NoViableAltException(self) + + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class Parameter_listContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + self._parameter_declaration = None # Parameter_declarationContext + self.params = list() # of Parameter_declarationContexts + + def parameter_declaration(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(CoreDSL2Parser.Parameter_declarationContext) + else: + return self.getTypedRuleContext(CoreDSL2Parser.Parameter_declarationContext,i) + + + def getRuleIndex(self): + return CoreDSL2Parser.RULE_parameter_list + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterParameter_list" ): + listener.enterParameter_list(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitParameter_list" ): + listener.exitParameter_list(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitParameter_list" ): + return visitor.visitParameter_list(self) + else: + return visitor.visitChildren(self) + + + + + def parameter_list(self): + + localctx = CoreDSL2Parser.Parameter_listContext(self, self._ctx, self.state) + self.enterRule(localctx, 18, self.RULE_parameter_list) + self._la = 0 # Token type + try: + self.enterOuterAlt(localctx, 1) + self.state = 308 + localctx._parameter_declaration = self.parameter_declaration() + localctx.params.append(localctx._parameter_declaration) + self.state = 313 + self._errHandler.sync(self) + _la = self._input.LA(1) + while _la==4: + self.state = 309 + self.match(CoreDSL2Parser.T__3) + self.state = 310 + localctx._parameter_declaration = self.parameter_declaration() + localctx.params.append(localctx._parameter_declaration) + self.state = 315 + self._errHandler.sync(self) + _la = self._input.LA(1) + + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class Parameter_declarationContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + self.type_ = None # Type_specifierContext + self.decl = None # DeclaratorContext + + def type_specifier(self): + return self.getTypedRuleContext(CoreDSL2Parser.Type_specifierContext,0) + + + def declarator(self): + return self.getTypedRuleContext(CoreDSL2Parser.DeclaratorContext,0) + + + def getRuleIndex(self): + return CoreDSL2Parser.RULE_parameter_declaration + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterParameter_declaration" ): + listener.enterParameter_declaration(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitParameter_declaration" ): + listener.exitParameter_declaration(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitParameter_declaration" ): + return visitor.visitParameter_declaration(self) + else: + return visitor.visitChildren(self) + + + + + def parameter_declaration(self): + + localctx = CoreDSL2Parser.Parameter_declarationContext(self, self._ctx, self.state) + self.enterRule(localctx, 20, self.RULE_parameter_declaration) + self._la = 0 # Token type + try: + self.enterOuterAlt(localctx, 1) + self.state = 316 + localctx.type_ = self.type_specifier() + self.state = 318 + self._errHandler.sync(self) + _la = self._input.LA(1) + if _la==96: + self.state = 317 + localctx.decl = self.declarator() + + + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class StatementContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + + def getRuleIndex(self): + return CoreDSL2Parser.RULE_statement + + + def copyFrom(self, ctx:ParserRuleContext): + super().copyFrom(ctx) + + + + class For_statementContext(StatementContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a CoreDSL2Parser.StatementContext + super().__init__(parser) + self.type_ = None # Token + self.cond = None # For_conditionContext + self.stmt = None # StatementContext + self.copyFrom(ctx) + + def for_condition(self): + return self.getTypedRuleContext(CoreDSL2Parser.For_conditionContext,0) + + def statement(self): + return self.getTypedRuleContext(CoreDSL2Parser.StatementContext,0) + + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterFor_statement" ): + listener.enterFor_statement(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitFor_statement" ): + listener.exitFor_statement(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitFor_statement" ): + return visitor.visitFor_statement(self) + else: + return visitor.visitChildren(self) + + + class Spawn_statementContext(StatementContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a CoreDSL2Parser.StatementContext + super().__init__(parser) + self.type_ = None # Token + self.stmt = None # StatementContext + self.copyFrom(ctx) + + def statement(self): + return self.getTypedRuleContext(CoreDSL2Parser.StatementContext,0) + + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterSpawn_statement" ): + listener.enterSpawn_statement(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitSpawn_statement" ): + listener.exitSpawn_statement(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitSpawn_statement" ): + return visitor.visitSpawn_statement(self) + else: + return visitor.visitChildren(self) + + + class Continue_statementContext(StatementContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a CoreDSL2Parser.StatementContext + super().__init__(parser) + self.type_ = None # Token + self.copyFrom(ctx) + + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterContinue_statement" ): + listener.enterContinue_statement(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitContinue_statement" ): + listener.exitContinue_statement(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitContinue_statement" ): + return visitor.visitContinue_statement(self) + else: + return visitor.visitChildren(self) + + + class Expression_statementContext(StatementContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a CoreDSL2Parser.StatementContext + super().__init__(parser) + self.expr = None # ExpressionContext + self.copyFrom(ctx) + + def expression(self): + return self.getTypedRuleContext(CoreDSL2Parser.ExpressionContext,0) + + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterExpression_statement" ): + listener.enterExpression_statement(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitExpression_statement" ): + listener.exitExpression_statement(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitExpression_statement" ): + return visitor.visitExpression_statement(self) + else: + return visitor.visitChildren(self) + + + class If_statementContext(StatementContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a CoreDSL2Parser.StatementContext + super().__init__(parser) + self.type_ = None # Token + self._expression = None # ExpressionContext + self.cond = list() # of ExpressionContexts + self._statement = None # StatementContext + self.stmt = list() # of StatementContexts + self.copyFrom(ctx) + + def expression(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(CoreDSL2Parser.ExpressionContext) + else: + return self.getTypedRuleContext(CoreDSL2Parser.ExpressionContext,i) + + def statement(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(CoreDSL2Parser.StatementContext) + else: + return self.getTypedRuleContext(CoreDSL2Parser.StatementContext,i) + + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterIf_statement" ): + listener.enterIf_statement(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitIf_statement" ): + listener.exitIf_statement(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitIf_statement" ): + return visitor.visitIf_statement(self) + else: + return visitor.visitChildren(self) + + + class Procedure_callContext(StatementContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a CoreDSL2Parser.StatementContext + super().__init__(parser) + self.ref = None # Token + self._expression = None # ExpressionContext + self.args = list() # of ExpressionContexts + self.copyFrom(ctx) + + def IDENTIFIER(self): + return self.getToken(CoreDSL2Parser.IDENTIFIER, 0) + def expression(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(CoreDSL2Parser.ExpressionContext) + else: + return self.getTypedRuleContext(CoreDSL2Parser.ExpressionContext,i) + + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterProcedure_call" ): + listener.enterProcedure_call(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitProcedure_call" ): + listener.exitProcedure_call(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitProcedure_call" ): + return visitor.visitProcedure_call(self) + else: + return visitor.visitChildren(self) + + + class While_statementContext(StatementContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a CoreDSL2Parser.StatementContext + super().__init__(parser) + self.type_ = None # Token + self.cond = None # ExpressionContext + self.stmt = None # StatementContext + self.copyFrom(ctx) + + def expression(self): + return self.getTypedRuleContext(CoreDSL2Parser.ExpressionContext,0) + + def statement(self): + return self.getTypedRuleContext(CoreDSL2Parser.StatementContext,0) + + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterWhile_statement" ): + listener.enterWhile_statement(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitWhile_statement" ): + listener.exitWhile_statement(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitWhile_statement" ): + return visitor.visitWhile_statement(self) + else: + return visitor.visitChildren(self) + + + class Switch_statementContext(StatementContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a CoreDSL2Parser.StatementContext + super().__init__(parser) + self.type_ = None # Token + self.cond = None # ExpressionContext + self._switch_block_statement_group = None # Switch_block_statement_groupContext + self.items = list() # of Switch_block_statement_groupContexts + self.copyFrom(ctx) + + def expression(self): + return self.getTypedRuleContext(CoreDSL2Parser.ExpressionContext,0) + + def switch_label(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(CoreDSL2Parser.Switch_labelContext) + else: + return self.getTypedRuleContext(CoreDSL2Parser.Switch_labelContext,i) + + def switch_block_statement_group(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(CoreDSL2Parser.Switch_block_statement_groupContext) + else: + return self.getTypedRuleContext(CoreDSL2Parser.Switch_block_statement_groupContext,i) + + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterSwitch_statement" ): + listener.enterSwitch_statement(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitSwitch_statement" ): + listener.exitSwitch_statement(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitSwitch_statement" ): + return visitor.visitSwitch_statement(self) + else: + return visitor.visitChildren(self) + + + class Block_statementContext(StatementContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a CoreDSL2Parser.StatementContext + super().__init__(parser) + self.copyFrom(ctx) + + def block(self): + return self.getTypedRuleContext(CoreDSL2Parser.BlockContext,0) + + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterBlock_statement" ): + listener.enterBlock_statement(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitBlock_statement" ): + listener.exitBlock_statement(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitBlock_statement" ): + return visitor.visitBlock_statement(self) + else: + return visitor.visitChildren(self) + + + class Do_statementContext(StatementContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a CoreDSL2Parser.StatementContext + super().__init__(parser) + self.type_ = None # Token + self.stmt = None # StatementContext + self.cond = None # ExpressionContext + self.copyFrom(ctx) + + def statement(self): + return self.getTypedRuleContext(CoreDSL2Parser.StatementContext,0) + + def expression(self): + return self.getTypedRuleContext(CoreDSL2Parser.ExpressionContext,0) + + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterDo_statement" ): + listener.enterDo_statement(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitDo_statement" ): + listener.exitDo_statement(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitDo_statement" ): + return visitor.visitDo_statement(self) + else: + return visitor.visitChildren(self) + + + class Break_statementContext(StatementContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a CoreDSL2Parser.StatementContext + super().__init__(parser) + self.type_ = None # Token + self.copyFrom(ctx) + + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterBreak_statement" ): + listener.enterBreak_statement(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitBreak_statement" ): + listener.exitBreak_statement(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitBreak_statement" ): + return visitor.visitBreak_statement(self) + else: + return visitor.visitChildren(self) + + + class Return_statementContext(StatementContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a CoreDSL2Parser.StatementContext + super().__init__(parser) + self.type_ = None # Token + self.expr = None # ExpressionContext + self.copyFrom(ctx) + + def expression(self): + return self.getTypedRuleContext(CoreDSL2Parser.ExpressionContext,0) + + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterReturn_statement" ): + listener.enterReturn_statement(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitReturn_statement" ): + listener.exitReturn_statement(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitReturn_statement" ): + return visitor.visitReturn_statement(self) + else: + return visitor.visitChildren(self) + + + + def statement(self): + + localctx = CoreDSL2Parser.StatementContext(self, self._ctx, self.state) + self.enterRule(localctx, 22, self.RULE_statement) + self._la = 0 # Token type + try: + self.state = 409 + self._errHandler.sync(self) + la_ = self._interp.adaptivePredict(self._input,39,self._ctx) + if la_ == 1: + localctx = CoreDSL2Parser.Block_statementContext(self, localctx) + self.enterOuterAlt(localctx, 1) + self.state = 320 + self.block() + pass + + elif la_ == 2: + localctx = CoreDSL2Parser.Procedure_callContext(self, localctx) + self.enterOuterAlt(localctx, 2) + self.state = 321 + localctx.ref = self.match(CoreDSL2Parser.IDENTIFIER) + self.state = 322 + self.match(CoreDSL2Parser.T__19) + self.state = 331 + self._errHandler.sync(self) + _la = self._input.LA(1) + if (((_la) & ~0x3f) == 0 and ((1 << _la) & 1148417956520132608) != 0) or ((((_la - 93)) & ~0x3f) == 0 and ((1 << (_la - 93)) & 127) != 0): + self.state = 323 + localctx._expression = self.expression(0) + localctx.args.append(localctx._expression) + self.state = 328 + self._errHandler.sync(self) + _la = self._input.LA(1) + while _la==4: + self.state = 324 + self.match(CoreDSL2Parser.T__3) + self.state = 325 + localctx._expression = self.expression(0) + localctx.args.append(localctx._expression) + self.state = 330 + self._errHandler.sync(self) + _la = self._input.LA(1) + + + + self.state = 333 + self.match(CoreDSL2Parser.T__20) + self.state = 334 + self.match(CoreDSL2Parser.T__9) + pass + + elif la_ == 3: + localctx = CoreDSL2Parser.If_statementContext(self, localctx) + self.enterOuterAlt(localctx, 3) + self.state = 335 + localctx.type_ = self.match(CoreDSL2Parser.T__21) + self.state = 336 + self.match(CoreDSL2Parser.T__19) + self.state = 337 + localctx._expression = self.expression(0) + localctx.cond.append(localctx._expression) + self.state = 338 + self.match(CoreDSL2Parser.T__20) + self.state = 339 + localctx._statement = self.statement() + localctx.stmt.append(localctx._statement) + self.state = 349 + self._errHandler.sync(self) + _alt = self._interp.adaptivePredict(self._input,34,self._ctx) + while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER: + if _alt==1: + self.state = 340 + self.match(CoreDSL2Parser.T__22) + self.state = 341 + self.match(CoreDSL2Parser.T__21) + self.state = 342 + self.match(CoreDSL2Parser.T__19) + self.state = 343 + localctx._expression = self.expression(0) + localctx.cond.append(localctx._expression) + self.state = 344 + self.match(CoreDSL2Parser.T__20) + self.state = 345 + localctx._statement = self.statement() + localctx.stmt.append(localctx._statement) + self.state = 351 + self._errHandler.sync(self) + _alt = self._interp.adaptivePredict(self._input,34,self._ctx) + + self.state = 354 + self._errHandler.sync(self) + la_ = self._interp.adaptivePredict(self._input,35,self._ctx) + if la_ == 1: + self.state = 352 + self.match(CoreDSL2Parser.T__22) + self.state = 353 + localctx._statement = self.statement() + localctx.stmt.append(localctx._statement) + + + pass + + elif la_ == 4: + localctx = CoreDSL2Parser.For_statementContext(self, localctx) + self.enterOuterAlt(localctx, 4) + self.state = 356 + localctx.type_ = self.match(CoreDSL2Parser.T__23) + self.state = 357 + self.match(CoreDSL2Parser.T__19) + self.state = 358 + localctx.cond = self.for_condition() + self.state = 359 + self.match(CoreDSL2Parser.T__20) + self.state = 360 + localctx.stmt = self.statement() + pass + + elif la_ == 5: + localctx = CoreDSL2Parser.While_statementContext(self, localctx) + self.enterOuterAlt(localctx, 5) + self.state = 362 + localctx.type_ = self.match(CoreDSL2Parser.T__24) + self.state = 363 + self.match(CoreDSL2Parser.T__19) + self.state = 364 + localctx.cond = self.expression(0) + self.state = 365 + self.match(CoreDSL2Parser.T__20) + self.state = 366 + localctx.stmt = self.statement() + pass + + elif la_ == 6: + localctx = CoreDSL2Parser.Do_statementContext(self, localctx) + self.enterOuterAlt(localctx, 6) + self.state = 368 + localctx.type_ = self.match(CoreDSL2Parser.T__25) + self.state = 369 + localctx.stmt = self.statement() + self.state = 370 + self.match(CoreDSL2Parser.T__24) + self.state = 371 + self.match(CoreDSL2Parser.T__19) + self.state = 372 + localctx.cond = self.expression(0) + self.state = 373 + self.match(CoreDSL2Parser.T__20) + self.state = 374 + self.match(CoreDSL2Parser.T__9) + pass + + elif la_ == 7: + localctx = CoreDSL2Parser.Switch_statementContext(self, localctx) + self.enterOuterAlt(localctx, 7) + self.state = 376 + localctx.type_ = self.match(CoreDSL2Parser.T__26) + self.state = 377 + self.match(CoreDSL2Parser.T__19) + self.state = 378 + localctx.cond = self.expression(0) + self.state = 379 + self.match(CoreDSL2Parser.T__20) + self.state = 380 + self.match(CoreDSL2Parser.T__4) + self.state = 384 + self._errHandler.sync(self) + _alt = self._interp.adaptivePredict(self._input,36,self._ctx) + while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER: + if _alt==1: + self.state = 381 + localctx._switch_block_statement_group = self.switch_block_statement_group() + localctx.items.append(localctx._switch_block_statement_group) + self.state = 386 + self._errHandler.sync(self) + _alt = self._interp.adaptivePredict(self._input,36,self._ctx) + + self.state = 390 + self._errHandler.sync(self) + _la = self._input.LA(1) + while _la==32 or _la==33: + self.state = 387 + self.switch_label() + self.state = 392 + self._errHandler.sync(self) + _la = self._input.LA(1) + + self.state = 393 + self.match(CoreDSL2Parser.T__5) + pass + + elif la_ == 8: + localctx = CoreDSL2Parser.Return_statementContext(self, localctx) + self.enterOuterAlt(localctx, 8) + self.state = 395 + localctx.type_ = self.match(CoreDSL2Parser.T__27) + self.state = 397 + self._errHandler.sync(self) + _la = self._input.LA(1) + if (((_la) & ~0x3f) == 0 and ((1 << _la) & 1148417956520132608) != 0) or ((((_la - 93)) & ~0x3f) == 0 and ((1 << (_la - 93)) & 127) != 0): + self.state = 396 + localctx.expr = self.expression(0) + + + self.state = 399 + self.match(CoreDSL2Parser.T__9) + pass + + elif la_ == 9: + localctx = CoreDSL2Parser.Break_statementContext(self, localctx) + self.enterOuterAlt(localctx, 9) + self.state = 400 + localctx.type_ = self.match(CoreDSL2Parser.T__28) + self.state = 401 + self.match(CoreDSL2Parser.T__9) + pass + + elif la_ == 10: + localctx = CoreDSL2Parser.Continue_statementContext(self, localctx) + self.enterOuterAlt(localctx, 10) + self.state = 402 + localctx.type_ = self.match(CoreDSL2Parser.T__29) + self.state = 403 + self.match(CoreDSL2Parser.T__9) + pass + + elif la_ == 11: + localctx = CoreDSL2Parser.Spawn_statementContext(self, localctx) + self.enterOuterAlt(localctx, 11) + self.state = 404 + localctx.type_ = self.match(CoreDSL2Parser.T__30) + self.state = 405 + localctx.stmt = self.statement() + pass + + elif la_ == 12: + localctx = CoreDSL2Parser.Expression_statementContext(self, localctx) + self.enterOuterAlt(localctx, 12) + self.state = 406 + localctx.expr = self.expression(0) + self.state = 407 + self.match(CoreDSL2Parser.T__9) + pass + + + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class Switch_block_statement_groupContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + self._switch_label = None # Switch_labelContext + self.labels = list() # of Switch_labelContexts + self._statement = None # StatementContext + self.statements = list() # of StatementContexts + + def switch_label(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(CoreDSL2Parser.Switch_labelContext) + else: + return self.getTypedRuleContext(CoreDSL2Parser.Switch_labelContext,i) + + + def statement(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(CoreDSL2Parser.StatementContext) + else: + return self.getTypedRuleContext(CoreDSL2Parser.StatementContext,i) + + + def getRuleIndex(self): + return CoreDSL2Parser.RULE_switch_block_statement_group + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterSwitch_block_statement_group" ): + listener.enterSwitch_block_statement_group(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitSwitch_block_statement_group" ): + listener.exitSwitch_block_statement_group(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitSwitch_block_statement_group" ): + return visitor.visitSwitch_block_statement_group(self) + else: + return visitor.visitChildren(self) + + + + + def switch_block_statement_group(self): + + localctx = CoreDSL2Parser.Switch_block_statement_groupContext(self, self._ctx, self.state) + self.enterRule(localctx, 24, self.RULE_switch_block_statement_group) + self._la = 0 # Token type + try: + self.enterOuterAlt(localctx, 1) + self.state = 412 + self._errHandler.sync(self) + _la = self._input.LA(1) + while True: + self.state = 411 + localctx._switch_label = self.switch_label() + localctx.labels.append(localctx._switch_label) + self.state = 414 + self._errHandler.sync(self) + _la = self._input.LA(1) + if not (_la==32 or _la==33): + break + + self.state = 417 + self._errHandler.sync(self) + _la = self._input.LA(1) + while True: + self.state = 416 + localctx._statement = self.statement() + localctx.statements.append(localctx._statement) + self.state = 419 + self._errHandler.sync(self) + _la = self._input.LA(1) + if not ((((_la) & ~0x3f) == 0 and ((1 << _la) & 1148417960802517024) != 0) or ((((_la - 93)) & ~0x3f) == 0 and ((1 << (_la - 93)) & 127) != 0)): + break + + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class Switch_labelContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + self.const_expr = None # ExpressionContext + + def expression(self): + return self.getTypedRuleContext(CoreDSL2Parser.ExpressionContext,0) + + + def getRuleIndex(self): + return CoreDSL2Parser.RULE_switch_label + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterSwitch_label" ): + listener.enterSwitch_label(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitSwitch_label" ): + listener.exitSwitch_label(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitSwitch_label" ): + return visitor.visitSwitch_label(self) + else: + return visitor.visitChildren(self) + + + + + def switch_label(self): + + localctx = CoreDSL2Parser.Switch_labelContext(self, self._ctx, self.state) + self.enterRule(localctx, 26, self.RULE_switch_label) + try: + self.state = 427 + self._errHandler.sync(self) + token = self._input.LA(1) + if token in [32]: + self.enterOuterAlt(localctx, 1) + self.state = 421 + self.match(CoreDSL2Parser.T__31) + self.state = 422 + localctx.const_expr = self.expression(0) + self.state = 423 + self.match(CoreDSL2Parser.T__14) + pass + elif token in [33]: + self.enterOuterAlt(localctx, 2) + self.state = 425 + self.match(CoreDSL2Parser.T__32) + self.state = 426 + self.match(CoreDSL2Parser.T__14) + pass + else: + raise NoViableAltException(self) + + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class BlockContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + self._block_item = None # Block_itemContext + self.items = list() # of Block_itemContexts + + def block_item(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(CoreDSL2Parser.Block_itemContext) + else: + return self.getTypedRuleContext(CoreDSL2Parser.Block_itemContext,i) + + + def getRuleIndex(self): + return CoreDSL2Parser.RULE_block + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterBlock" ): + listener.enterBlock(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitBlock" ): + listener.exitBlock(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitBlock" ): + return visitor.visitBlock(self) + else: + return visitor.visitChildren(self) + + + + + def block(self): + + localctx = CoreDSL2Parser.BlockContext(self, self._ctx, self.state) + self.enterRule(localctx, 28, self.RULE_block) + self._la = 0 # Token type + try: + self.enterOuterAlt(localctx, 1) + self.state = 429 + self.match(CoreDSL2Parser.T__4) + self.state = 433 + self._errHandler.sync(self) + _la = self._input.LA(1) + while (((_la) & ~0x3f) == 0 and ((1 << _la) & 1149543585831976992) != 0) or ((((_la - 85)) & ~0x3f) == 0 and ((1 << (_la - 85)) & 32575) != 0): + self.state = 430 + localctx._block_item = self.block_item() + localctx.items.append(localctx._block_item) + self.state = 435 + self._errHandler.sync(self) + _la = self._input.LA(1) + + self.state = 436 + self.match(CoreDSL2Parser.T__5) + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class Block_itemContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def statement(self): + return self.getTypedRuleContext(CoreDSL2Parser.StatementContext,0) + + + def declaration(self): + return self.getTypedRuleContext(CoreDSL2Parser.DeclarationContext,0) + + + def getRuleIndex(self): + return CoreDSL2Parser.RULE_block_item + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterBlock_item" ): + listener.enterBlock_item(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitBlock_item" ): + listener.exitBlock_item(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitBlock_item" ): + return visitor.visitBlock_item(self) + else: + return visitor.visitChildren(self) + + + + + def block_item(self): + + localctx = CoreDSL2Parser.Block_itemContext(self, self._ctx, self.state) + self.enterRule(localctx, 30, self.RULE_block_item) + try: + self.state = 440 + self._errHandler.sync(self) + token = self._input.LA(1) + if token in [5, 20, 22, 24, 25, 26, 27, 28, 29, 30, 31, 34, 35, 52, 53, 54, 55, 56, 57, 58, 59, 93, 94, 95, 96, 97, 98, 99]: + self.enterOuterAlt(localctx, 1) + self.state = 438 + self.statement() + pass + elif token in [19, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 85, 86, 87, 88, 89, 90]: + self.enterOuterAlt(localctx, 2) + self.state = 439 + self.declaration() + pass + else: + raise NoViableAltException(self) + + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class For_conditionContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + self.start_decl = None # DeclarationContext + self.start_expr = None # ExpressionContext + self.end_expr = None # ExpressionContext + self._expression = None # ExpressionContext + self.loop_exprs = list() # of ExpressionContexts + + def declaration(self): + return self.getTypedRuleContext(CoreDSL2Parser.DeclarationContext,0) + + + def expression(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(CoreDSL2Parser.ExpressionContext) + else: + return self.getTypedRuleContext(CoreDSL2Parser.ExpressionContext,i) + + + def getRuleIndex(self): + return CoreDSL2Parser.RULE_for_condition + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterFor_condition" ): + listener.enterFor_condition(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitFor_condition" ): + listener.exitFor_condition(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitFor_condition" ): + return visitor.visitFor_condition(self) + else: + return visitor.visitChildren(self) + + + + + def for_condition(self): + + localctx = CoreDSL2Parser.For_conditionContext(self, self._ctx, self.state) + self.enterRule(localctx, 32, self.RULE_for_condition) + self._la = 0 # Token type + try: + self.enterOuterAlt(localctx, 1) + self.state = 447 + self._errHandler.sync(self) + token = self._input.LA(1) + if token in [19, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 85, 86, 87, 88, 89, 90]: + self.state = 442 + localctx.start_decl = self.declaration() + pass + elif token in [10, 20, 34, 35, 52, 53, 54, 55, 56, 57, 58, 59, 93, 94, 95, 96, 97, 98, 99]: + self.state = 444 + self._errHandler.sync(self) + _la = self._input.LA(1) + if (((_la) & ~0x3f) == 0 and ((1 << _la) & 1148417956520132608) != 0) or ((((_la - 93)) & ~0x3f) == 0 and ((1 << (_la - 93)) & 127) != 0): + self.state = 443 + localctx.start_expr = self.expression(0) + + + self.state = 446 + self.match(CoreDSL2Parser.T__9) + pass + else: + raise NoViableAltException(self) + + self.state = 450 + self._errHandler.sync(self) + _la = self._input.LA(1) + if (((_la) & ~0x3f) == 0 and ((1 << _la) & 1148417956520132608) != 0) or ((((_la - 93)) & ~0x3f) == 0 and ((1 << (_la - 93)) & 127) != 0): + self.state = 449 + localctx.end_expr = self.expression(0) + + + self.state = 452 + self.match(CoreDSL2Parser.T__9) + self.state = 461 + self._errHandler.sync(self) + _la = self._input.LA(1) + if (((_la) & ~0x3f) == 0 and ((1 << _la) & 1148417956520132608) != 0) or ((((_la - 93)) & ~0x3f) == 0 and ((1 << (_la - 93)) & 127) != 0): + self.state = 453 + localctx._expression = self.expression(0) + localctx.loop_exprs.append(localctx._expression) + self.state = 458 + self._errHandler.sync(self) + _la = self._input.LA(1) + while _la==4: + self.state = 454 + self.match(CoreDSL2Parser.T__3) + self.state = 455 + localctx._expression = self.expression(0) + localctx.loop_exprs.append(localctx._expression) + self.state = 460 + self._errHandler.sync(self) + _la = self._input.LA(1) + + + + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class DeclarationContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + self._storage_class_specifier = None # Storage_class_specifierContext + self.storage = list() # of Storage_class_specifierContexts + self._type_qualifier = None # Type_qualifierContext + self.qualifiers = list() # of Type_qualifierContexts + self._attribute = None # AttributeContext + self.attributes = list() # of AttributeContexts + self.type_ = None # Type_specifierContext + self._declarator = None # DeclaratorContext + self.declarations = list() # of DeclaratorContexts + + def type_specifier(self): + return self.getTypedRuleContext(CoreDSL2Parser.Type_specifierContext,0) + + + def storage_class_specifier(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(CoreDSL2Parser.Storage_class_specifierContext) + else: + return self.getTypedRuleContext(CoreDSL2Parser.Storage_class_specifierContext,i) + + + def type_qualifier(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(CoreDSL2Parser.Type_qualifierContext) + else: + return self.getTypedRuleContext(CoreDSL2Parser.Type_qualifierContext,i) + + + def attribute(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(CoreDSL2Parser.AttributeContext) + else: + return self.getTypedRuleContext(CoreDSL2Parser.AttributeContext,i) + + + def declarator(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(CoreDSL2Parser.DeclaratorContext) + else: + return self.getTypedRuleContext(CoreDSL2Parser.DeclaratorContext,i) + + + def getRuleIndex(self): + return CoreDSL2Parser.RULE_declaration + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterDeclaration" ): + listener.enterDeclaration(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitDeclaration" ): + listener.exitDeclaration(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitDeclaration" ): + return visitor.visitDeclaration(self) + else: + return visitor.visitChildren(self) + + + + + def declaration(self): + + localctx = CoreDSL2Parser.DeclarationContext(self, self._ctx, self.state) + self.enterRule(localctx, 34, self.RULE_declaration) + self._la = 0 # Token type + try: + self.enterOuterAlt(localctx, 1) + self.state = 468 + self._errHandler.sync(self) + _la = self._input.LA(1) + while _la==19 or _la==49 or ((((_la - 85)) & ~0x3f) == 0 and ((1 << (_la - 85)) & 15) != 0): + self.state = 466 + self._errHandler.sync(self) + token = self._input.LA(1) + if token in [19, 87, 88]: + self.state = 463 + localctx._storage_class_specifier = self.storage_class_specifier() + localctx.storage.append(localctx._storage_class_specifier) + pass + elif token in [85, 86]: + self.state = 464 + localctx._type_qualifier = self.type_qualifier() + localctx.qualifiers.append(localctx._type_qualifier) + pass + elif token in [49]: + self.state = 465 + localctx._attribute = self.attribute() + localctx.attributes.append(localctx._attribute) + pass + else: + raise NoViableAltException(self) + + self.state = 470 + self._errHandler.sync(self) + _la = self._input.LA(1) + + self.state = 471 + localctx.type_ = self.type_specifier() + self.state = 480 + self._errHandler.sync(self) + _la = self._input.LA(1) + if _la==96: + self.state = 472 + localctx._declarator = self.declarator() + localctx.declarations.append(localctx._declarator) + self.state = 477 + self._errHandler.sync(self) + _la = self._input.LA(1) + while _la==4: + self.state = 473 + self.match(CoreDSL2Parser.T__3) + self.state = 474 + localctx._declarator = self.declarator() + localctx.declarations.append(localctx._declarator) + self.state = 479 + self._errHandler.sync(self) + _la = self._input.LA(1) + + + + self.state = 482 + self.match(CoreDSL2Parser.T__9) + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class Type_specifierContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + self.type_ = None # Value_type_specifierContext + self.ptr = None # Token + + def value_type_specifier(self): + return self.getTypedRuleContext(CoreDSL2Parser.Value_type_specifierContext,0) + + + def getRuleIndex(self): + return CoreDSL2Parser.RULE_type_specifier + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterType_specifier" ): + listener.enterType_specifier(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitType_specifier" ): + listener.exitType_specifier(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitType_specifier" ): + return visitor.visitType_specifier(self) + else: + return visitor.visitChildren(self) + + + + + def type_specifier(self): + + localctx = CoreDSL2Parser.Type_specifierContext(self, self._ctx, self.state) + self.enterRule(localctx, 36, self.RULE_type_specifier) + try: + self.enterOuterAlt(localctx, 1) + self.state = 484 + localctx.type_ = self.value_type_specifier() + self.state = 487 + self._errHandler.sync(self) + token = self._input.LA(1) + if token in [34]: + self.state = 485 + localctx.ptr = self.match(CoreDSL2Parser.T__33) + pass + elif token in [35]: + self.state = 486 + localctx.ptr = self.match(CoreDSL2Parser.T__34) + pass + elif token in [4, 10, 21, 96]: + pass + else: + pass + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class Value_type_specifierContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + + def getRuleIndex(self): + return CoreDSL2Parser.RULE_value_type_specifier + + + def copyFrom(self, ctx:ParserRuleContext): + super().copyFrom(ctx) + + + + class Composite_declarationContext(Value_type_specifierContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a CoreDSL2Parser.Value_type_specifierContext + super().__init__(parser) + self.type_ = None # Struct_or_unionContext + self.name = None # Token + self._struct_declaration = None # Struct_declarationContext + self.declarations = list() # of Struct_declarationContexts + self.copyFrom(ctx) + + def struct_or_union(self): + return self.getTypedRuleContext(CoreDSL2Parser.Struct_or_unionContext,0) + + def IDENTIFIER(self): + return self.getToken(CoreDSL2Parser.IDENTIFIER, 0) + def struct_declaration(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(CoreDSL2Parser.Struct_declarationContext) + else: + return self.getTypedRuleContext(CoreDSL2Parser.Struct_declarationContext,i) + + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterComposite_declaration" ): + listener.enterComposite_declaration(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitComposite_declaration" ): + listener.exitComposite_declaration(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitComposite_declaration" ): + return visitor.visitComposite_declaration(self) + else: + return visitor.visitChildren(self) + + + class Composite_referenceContext(Value_type_specifierContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a CoreDSL2Parser.Value_type_specifierContext + super().__init__(parser) + self.type_ = None # Struct_or_unionContext + self.name = None # Token + self.copyFrom(ctx) + + def struct_or_union(self): + return self.getTypedRuleContext(CoreDSL2Parser.Struct_or_unionContext,0) + + def IDENTIFIER(self): + return self.getToken(CoreDSL2Parser.IDENTIFIER, 0) + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterComposite_reference" ): + listener.enterComposite_reference(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitComposite_reference" ): + listener.exitComposite_reference(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitComposite_reference" ): + return visitor.visitComposite_reference(self) + else: + return visitor.visitChildren(self) + + + class Enum_declarationContext(Value_type_specifierContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a CoreDSL2Parser.Value_type_specifierContext + super().__init__(parser) + self.type_ = None # Token + self.name = None # Token + self.copyFrom(ctx) + + def enumerator_list(self): + return self.getTypedRuleContext(CoreDSL2Parser.Enumerator_listContext,0) + + def IDENTIFIER(self): + return self.getToken(CoreDSL2Parser.IDENTIFIER, 0) + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterEnum_declaration" ): + listener.enterEnum_declaration(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitEnum_declaration" ): + listener.exitEnum_declaration(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitEnum_declaration" ): + return visitor.visitEnum_declaration(self) + else: + return visitor.visitChildren(self) + + + class Void_typeContext(Value_type_specifierContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a CoreDSL2Parser.Value_type_specifierContext + super().__init__(parser) + self.type_ = None # Token + self.copyFrom(ctx) + + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterVoid_type" ): + listener.enterVoid_type(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitVoid_type" ): + listener.exitVoid_type(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitVoid_type" ): + return visitor.visitVoid_type(self) + else: + return visitor.visitChildren(self) + + + class Enum_referenceContext(Value_type_specifierContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a CoreDSL2Parser.Value_type_specifierContext + super().__init__(parser) + self.type_ = None # Token + self.name = None # Token + self.copyFrom(ctx) + + def IDENTIFIER(self): + return self.getToken(CoreDSL2Parser.IDENTIFIER, 0) + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterEnum_reference" ): + listener.enterEnum_reference(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitEnum_reference" ): + listener.exitEnum_reference(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitEnum_reference" ): + return visitor.visitEnum_reference(self) + else: + return visitor.visitChildren(self) + + + class Float_typeContext(Value_type_specifierContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a CoreDSL2Parser.Value_type_specifierContext + super().__init__(parser) + self.shorthand = None # Float_shorthandContext + self.copyFrom(ctx) + + def float_shorthand(self): + return self.getTypedRuleContext(CoreDSL2Parser.Float_shorthandContext,0) + + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterFloat_type" ): + listener.enterFloat_type(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitFloat_type" ): + listener.exitFloat_type(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitFloat_type" ): + return visitor.visitFloat_type(self) + else: + return visitor.visitChildren(self) + + + class Bool_typeContext(Value_type_specifierContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a CoreDSL2Parser.Value_type_specifierContext + super().__init__(parser) + self.type_ = None # Token + self.copyFrom(ctx) + + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterBool_type" ): + listener.enterBool_type(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitBool_type" ): + listener.exitBool_type(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitBool_type" ): + return visitor.visitBool_type(self) + else: + return visitor.visitChildren(self) + + + class Integer_typeContext(Value_type_specifierContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a CoreDSL2Parser.Value_type_specifierContext + super().__init__(parser) + self.signed = None # Integer_signednessContext + self.shorthand = None # Integer_shorthandContext + self.size = None # PrimaryContext + self.copyFrom(ctx) + + def integer_signedness(self): + return self.getTypedRuleContext(CoreDSL2Parser.Integer_signednessContext,0) + + def integer_shorthand(self): + return self.getTypedRuleContext(CoreDSL2Parser.Integer_shorthandContext,0) + + def primary(self): + return self.getTypedRuleContext(CoreDSL2Parser.PrimaryContext,0) + + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterInteger_type" ): + listener.enterInteger_type(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitInteger_type" ): + listener.exitInteger_type(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitInteger_type" ): + return visitor.visitInteger_type(self) + else: + return visitor.visitChildren(self) + + + + def value_type_specifier(self): + + localctx = CoreDSL2Parser.Value_type_specifierContext(self, self._ctx, self.state) + self.enterRule(localctx, 38, self.RULE_value_type_specifier) + self._la = 0 # Token type + try: + self.state = 530 + self._errHandler.sync(self) + la_ = self._interp.adaptivePredict(self._input,60,self._ctx) + if la_ == 1: + localctx = CoreDSL2Parser.Integer_typeContext(self, localctx) + self.enterOuterAlt(localctx, 1) + self.state = 489 + localctx.signed = self.integer_signedness() + self.state = 495 + self._errHandler.sync(self) + token = self._input.LA(1) + if token in [43, 44, 45, 46]: + self.state = 490 + localctx.shorthand = self.integer_shorthand() + pass + elif token in [36]: + self.state = 491 + self.match(CoreDSL2Parser.T__35) + self.state = 492 + localctx.size = self.primary() + self.state = 493 + self.match(CoreDSL2Parser.T__36) + pass + else: + raise NoViableAltException(self) + + pass + + elif la_ == 2: + localctx = CoreDSL2Parser.Integer_typeContext(self, localctx) + self.enterOuterAlt(localctx, 2) + self.state = 497 + localctx.shorthand = self.integer_shorthand() + pass + + elif la_ == 3: + localctx = CoreDSL2Parser.Float_typeContext(self, localctx) + self.enterOuterAlt(localctx, 3) + self.state = 498 + localctx.shorthand = self.float_shorthand() + pass + + elif la_ == 4: + localctx = CoreDSL2Parser.Bool_typeContext(self, localctx) + self.enterOuterAlt(localctx, 4) + self.state = 499 + localctx.type_ = self.match(CoreDSL2Parser.T__37) + pass + + elif la_ == 5: + localctx = CoreDSL2Parser.Void_typeContext(self, localctx) + self.enterOuterAlt(localctx, 5) + self.state = 500 + localctx.type_ = self.match(CoreDSL2Parser.T__38) + pass + + elif la_ == 6: + localctx = CoreDSL2Parser.Composite_declarationContext(self, localctx) + self.enterOuterAlt(localctx, 6) + self.state = 501 + localctx.type_ = self.struct_or_union() + self.state = 503 + self._errHandler.sync(self) + _la = self._input.LA(1) + if _la==96: + self.state = 502 + localctx.name = self.match(CoreDSL2Parser.IDENTIFIER) + + + self.state = 505 + self.match(CoreDSL2Parser.T__4) + self.state = 509 + self._errHandler.sync(self) + _la = self._input.LA(1) + while ((((_la - 38)) & ~0x3f) == 0 and ((1 << (_la - 38)) & 7177611906123775) != 0): + self.state = 506 + localctx._struct_declaration = self.struct_declaration() + localctx.declarations.append(localctx._struct_declaration) + self.state = 511 + self._errHandler.sync(self) + _la = self._input.LA(1) + + self.state = 512 + self.match(CoreDSL2Parser.T__5) + pass + + elif la_ == 7: + localctx = CoreDSL2Parser.Composite_referenceContext(self, localctx) + self.enterOuterAlt(localctx, 7) + self.state = 514 + localctx.type_ = self.struct_or_union() + self.state = 515 + localctx.name = self.match(CoreDSL2Parser.IDENTIFIER) + pass + + elif la_ == 8: + localctx = CoreDSL2Parser.Enum_declarationContext(self, localctx) + self.enterOuterAlt(localctx, 8) + self.state = 517 + localctx.type_ = self.match(CoreDSL2Parser.T__39) + self.state = 519 + self._errHandler.sync(self) + _la = self._input.LA(1) + if _la==96: + self.state = 518 + localctx.name = self.match(CoreDSL2Parser.IDENTIFIER) + + + self.state = 521 + self.match(CoreDSL2Parser.T__4) + self.state = 522 + self.enumerator_list() + self.state = 524 + self._errHandler.sync(self) + _la = self._input.LA(1) + if _la==4: + self.state = 523 + self.match(CoreDSL2Parser.T__3) + + + self.state = 526 + self.match(CoreDSL2Parser.T__5) + pass + + elif la_ == 9: + localctx = CoreDSL2Parser.Enum_referenceContext(self, localctx) + self.enterOuterAlt(localctx, 9) + self.state = 528 + localctx.type_ = self.match(CoreDSL2Parser.T__39) + self.state = 529 + localctx.name = self.match(CoreDSL2Parser.IDENTIFIER) + pass + + + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class Integer_signednessContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + + def getRuleIndex(self): + return CoreDSL2Parser.RULE_integer_signedness + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterInteger_signedness" ): + listener.enterInteger_signedness(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitInteger_signedness" ): + listener.exitInteger_signedness(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitInteger_signedness" ): + return visitor.visitInteger_signedness(self) + else: + return visitor.visitChildren(self) + + + + + def integer_signedness(self): + + localctx = CoreDSL2Parser.Integer_signednessContext(self, self._ctx, self.state) + self.enterRule(localctx, 40, self.RULE_integer_signedness) + self._la = 0 # Token type + try: + self.enterOuterAlt(localctx, 1) + self.state = 532 + _la = self._input.LA(1) + if not(_la==41 or _la==42): + self._errHandler.recoverInline(self) + else: + self._errHandler.reportMatch(self) + self.consume() + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class Integer_shorthandContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + + def getRuleIndex(self): + return CoreDSL2Parser.RULE_integer_shorthand + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterInteger_shorthand" ): + listener.enterInteger_shorthand(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitInteger_shorthand" ): + listener.exitInteger_shorthand(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitInteger_shorthand" ): + return visitor.visitInteger_shorthand(self) + else: + return visitor.visitChildren(self) + + + + + def integer_shorthand(self): + + localctx = CoreDSL2Parser.Integer_shorthandContext(self, self._ctx, self.state) + self.enterRule(localctx, 42, self.RULE_integer_shorthand) + self._la = 0 # Token type + try: + self.enterOuterAlt(localctx, 1) + self.state = 534 + _la = self._input.LA(1) + if not((((_la) & ~0x3f) == 0 and ((1 << _la) & 131941395333120) != 0)): + self._errHandler.recoverInline(self) + else: + self._errHandler.reportMatch(self) + self.consume() + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class Float_shorthandContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + + def getRuleIndex(self): + return CoreDSL2Parser.RULE_float_shorthand + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterFloat_shorthand" ): + listener.enterFloat_shorthand(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitFloat_shorthand" ): + listener.exitFloat_shorthand(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitFloat_shorthand" ): + return visitor.visitFloat_shorthand(self) + else: + return visitor.visitChildren(self) + + + + + def float_shorthand(self): + + localctx = CoreDSL2Parser.Float_shorthandContext(self, self._ctx, self.state) + self.enterRule(localctx, 44, self.RULE_float_shorthand) + self._la = 0 # Token type + try: + self.enterOuterAlt(localctx, 1) + self.state = 536 + _la = self._input.LA(1) + if not(_la==47 or _la==48): + self._errHandler.recoverInline(self) + else: + self._errHandler.reportMatch(self) + self.consume() + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class AttributeContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + self.name = None # Token + self._expression = None # ExpressionContext + self.params = list() # of ExpressionContexts + + def IDENTIFIER(self): + return self.getToken(CoreDSL2Parser.IDENTIFIER, 0) + + def expression(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(CoreDSL2Parser.ExpressionContext) + else: + return self.getTypedRuleContext(CoreDSL2Parser.ExpressionContext,i) + + + def getRuleIndex(self): + return CoreDSL2Parser.RULE_attribute + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterAttribute" ): + listener.enterAttribute(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitAttribute" ): + listener.exitAttribute(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitAttribute" ): + return visitor.visitAttribute(self) + else: + return visitor.visitChildren(self) + + + + + def attribute(self): + + localctx = CoreDSL2Parser.AttributeContext(self, self._ctx, self.state) + self.enterRule(localctx, 46, self.RULE_attribute) + self._la = 0 # Token type + try: + self.enterOuterAlt(localctx, 1) + self.state = 538 + self.match(CoreDSL2Parser.T__48) + self.state = 539 + localctx.name = self.match(CoreDSL2Parser.IDENTIFIER) + self.state = 553 + self._errHandler.sync(self) + token = self._input.LA(1) + if token in [50]: + self.state = 540 + self.match(CoreDSL2Parser.T__49) + self.state = 541 + localctx._expression = self.expression(0) + localctx.params.append(localctx._expression) + pass + elif token in [20]: + self.state = 542 + self.match(CoreDSL2Parser.T__19) + self.state = 543 + localctx._expression = self.expression(0) + localctx.params.append(localctx._expression) + self.state = 548 + self._errHandler.sync(self) + _la = self._input.LA(1) + while _la==4: + self.state = 544 + self.match(CoreDSL2Parser.T__3) + self.state = 545 + localctx._expression = self.expression(0) + localctx.params.append(localctx._expression) + self.state = 550 + self._errHandler.sync(self) + _la = self._input.LA(1) + + self.state = 551 + self.match(CoreDSL2Parser.T__20) + pass + elif token in [51]: + pass + else: + pass + self.state = 555 + self.match(CoreDSL2Parser.T__50) + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class Bit_size_specifierContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + self._primary = None # PrimaryContext + self.size = list() # of PrimaryContexts + + def primary(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(CoreDSL2Parser.PrimaryContext) + else: + return self.getTypedRuleContext(CoreDSL2Parser.PrimaryContext,i) + + + def getRuleIndex(self): + return CoreDSL2Parser.RULE_bit_size_specifier + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterBit_size_specifier" ): + listener.enterBit_size_specifier(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitBit_size_specifier" ): + listener.exitBit_size_specifier(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitBit_size_specifier" ): + return visitor.visitBit_size_specifier(self) + else: + return visitor.visitChildren(self) + + + + + def bit_size_specifier(self): + + localctx = CoreDSL2Parser.Bit_size_specifierContext(self, self._ctx, self.state) + self.enterRule(localctx, 48, self.RULE_bit_size_specifier) + self._la = 0 # Token type + try: + self.enterOuterAlt(localctx, 1) + self.state = 557 + self.match(CoreDSL2Parser.T__35) + self.state = 558 + localctx._primary = self.primary() + localctx.size.append(localctx._primary) + self.state = 566 + self._errHandler.sync(self) + _la = self._input.LA(1) + if _la==4: + self.state = 559 + self.match(CoreDSL2Parser.T__3) + self.state = 560 + localctx._primary = self.primary() + localctx.size.append(localctx._primary) + self.state = 561 + self.match(CoreDSL2Parser.T__3) + self.state = 562 + localctx._primary = self.primary() + localctx.size.append(localctx._primary) + self.state = 563 + self.match(CoreDSL2Parser.T__3) + self.state = 564 + localctx._primary = self.primary() + localctx.size.append(localctx._primary) + + + self.state = 568 + self.match(CoreDSL2Parser.T__36) + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class Enumerator_listContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + self._enumerator = None # EnumeratorContext + self.enumerators = list() # of EnumeratorContexts + + def enumerator(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(CoreDSL2Parser.EnumeratorContext) + else: + return self.getTypedRuleContext(CoreDSL2Parser.EnumeratorContext,i) + + + def getRuleIndex(self): + return CoreDSL2Parser.RULE_enumerator_list + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterEnumerator_list" ): + listener.enterEnumerator_list(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitEnumerator_list" ): + listener.exitEnumerator_list(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitEnumerator_list" ): + return visitor.visitEnumerator_list(self) + else: + return visitor.visitChildren(self) + + + + + def enumerator_list(self): + + localctx = CoreDSL2Parser.Enumerator_listContext(self, self._ctx, self.state) + self.enterRule(localctx, 50, self.RULE_enumerator_list) + try: + self.enterOuterAlt(localctx, 1) + self.state = 570 + localctx._enumerator = self.enumerator() + localctx.enumerators.append(localctx._enumerator) + self.state = 575 + self._errHandler.sync(self) + _alt = self._interp.adaptivePredict(self._input,64,self._ctx) + while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER: + if _alt==1: + self.state = 571 + self.match(CoreDSL2Parser.T__3) + self.state = 572 + localctx._enumerator = self.enumerator() + localctx.enumerators.append(localctx._enumerator) + self.state = 577 + self._errHandler.sync(self) + _alt = self._interp.adaptivePredict(self._input,64,self._ctx) + + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class EnumeratorContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + self.name = None # Token + + def IDENTIFIER(self): + return self.getToken(CoreDSL2Parser.IDENTIFIER, 0) + + def expression(self): + return self.getTypedRuleContext(CoreDSL2Parser.ExpressionContext,0) + + + def getRuleIndex(self): + return CoreDSL2Parser.RULE_enumerator + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterEnumerator" ): + listener.enterEnumerator(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitEnumerator" ): + listener.exitEnumerator(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitEnumerator" ): + return visitor.visitEnumerator(self) + else: + return visitor.visitChildren(self) + + + + + def enumerator(self): + + localctx = CoreDSL2Parser.EnumeratorContext(self, self._ctx, self.state) + self.enterRule(localctx, 52, self.RULE_enumerator) + try: + self.state = 582 + self._errHandler.sync(self) + la_ = self._interp.adaptivePredict(self._input,65,self._ctx) + if la_ == 1: + self.enterOuterAlt(localctx, 1) + self.state = 578 + localctx.name = self.match(CoreDSL2Parser.IDENTIFIER) + pass + + elif la_ == 2: + self.enterOuterAlt(localctx, 2) + self.state = 579 + localctx.name = self.match(CoreDSL2Parser.IDENTIFIER) + self.state = 580 + self.match(CoreDSL2Parser.T__49) + self.state = 581 + self.expression(0) + pass + + + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class Struct_declarationContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + self.specifier = None # Struct_declaration_specifierContext + self._declarator = None # DeclaratorContext + self.declarators = list() # of DeclaratorContexts + + def struct_declaration_specifier(self): + return self.getTypedRuleContext(CoreDSL2Parser.Struct_declaration_specifierContext,0) + + + def declarator(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(CoreDSL2Parser.DeclaratorContext) + else: + return self.getTypedRuleContext(CoreDSL2Parser.DeclaratorContext,i) + + + def getRuleIndex(self): + return CoreDSL2Parser.RULE_struct_declaration + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterStruct_declaration" ): + listener.enterStruct_declaration(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitStruct_declaration" ): + listener.exitStruct_declaration(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitStruct_declaration" ): + return visitor.visitStruct_declaration(self) + else: + return visitor.visitChildren(self) + + + + + def struct_declaration(self): + + localctx = CoreDSL2Parser.Struct_declarationContext(self, self._ctx, self.state) + self.enterRule(localctx, 54, self.RULE_struct_declaration) + self._la = 0 # Token type + try: + self.enterOuterAlt(localctx, 1) + self.state = 584 + localctx.specifier = self.struct_declaration_specifier() + self.state = 585 + localctx._declarator = self.declarator() + localctx.declarators.append(localctx._declarator) + self.state = 590 + self._errHandler.sync(self) + _la = self._input.LA(1) + while _la==4: + self.state = 586 + self.match(CoreDSL2Parser.T__3) + self.state = 587 + localctx._declarator = self.declarator() + localctx.declarators.append(localctx._declarator) + self.state = 592 + self._errHandler.sync(self) + _la = self._input.LA(1) + + self.state = 593 + self.match(CoreDSL2Parser.T__9) + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class Struct_declaration_specifierContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + self.type_ = None # Type_specifierContext + self._type_qualifier = None # Type_qualifierContext + self.qualifiers = list() # of Type_qualifierContexts + + def type_specifier(self): + return self.getTypedRuleContext(CoreDSL2Parser.Type_specifierContext,0) + + + def type_qualifier(self): + return self.getTypedRuleContext(CoreDSL2Parser.Type_qualifierContext,0) + + + def getRuleIndex(self): + return CoreDSL2Parser.RULE_struct_declaration_specifier + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterStruct_declaration_specifier" ): + listener.enterStruct_declaration_specifier(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitStruct_declaration_specifier" ): + listener.exitStruct_declaration_specifier(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitStruct_declaration_specifier" ): + return visitor.visitStruct_declaration_specifier(self) + else: + return visitor.visitChildren(self) + + + + + def struct_declaration_specifier(self): + + localctx = CoreDSL2Parser.Struct_declaration_specifierContext(self, self._ctx, self.state) + self.enterRule(localctx, 56, self.RULE_struct_declaration_specifier) + try: + self.state = 597 + self._errHandler.sync(self) + token = self._input.LA(1) + if token in [38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 89, 90]: + self.enterOuterAlt(localctx, 1) + self.state = 595 + localctx.type_ = self.type_specifier() + pass + elif token in [85, 86]: + self.enterOuterAlt(localctx, 2) + self.state = 596 + localctx._type_qualifier = self.type_qualifier() + localctx.qualifiers.append(localctx._type_qualifier) + pass + else: + raise NoViableAltException(self) + + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class DeclaratorContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + self.name = None # Token + self._expression = None # ExpressionContext + self.size = list() # of ExpressionContexts + self._attribute = None # AttributeContext + self.attributes = list() # of AttributeContexts + self.init = None # InitializerContext + + def IDENTIFIER(self): + return self.getToken(CoreDSL2Parser.IDENTIFIER, 0) + + def LEFT_BR(self, i:int=None): + if i is None: + return self.getTokens(CoreDSL2Parser.LEFT_BR) + else: + return self.getToken(CoreDSL2Parser.LEFT_BR, i) + + def RIGHT_BR(self, i:int=None): + if i is None: + return self.getTokens(CoreDSL2Parser.RIGHT_BR) + else: + return self.getToken(CoreDSL2Parser.RIGHT_BR, i) + + def expression(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(CoreDSL2Parser.ExpressionContext) + else: + return self.getTypedRuleContext(CoreDSL2Parser.ExpressionContext,i) + + + def attribute(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(CoreDSL2Parser.AttributeContext) + else: + return self.getTypedRuleContext(CoreDSL2Parser.AttributeContext,i) + + + def initializer(self): + return self.getTypedRuleContext(CoreDSL2Parser.InitializerContext,0) + + + def getRuleIndex(self): + return CoreDSL2Parser.RULE_declarator + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterDeclarator" ): + listener.enterDeclarator(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitDeclarator" ): + listener.exitDeclarator(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitDeclarator" ): + return visitor.visitDeclarator(self) + else: + return visitor.visitChildren(self) + + + + + def declarator(self): + + localctx = CoreDSL2Parser.DeclaratorContext(self, self._ctx, self.state) + self.enterRule(localctx, 58, self.RULE_declarator) + self._la = 0 # Token type + try: + self.enterOuterAlt(localctx, 1) + self.state = 599 + localctx.name = self.match(CoreDSL2Parser.IDENTIFIER) + self.state = 606 + self._errHandler.sync(self) + _la = self._input.LA(1) + while _la==91: + self.state = 600 + self.match(CoreDSL2Parser.LEFT_BR) + self.state = 601 + localctx._expression = self.expression(0) + localctx.size.append(localctx._expression) + self.state = 602 + self.match(CoreDSL2Parser.RIGHT_BR) + self.state = 608 + self._errHandler.sync(self) + _la = self._input.LA(1) + + self.state = 612 + self._errHandler.sync(self) + _la = self._input.LA(1) + while _la==49: + self.state = 609 + localctx._attribute = self.attribute() + localctx.attributes.append(localctx._attribute) + self.state = 614 + self._errHandler.sync(self) + _la = self._input.LA(1) + + self.state = 617 + self._errHandler.sync(self) + _la = self._input.LA(1) + if _la==50: + self.state = 615 + self.match(CoreDSL2Parser.T__49) + self.state = 616 + localctx.init = self.initializer() + + + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class InitializerContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + self.expr = None # ExpressionContext + + def expression(self): + return self.getTypedRuleContext(CoreDSL2Parser.ExpressionContext,0) + + + def initializerList(self): + return self.getTypedRuleContext(CoreDSL2Parser.InitializerListContext,0) + + + def getRuleIndex(self): + return CoreDSL2Parser.RULE_initializer + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterInitializer" ): + listener.enterInitializer(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitInitializer" ): + listener.exitInitializer(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitInitializer" ): + return visitor.visitInitializer(self) + else: + return visitor.visitChildren(self) + + + + + def initializer(self): + + localctx = CoreDSL2Parser.InitializerContext(self, self._ctx, self.state) + self.enterRule(localctx, 60, self.RULE_initializer) + self._la = 0 # Token type + try: + self.state = 627 + self._errHandler.sync(self) + token = self._input.LA(1) + if token in [20, 34, 35, 52, 53, 54, 55, 56, 57, 58, 59, 93, 94, 95, 96, 97, 98, 99]: + self.enterOuterAlt(localctx, 1) + self.state = 619 + localctx.expr = self.expression(0) + pass + elif token in [5]: + self.enterOuterAlt(localctx, 2) + self.state = 620 + self.match(CoreDSL2Parser.T__4) + self.state = 621 + self.initializerList() + self.state = 623 + self._errHandler.sync(self) + _la = self._input.LA(1) + if _la==4: + self.state = 622 + self.match(CoreDSL2Parser.T__3) + + + self.state = 625 + self.match(CoreDSL2Parser.T__5) + pass + else: + raise NoViableAltException(self) + + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class InitializerListContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def designated_initializer(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(CoreDSL2Parser.Designated_initializerContext) + else: + return self.getTypedRuleContext(CoreDSL2Parser.Designated_initializerContext,i) + + + def initializer(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(CoreDSL2Parser.InitializerContext) + else: + return self.getTypedRuleContext(CoreDSL2Parser.InitializerContext,i) + + + def getRuleIndex(self): + return CoreDSL2Parser.RULE_initializerList + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterInitializerList" ): + listener.enterInitializerList(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitInitializerList" ): + listener.exitInitializerList(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitInitializerList" ): + return visitor.visitInitializerList(self) + else: + return visitor.visitChildren(self) + + + + + def initializerList(self): + + localctx = CoreDSL2Parser.InitializerListContext(self, self._ctx, self.state) + self.enterRule(localctx, 62, self.RULE_initializerList) + try: + self.enterOuterAlt(localctx, 1) + self.state = 631 + self._errHandler.sync(self) + la_ = self._interp.adaptivePredict(self._input,73,self._ctx) + if la_ == 1: + self.state = 629 + self.designated_initializer() + pass + + elif la_ == 2: + self.state = 630 + self.initializer() + pass + + + self.state = 640 + self._errHandler.sync(self) + _alt = self._interp.adaptivePredict(self._input,75,self._ctx) + while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER: + if _alt==1: + self.state = 633 + self.match(CoreDSL2Parser.T__3) + self.state = 636 + self._errHandler.sync(self) + la_ = self._interp.adaptivePredict(self._input,74,self._ctx) + if la_ == 1: + self.state = 634 + self.designated_initializer() + pass + + elif la_ == 2: + self.state = 635 + self.initializer() + pass + + + self.state = 642 + self._errHandler.sync(self) + _alt = self._interp.adaptivePredict(self._input,75,self._ctx) + + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class Designated_initializerContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + self._designator = None # DesignatorContext + self.designators = list() # of DesignatorContexts + self.init = None # InitializerContext + + def initializer(self): + return self.getTypedRuleContext(CoreDSL2Parser.InitializerContext,0) + + + def designator(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(CoreDSL2Parser.DesignatorContext) + else: + return self.getTypedRuleContext(CoreDSL2Parser.DesignatorContext,i) + + + def getRuleIndex(self): + return CoreDSL2Parser.RULE_designated_initializer + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterDesignated_initializer" ): + listener.enterDesignated_initializer(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitDesignated_initializer" ): + listener.exitDesignated_initializer(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitDesignated_initializer" ): + return visitor.visitDesignated_initializer(self) + else: + return visitor.visitChildren(self) + + + + + def designated_initializer(self): + + localctx = CoreDSL2Parser.Designated_initializerContext(self, self._ctx, self.state) + self.enterRule(localctx, 64, self.RULE_designated_initializer) + self._la = 0 # Token type + try: + self.enterOuterAlt(localctx, 1) + self.state = 644 + self._errHandler.sync(self) + _la = self._input.LA(1) + while True: + self.state = 643 + localctx._designator = self.designator() + localctx.designators.append(localctx._designator) + self.state = 646 + self._errHandler.sync(self) + _la = self._input.LA(1) + if not (_la==52 or _la==91): + break + + self.state = 648 + self.match(CoreDSL2Parser.T__49) + self.state = 649 + localctx.init = self.initializer() + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class DesignatorContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + self.idx = None # ExpressionContext + self.prop = None # Token + + def LEFT_BR(self): + return self.getToken(CoreDSL2Parser.LEFT_BR, 0) + + def RIGHT_BR(self): + return self.getToken(CoreDSL2Parser.RIGHT_BR, 0) + + def expression(self): + return self.getTypedRuleContext(CoreDSL2Parser.ExpressionContext,0) + + + def IDENTIFIER(self): + return self.getToken(CoreDSL2Parser.IDENTIFIER, 0) + + def getRuleIndex(self): + return CoreDSL2Parser.RULE_designator + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterDesignator" ): + listener.enterDesignator(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitDesignator" ): + listener.exitDesignator(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitDesignator" ): + return visitor.visitDesignator(self) + else: + return visitor.visitChildren(self) + + + + + def designator(self): + + localctx = CoreDSL2Parser.DesignatorContext(self, self._ctx, self.state) + self.enterRule(localctx, 66, self.RULE_designator) + try: + self.state = 657 + self._errHandler.sync(self) + token = self._input.LA(1) + if token in [91]: + self.enterOuterAlt(localctx, 1) + self.state = 651 + self.match(CoreDSL2Parser.LEFT_BR) + self.state = 652 + localctx.idx = self.expression(0) + self.state = 653 + self.match(CoreDSL2Parser.RIGHT_BR) + pass + elif token in [52]: + self.enterOuterAlt(localctx, 2) + self.state = 655 + self.match(CoreDSL2Parser.T__51) + self.state = 656 + localctx.prop = self.match(CoreDSL2Parser.IDENTIFIER) + pass + else: + raise NoViableAltException(self) + + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class ExpressionContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + + def getRuleIndex(self): + return CoreDSL2Parser.RULE_expression + + + def copyFrom(self, ctx:ParserRuleContext): + super().copyFrom(ctx) + + + class Cast_expressionContext(ExpressionContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a CoreDSL2Parser.ExpressionContext + super().__init__(parser) + self.type_ = None # Type_specifierContext + self.sign = None # Integer_signednessContext + self.right = None # ExpressionContext + self.copyFrom(ctx) + + def expression(self): + return self.getTypedRuleContext(CoreDSL2Parser.ExpressionContext,0) + + def type_specifier(self): + return self.getTypedRuleContext(CoreDSL2Parser.Type_specifierContext,0) + + def integer_signedness(self): + return self.getTypedRuleContext(CoreDSL2Parser.Integer_signednessContext,0) + + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterCast_expression" ): + listener.enterCast_expression(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitCast_expression" ): + listener.exitCast_expression(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitCast_expression" ): + return visitor.visitCast_expression(self) + else: + return visitor.visitChildren(self) + + + class Binary_expressionContext(ExpressionContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a CoreDSL2Parser.ExpressionContext + super().__init__(parser) + self.left = None # ExpressionContext + self.bop = None # Token + self.right = None # ExpressionContext + self.copyFrom(ctx) + + def expression(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(CoreDSL2Parser.ExpressionContext) + else: + return self.getTypedRuleContext(CoreDSL2Parser.ExpressionContext,i) + + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterBinary_expression" ): + listener.enterBinary_expression(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitBinary_expression" ): + listener.exitBinary_expression(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitBinary_expression" ): + return visitor.visitBinary_expression(self) + else: + return visitor.visitChildren(self) + + + class Preinc_expressionContext(ExpressionContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a CoreDSL2Parser.ExpressionContext + super().__init__(parser) + self.op = None # Token + self.right = None # ExpressionContext + self.copyFrom(ctx) + + def expression(self): + return self.getTypedRuleContext(CoreDSL2Parser.ExpressionContext,0) + + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterPreinc_expression" ): + listener.enterPreinc_expression(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitPreinc_expression" ): + listener.exitPreinc_expression(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitPreinc_expression" ): + return visitor.visitPreinc_expression(self) + else: + return visitor.visitChildren(self) + + + class Conditional_expressionContext(ExpressionContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a CoreDSL2Parser.ExpressionContext + super().__init__(parser) + self.cond = None # ExpressionContext + self.bop = None # Token + self.then_expr = None # ExpressionContext + self.else_expr = None # ExpressionContext + self.copyFrom(ctx) + + def expression(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(CoreDSL2Parser.ExpressionContext) + else: + return self.getTypedRuleContext(CoreDSL2Parser.ExpressionContext,i) + + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterConditional_expression" ): + listener.enterConditional_expression(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitConditional_expression" ): + listener.exitConditional_expression(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitConditional_expression" ): + return visitor.visitConditional_expression(self) + else: + return visitor.visitChildren(self) + + + class Deref_expressionContext(ExpressionContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a CoreDSL2Parser.ExpressionContext + super().__init__(parser) + self.bop = None # Token + self.ref = None # Token + self.copyFrom(ctx) + + def IDENTIFIER(self): + return self.getToken(CoreDSL2Parser.IDENTIFIER, 0) + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterDeref_expression" ): + listener.enterDeref_expression(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitDeref_expression" ): + listener.exitDeref_expression(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitDeref_expression" ): + return visitor.visitDeref_expression(self) + else: + return visitor.visitChildren(self) + + + class Prefix_expressionContext(ExpressionContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a CoreDSL2Parser.ExpressionContext + super().__init__(parser) + self.prefix = None # Token + self.right = None # ExpressionContext + self.copyFrom(ctx) + + def expression(self): + return self.getTypedRuleContext(CoreDSL2Parser.ExpressionContext,0) + + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterPrefix_expression" ): + listener.enterPrefix_expression(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitPrefix_expression" ): + listener.exitPrefix_expression(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitPrefix_expression" ): + return visitor.visitPrefix_expression(self) + else: + return visitor.visitChildren(self) + + + class Postinc_expressionContext(ExpressionContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a CoreDSL2Parser.ExpressionContext + super().__init__(parser) + self.left = None # ExpressionContext + self.op = None # Token + self.copyFrom(ctx) + + def expression(self): + return self.getTypedRuleContext(CoreDSL2Parser.ExpressionContext,0) + + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterPostinc_expression" ): + listener.enterPostinc_expression(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitPostinc_expression" ): + listener.exitPostinc_expression(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitPostinc_expression" ): + return visitor.visitPostinc_expression(self) + else: + return visitor.visitChildren(self) + + + class Concat_expressionContext(ExpressionContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a CoreDSL2Parser.ExpressionContext + super().__init__(parser) + self.left = None # ExpressionContext + self.bop = None # Token + self.right = None # ExpressionContext + self.copyFrom(ctx) + + def expression(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(CoreDSL2Parser.ExpressionContext) + else: + return self.getTypedRuleContext(CoreDSL2Parser.ExpressionContext,i) + + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterConcat_expression" ): + listener.enterConcat_expression(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitConcat_expression" ): + listener.exitConcat_expression(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitConcat_expression" ): + return visitor.visitConcat_expression(self) + else: + return visitor.visitChildren(self) + + + class Assignment_expressionContext(ExpressionContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a CoreDSL2Parser.ExpressionContext + super().__init__(parser) + self.left = None # ExpressionContext + self.bop = None # Token + self.right = None # ExpressionContext + self.copyFrom(ctx) + + def expression(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(CoreDSL2Parser.ExpressionContext) + else: + return self.getTypedRuleContext(CoreDSL2Parser.ExpressionContext,i) + + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterAssignment_expression" ): + listener.enterAssignment_expression(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitAssignment_expression" ): + listener.exitAssignment_expression(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitAssignment_expression" ): + return visitor.visitAssignment_expression(self) + else: + return visitor.visitChildren(self) + + + class Method_callContext(ExpressionContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a CoreDSL2Parser.ExpressionContext + super().__init__(parser) + self.ref = None # Token + self._expression = None # ExpressionContext + self.args = list() # of ExpressionContexts + self.copyFrom(ctx) + + def IDENTIFIER(self): + return self.getToken(CoreDSL2Parser.IDENTIFIER, 0) + def expression(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(CoreDSL2Parser.ExpressionContext) + else: + return self.getTypedRuleContext(CoreDSL2Parser.ExpressionContext,i) + + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterMethod_call" ): + listener.enterMethod_call(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitMethod_call" ): + listener.exitMethod_call(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitMethod_call" ): + return visitor.visitMethod_call(self) + else: + return visitor.visitChildren(self) + + + class Primary_expressionContext(ExpressionContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a CoreDSL2Parser.ExpressionContext + super().__init__(parser) + self.copyFrom(ctx) + + def primary(self): + return self.getTypedRuleContext(CoreDSL2Parser.PrimaryContext,0) + + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterPrimary_expression" ): + listener.enterPrimary_expression(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitPrimary_expression" ): + listener.exitPrimary_expression(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitPrimary_expression" ): + return visitor.visitPrimary_expression(self) + else: + return visitor.visitChildren(self) + + + class Slice_expressionContext(ExpressionContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a CoreDSL2Parser.ExpressionContext + super().__init__(parser) + self.expr = None # ExpressionContext + self.bop = None # Token + self.left = None # ExpressionContext + self.right = None # ExpressionContext + self.copyFrom(ctx) + + def RIGHT_BR(self): + return self.getToken(CoreDSL2Parser.RIGHT_BR, 0) + def expression(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(CoreDSL2Parser.ExpressionContext) + else: + return self.getTypedRuleContext(CoreDSL2Parser.ExpressionContext,i) + + def LEFT_BR(self): + return self.getToken(CoreDSL2Parser.LEFT_BR, 0) + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterSlice_expression" ): + listener.enterSlice_expression(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitSlice_expression" ): + listener.exitSlice_expression(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitSlice_expression" ): + return visitor.visitSlice_expression(self) + else: + return visitor.visitChildren(self) + + + + def expression(self, _p:int=0): + _parentctx = self._ctx + _parentState = self.state + localctx = CoreDSL2Parser.ExpressionContext(self, self._ctx, _parentState) + _prevctx = localctx + _startState = 68 + self.enterRecursionRule(localctx, 68, self.RULE_expression, _p) + self._la = 0 # Token type + try: + self.enterOuterAlt(localctx, 1) + self.state = 690 + self._errHandler.sync(self) + la_ = self._interp.adaptivePredict(self._input,81,self._ctx) + if la_ == 1: + localctx = CoreDSL2Parser.Primary_expressionContext(self, localctx) + self._ctx = localctx + _prevctx = localctx + + self.state = 660 + self.primary() + pass + + elif la_ == 2: + localctx = CoreDSL2Parser.Deref_expressionContext(self, localctx) + self._ctx = localctx + _prevctx = localctx + self.state = 661 + localctx.bop = self._input.LT(1) + _la = self._input.LA(1) + if not(_la==52 or _la==53): + localctx.bop = self._errHandler.recoverInline(self) + else: + self._errHandler.reportMatch(self) + self.consume() + self.state = 662 + localctx.ref = self.match(CoreDSL2Parser.IDENTIFIER) + pass + + elif la_ == 3: + localctx = CoreDSL2Parser.Method_callContext(self, localctx) + self._ctx = localctx + _prevctx = localctx + self.state = 663 + localctx.ref = self.match(CoreDSL2Parser.IDENTIFIER) + self.state = 664 + self.match(CoreDSL2Parser.T__19) + self.state = 673 + self._errHandler.sync(self) + _la = self._input.LA(1) + if (((_la) & ~0x3f) == 0 and ((1 << _la) & 1148417956520132608) != 0) or ((((_la - 93)) & ~0x3f) == 0 and ((1 << (_la - 93)) & 127) != 0): + self.state = 665 + localctx._expression = self.expression(0) + localctx.args.append(localctx._expression) + self.state = 670 + self._errHandler.sync(self) + _la = self._input.LA(1) + while _la==4: + self.state = 666 + self.match(CoreDSL2Parser.T__3) + self.state = 667 + localctx._expression = self.expression(0) + localctx.args.append(localctx._expression) + self.state = 672 + self._errHandler.sync(self) + _la = self._input.LA(1) + + + + self.state = 675 + self.match(CoreDSL2Parser.T__20) + pass + + elif la_ == 4: + localctx = CoreDSL2Parser.Preinc_expressionContext(self, localctx) + self._ctx = localctx + _prevctx = localctx + self.state = 676 + localctx.op = self._input.LT(1) + _la = self._input.LA(1) + if not(_la==54 or _la==55): + localctx.op = self._errHandler.recoverInline(self) + else: + self._errHandler.reportMatch(self) + self.consume() + self.state = 677 + localctx.right = self.expression(17) + pass + + elif la_ == 5: + localctx = CoreDSL2Parser.Prefix_expressionContext(self, localctx) + self._ctx = localctx + _prevctx = localctx + self.state = 678 + localctx.prefix = self._input.LT(1) + _la = self._input.LA(1) + if not((((_la) & ~0x3f) == 0 and ((1 << _la) & 216172833653391360) != 0)): + localctx.prefix = self._errHandler.recoverInline(self) + else: + self._errHandler.reportMatch(self) + self.consume() + self.state = 679 + localctx.right = self.expression(16) + pass + + elif la_ == 6: + localctx = CoreDSL2Parser.Prefix_expressionContext(self, localctx) + self._ctx = localctx + _prevctx = localctx + self.state = 680 + localctx.prefix = self._input.LT(1) + _la = self._input.LA(1) + if not(_la==58 or _la==59): + localctx.prefix = self._errHandler.recoverInline(self) + else: + self._errHandler.reportMatch(self) + self.consume() + self.state = 681 + localctx.right = self.expression(15) + pass + + elif la_ == 7: + localctx = CoreDSL2Parser.Cast_expressionContext(self, localctx) + self._ctx = localctx + _prevctx = localctx + self.state = 682 + self.match(CoreDSL2Parser.T__19) + self.state = 685 + self._errHandler.sync(self) + la_ = self._interp.adaptivePredict(self._input,80,self._ctx) + if la_ == 1: + self.state = 683 + localctx.type_ = self.type_specifier() + pass + + elif la_ == 2: + self.state = 684 + localctx.sign = self.integer_signedness() + pass + + + self.state = 687 + self.match(CoreDSL2Parser.T__20) + self.state = 688 + localctx.right = self.expression(14) + pass + + + self._ctx.stop = self._input.LT(-1) + self.state = 747 + self._errHandler.sync(self) + _alt = self._interp.adaptivePredict(self._input,84,self._ctx) + while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER: + if _alt==1: + if self._parseListeners is not None: + self.triggerExitRuleEvent() + _prevctx = localctx + self.state = 745 + self._errHandler.sync(self) + la_ = self._interp.adaptivePredict(self._input,83,self._ctx) + if la_ == 1: + localctx = CoreDSL2Parser.Binary_expressionContext(self, CoreDSL2Parser.ExpressionContext(self, _parentctx, _parentState)) + localctx.left = _prevctx + self.pushNewRecursionContext(localctx, _startState, self.RULE_expression) + self.state = 692 + if not self.precpred(self._ctx, 13): + from antlr4.error.Errors import FailedPredicateException + raise FailedPredicateException(self, "self.precpred(self._ctx, 13)") + self.state = 693 + localctx.bop = self._input.LT(1) + _la = self._input.LA(1) + if not((((_la) & ~0x3f) == 0 and ((1 << _la) & 3458764531000410112) != 0)): + localctx.bop = self._errHandler.recoverInline(self) + else: + self._errHandler.reportMatch(self) + self.consume() + self.state = 694 + localctx.right = self.expression(14) + pass + + elif la_ == 2: + localctx = CoreDSL2Parser.Binary_expressionContext(self, CoreDSL2Parser.ExpressionContext(self, _parentctx, _parentState)) + localctx.left = _prevctx + self.pushNewRecursionContext(localctx, _startState, self.RULE_expression) + self.state = 695 + if not self.precpred(self._ctx, 12): + from antlr4.error.Errors import FailedPredicateException + raise FailedPredicateException(self, "self.precpred(self._ctx, 12)") + self.state = 696 + localctx.bop = self._input.LT(1) + _la = self._input.LA(1) + if not(_la==56 or _la==57): + localctx.bop = self._errHandler.recoverInline(self) + else: + self._errHandler.reportMatch(self) + self.consume() + self.state = 697 + localctx.right = self.expression(13) + pass + + elif la_ == 3: + localctx = CoreDSL2Parser.Binary_expressionContext(self, CoreDSL2Parser.ExpressionContext(self, _parentctx, _parentState)) + localctx.left = _prevctx + self.pushNewRecursionContext(localctx, _startState, self.RULE_expression) + self.state = 698 + if not self.precpred(self._ctx, 11): + from antlr4.error.Errors import FailedPredicateException + raise FailedPredicateException(self, "self.precpred(self._ctx, 11)") + self.state = 699 + localctx.bop = self._input.LT(1) + _la = self._input.LA(1) + if not(_la==62 or _la==63): + localctx.bop = self._errHandler.recoverInline(self) + else: + self._errHandler.reportMatch(self) + self.consume() + self.state = 700 + localctx.right = self.expression(12) + pass + + elif la_ == 4: + localctx = CoreDSL2Parser.Binary_expressionContext(self, CoreDSL2Parser.ExpressionContext(self, _parentctx, _parentState)) + localctx.left = _prevctx + self.pushNewRecursionContext(localctx, _startState, self.RULE_expression) + self.state = 701 + if not self.precpred(self._ctx, 10): + from antlr4.error.Errors import FailedPredicateException + raise FailedPredicateException(self, "self.precpred(self._ctx, 10)") + self.state = 702 + localctx.bop = self._input.LT(1) + _la = self._input.LA(1) + if not(((((_la - 36)) & ~0x3f) == 0 and ((1 << (_la - 36)) & 805306371) != 0)): + localctx.bop = self._errHandler.recoverInline(self) + else: + self._errHandler.reportMatch(self) + self.consume() + self.state = 703 + localctx.right = self.expression(11) + pass + + elif la_ == 5: + localctx = CoreDSL2Parser.Binary_expressionContext(self, CoreDSL2Parser.ExpressionContext(self, _parentctx, _parentState)) + localctx.left = _prevctx + self.pushNewRecursionContext(localctx, _startState, self.RULE_expression) + self.state = 704 + if not self.precpred(self._ctx, 9): + from antlr4.error.Errors import FailedPredicateException + raise FailedPredicateException(self, "self.precpred(self._ctx, 9)") + self.state = 705 + localctx.bop = self._input.LT(1) + _la = self._input.LA(1) + if not(_la==66 or _la==67): + localctx.bop = self._errHandler.recoverInline(self) + else: + self._errHandler.reportMatch(self) + self.consume() + self.state = 706 + localctx.right = self.expression(10) + pass + + elif la_ == 6: + localctx = CoreDSL2Parser.Binary_expressionContext(self, CoreDSL2Parser.ExpressionContext(self, _parentctx, _parentState)) + localctx.left = _prevctx + self.pushNewRecursionContext(localctx, _startState, self.RULE_expression) + self.state = 707 + if not self.precpred(self._ctx, 8): + from antlr4.error.Errors import FailedPredicateException + raise FailedPredicateException(self, "self.precpred(self._ctx, 8)") + self.state = 708 + localctx.bop = self.match(CoreDSL2Parser.T__34) + self.state = 709 + localctx.right = self.expression(9) + pass + + elif la_ == 7: + localctx = CoreDSL2Parser.Binary_expressionContext(self, CoreDSL2Parser.ExpressionContext(self, _parentctx, _parentState)) + localctx.left = _prevctx + self.pushNewRecursionContext(localctx, _startState, self.RULE_expression) + self.state = 710 + if not self.precpred(self._ctx, 7): + from antlr4.error.Errors import FailedPredicateException + raise FailedPredicateException(self, "self.precpred(self._ctx, 7)") + self.state = 711 + localctx.bop = self.match(CoreDSL2Parser.T__67) + self.state = 712 + localctx.right = self.expression(8) + pass + + elif la_ == 8: + localctx = CoreDSL2Parser.Binary_expressionContext(self, CoreDSL2Parser.ExpressionContext(self, _parentctx, _parentState)) + localctx.left = _prevctx + self.pushNewRecursionContext(localctx, _startState, self.RULE_expression) + self.state = 713 + if not self.precpred(self._ctx, 6): + from antlr4.error.Errors import FailedPredicateException + raise FailedPredicateException(self, "self.precpred(self._ctx, 6)") + self.state = 714 + localctx.bop = self.match(CoreDSL2Parser.T__68) + self.state = 715 + localctx.right = self.expression(7) + pass + + elif la_ == 9: + localctx = CoreDSL2Parser.Binary_expressionContext(self, CoreDSL2Parser.ExpressionContext(self, _parentctx, _parentState)) + localctx.left = _prevctx + self.pushNewRecursionContext(localctx, _startState, self.RULE_expression) + self.state = 716 + if not self.precpred(self._ctx, 5): + from antlr4.error.Errors import FailedPredicateException + raise FailedPredicateException(self, "self.precpred(self._ctx, 5)") + self.state = 717 + localctx.bop = self.match(CoreDSL2Parser.T__69) + self.state = 718 + localctx.right = self.expression(6) + pass + + elif la_ == 10: + localctx = CoreDSL2Parser.Binary_expressionContext(self, CoreDSL2Parser.ExpressionContext(self, _parentctx, _parentState)) + localctx.left = _prevctx + self.pushNewRecursionContext(localctx, _startState, self.RULE_expression) + self.state = 719 + if not self.precpred(self._ctx, 4): + from antlr4.error.Errors import FailedPredicateException + raise FailedPredicateException(self, "self.precpred(self._ctx, 4)") + self.state = 720 + localctx.bop = self.match(CoreDSL2Parser.T__70) + self.state = 721 + localctx.right = self.expression(5) + pass + + elif la_ == 11: + localctx = CoreDSL2Parser.Concat_expressionContext(self, CoreDSL2Parser.ExpressionContext(self, _parentctx, _parentState)) + localctx.left = _prevctx + self.pushNewRecursionContext(localctx, _startState, self.RULE_expression) + self.state = 722 + if not self.precpred(self._ctx, 3): + from antlr4.error.Errors import FailedPredicateException + raise FailedPredicateException(self, "self.precpred(self._ctx, 3)") + self.state = 723 + localctx.bop = self.match(CoreDSL2Parser.T__15) + self.state = 724 + localctx.right = self.expression(4) + pass + + elif la_ == 12: + localctx = CoreDSL2Parser.Conditional_expressionContext(self, CoreDSL2Parser.ExpressionContext(self, _parentctx, _parentState)) + localctx.cond = _prevctx + self.pushNewRecursionContext(localctx, _startState, self.RULE_expression) + self.state = 725 + if not self.precpred(self._ctx, 2): + from antlr4.error.Errors import FailedPredicateException + raise FailedPredicateException(self, "self.precpred(self._ctx, 2)") + self.state = 726 + localctx.bop = self.match(CoreDSL2Parser.T__71) + self.state = 727 + localctx.then_expr = self.expression(0) + self.state = 728 + self.match(CoreDSL2Parser.T__14) + self.state = 729 + localctx.else_expr = self.expression(2) + pass + + elif la_ == 13: + localctx = CoreDSL2Parser.Assignment_expressionContext(self, CoreDSL2Parser.ExpressionContext(self, _parentctx, _parentState)) + localctx.left = _prevctx + self.pushNewRecursionContext(localctx, _startState, self.RULE_expression) + self.state = 731 + if not self.precpred(self._ctx, 1): + from antlr4.error.Errors import FailedPredicateException + raise FailedPredicateException(self, "self.precpred(self._ctx, 1)") + self.state = 732 + localctx.bop = self._input.LT(1) + _la = self._input.LA(1) + if not(((((_la - 50)) & ~0x3f) == 0 and ((1 << (_la - 50)) & 17171480577) != 0)): + localctx.bop = self._errHandler.recoverInline(self) + else: + self._errHandler.reportMatch(self) + self.consume() + self.state = 733 + localctx.right = self.expression(1) + pass + + elif la_ == 14: + localctx = CoreDSL2Parser.Slice_expressionContext(self, CoreDSL2Parser.ExpressionContext(self, _parentctx, _parentState)) + localctx.expr = _prevctx + self.pushNewRecursionContext(localctx, _startState, self.RULE_expression) + self.state = 734 + if not self.precpred(self._ctx, 20): + from antlr4.error.Errors import FailedPredicateException + raise FailedPredicateException(self, "self.precpred(self._ctx, 20)") + self.state = 735 + localctx.bop = self.match(CoreDSL2Parser.LEFT_BR) + self.state = 736 + localctx.left = self.expression(0) + self.state = 739 + self._errHandler.sync(self) + _la = self._input.LA(1) + if _la==15: + self.state = 737 + self.match(CoreDSL2Parser.T__14) + self.state = 738 + localctx.right = self.expression(0) + + + self.state = 741 + self.match(CoreDSL2Parser.RIGHT_BR) + pass + + elif la_ == 15: + localctx = CoreDSL2Parser.Postinc_expressionContext(self, CoreDSL2Parser.ExpressionContext(self, _parentctx, _parentState)) + localctx.left = _prevctx + self.pushNewRecursionContext(localctx, _startState, self.RULE_expression) + self.state = 743 + if not self.precpred(self._ctx, 18): + from antlr4.error.Errors import FailedPredicateException + raise FailedPredicateException(self, "self.precpred(self._ctx, 18)") + self.state = 744 + localctx.op = self._input.LT(1) + _la = self._input.LA(1) + if not(_la==54 or _la==55): + localctx.op = self._errHandler.recoverInline(self) + else: + self._errHandler.reportMatch(self) + self.consume() + pass + + + self.state = 749 + self._errHandler.sync(self) + _alt = self._interp.adaptivePredict(self._input,84,self._ctx) + + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.unrollRecursionContexts(_parentctx) + return localctx + + + class PrimaryContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + + def getRuleIndex(self): + return CoreDSL2Parser.RULE_primary + + + def copyFrom(self, ctx:ParserRuleContext): + super().copyFrom(ctx) + + + + class Reference_expressionContext(PrimaryContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a CoreDSL2Parser.PrimaryContext + super().__init__(parser) + self.ref = None # Token + self.copyFrom(ctx) + + def IDENTIFIER(self): + return self.getToken(CoreDSL2Parser.IDENTIFIER, 0) + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterReference_expression" ): + listener.enterReference_expression(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitReference_expression" ): + listener.exitReference_expression(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitReference_expression" ): + return visitor.visitReference_expression(self) + else: + return visitor.visitChildren(self) + + + class Constant_expressionContext(PrimaryContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a CoreDSL2Parser.PrimaryContext + super().__init__(parser) + self.const_expr = None # ConstantContext + self.copyFrom(ctx) + + def constant(self): + return self.getTypedRuleContext(CoreDSL2Parser.ConstantContext,0) + + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterConstant_expression" ): + listener.enterConstant_expression(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitConstant_expression" ): + listener.exitConstant_expression(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitConstant_expression" ): + return visitor.visitConstant_expression(self) + else: + return visitor.visitChildren(self) + + + class Literal_expressionContext(PrimaryContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a CoreDSL2Parser.PrimaryContext + super().__init__(parser) + self._string_literal = None # String_literalContext + self.literal = list() # of String_literalContexts + self.copyFrom(ctx) + + def string_literal(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(CoreDSL2Parser.String_literalContext) + else: + return self.getTypedRuleContext(CoreDSL2Parser.String_literalContext,i) + + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterLiteral_expression" ): + listener.enterLiteral_expression(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitLiteral_expression" ): + listener.exitLiteral_expression(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitLiteral_expression" ): + return visitor.visitLiteral_expression(self) + else: + return visitor.visitChildren(self) + + + class Parens_expressionContext(PrimaryContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a CoreDSL2Parser.PrimaryContext + super().__init__(parser) + self.expr = None # ExpressionContext + self.copyFrom(ctx) + + def expression(self): + return self.getTypedRuleContext(CoreDSL2Parser.ExpressionContext,0) + + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterParens_expression" ): + listener.enterParens_expression(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitParens_expression" ): + listener.exitParens_expression(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitParens_expression" ): + return visitor.visitParens_expression(self) + else: + return visitor.visitChildren(self) + + + + def primary(self): + + localctx = CoreDSL2Parser.PrimaryContext(self, self._ctx, self.state) + self.enterRule(localctx, 70, self.RULE_primary) + try: + self.state = 761 + self._errHandler.sync(self) + la_ = self._interp.adaptivePredict(self._input,86,self._ctx) + if la_ == 1: + localctx = CoreDSL2Parser.Reference_expressionContext(self, localctx) + self.enterOuterAlt(localctx, 1) + self.state = 750 + localctx.ref = self.match(CoreDSL2Parser.IDENTIFIER) + pass + + elif la_ == 2: + localctx = CoreDSL2Parser.Constant_expressionContext(self, localctx) + self.enterOuterAlt(localctx, 2) + self.state = 751 + localctx.const_expr = self.constant() + pass + + elif la_ == 3: + localctx = CoreDSL2Parser.Literal_expressionContext(self, localctx) + self.enterOuterAlt(localctx, 3) + self.state = 753 + self._errHandler.sync(self) + _alt = 1 + while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER: + if _alt == 1: + self.state = 752 + localctx._string_literal = self.string_literal() + localctx.literal.append(localctx._string_literal) + + else: + raise NoViableAltException(self) + self.state = 755 + self._errHandler.sync(self) + _alt = self._interp.adaptivePredict(self._input,85,self._ctx) + + pass + + elif la_ == 4: + localctx = CoreDSL2Parser.Parens_expressionContext(self, localctx) + self.enterOuterAlt(localctx, 4) + self.state = 757 + self.match(CoreDSL2Parser.T__19) + self.state = 758 + localctx.expr = self.expression(0) + self.state = 759 + self.match(CoreDSL2Parser.T__20) + pass + + + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class String_literalContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def ENCSTRINGCONST(self): + return self.getToken(CoreDSL2Parser.ENCSTRINGCONST, 0) + + def STRING(self): + return self.getToken(CoreDSL2Parser.STRING, 0) + + def getRuleIndex(self): + return CoreDSL2Parser.RULE_string_literal + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterString_literal" ): + listener.enterString_literal(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitString_literal" ): + listener.exitString_literal(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitString_literal" ): + return visitor.visitString_literal(self) + else: + return visitor.visitChildren(self) + + + + + def string_literal(self): + + localctx = CoreDSL2Parser.String_literalContext(self, self._ctx, self.state) + self.enterRule(localctx, 72, self.RULE_string_literal) + self._la = 0 # Token type + try: + self.enterOuterAlt(localctx, 1) + self.state = 763 + _la = self._input.LA(1) + if not(_la==98 or _la==99): + self._errHandler.recoverInline(self) + else: + self._errHandler.reportMatch(self) + self.consume() + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class ConstantContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def integer_constant(self): + return self.getTypedRuleContext(CoreDSL2Parser.Integer_constantContext,0) + + + def floating_constant(self): + return self.getTypedRuleContext(CoreDSL2Parser.Floating_constantContext,0) + + + def character_constant(self): + return self.getTypedRuleContext(CoreDSL2Parser.Character_constantContext,0) + + + def string_constant(self): + return self.getTypedRuleContext(CoreDSL2Parser.String_constantContext,0) + + + def bool_constant(self): + return self.getTypedRuleContext(CoreDSL2Parser.Bool_constantContext,0) + + + def getRuleIndex(self): + return CoreDSL2Parser.RULE_constant + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterConstant" ): + listener.enterConstant(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitConstant" ): + listener.exitConstant(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitConstant" ): + return visitor.visitConstant(self) + else: + return visitor.visitChildren(self) + + + + + def constant(self): + + localctx = CoreDSL2Parser.ConstantContext(self, self._ctx, self.state) + self.enterRule(localctx, 74, self.RULE_constant) + try: + self.state = 770 + self._errHandler.sync(self) + token = self._input.LA(1) + if token in [95]: + self.enterOuterAlt(localctx, 1) + self.state = 765 + self.integer_constant() + pass + elif token in [94]: + self.enterOuterAlt(localctx, 2) + self.state = 766 + self.floating_constant() + pass + elif token in [97]: + self.enterOuterAlt(localctx, 3) + self.state = 767 + self.character_constant() + pass + elif token in [99]: + self.enterOuterAlt(localctx, 4) + self.state = 768 + self.string_constant() + pass + elif token in [93]: + self.enterOuterAlt(localctx, 5) + self.state = 769 + self.bool_constant() + pass + else: + raise NoViableAltException(self) + + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class Integer_constantContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + self.value = None # Token + + def INTEGER(self): + return self.getToken(CoreDSL2Parser.INTEGER, 0) + + def getRuleIndex(self): + return CoreDSL2Parser.RULE_integer_constant + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterInteger_constant" ): + listener.enterInteger_constant(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitInteger_constant" ): + listener.exitInteger_constant(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitInteger_constant" ): + return visitor.visitInteger_constant(self) + else: + return visitor.visitChildren(self) + + + + + def integer_constant(self): + + localctx = CoreDSL2Parser.Integer_constantContext(self, self._ctx, self.state) + self.enterRule(localctx, 76, self.RULE_integer_constant) + try: + self.enterOuterAlt(localctx, 1) + self.state = 772 + localctx.value = self.match(CoreDSL2Parser.INTEGER) + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class Floating_constantContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + self.value = None # Token + + def FLOAT(self): + return self.getToken(CoreDSL2Parser.FLOAT, 0) + + def getRuleIndex(self): + return CoreDSL2Parser.RULE_floating_constant + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterFloating_constant" ): + listener.enterFloating_constant(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitFloating_constant" ): + listener.exitFloating_constant(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitFloating_constant" ): + return visitor.visitFloating_constant(self) + else: + return visitor.visitChildren(self) + + + + + def floating_constant(self): + + localctx = CoreDSL2Parser.Floating_constantContext(self, self._ctx, self.state) + self.enterRule(localctx, 78, self.RULE_floating_constant) + try: + self.enterOuterAlt(localctx, 1) + self.state = 774 + localctx.value = self.match(CoreDSL2Parser.FLOAT) + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class Bool_constantContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + self.value = None # Token + + def BOOLEAN(self): + return self.getToken(CoreDSL2Parser.BOOLEAN, 0) + + def getRuleIndex(self): + return CoreDSL2Parser.RULE_bool_constant + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterBool_constant" ): + listener.enterBool_constant(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitBool_constant" ): + listener.exitBool_constant(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitBool_constant" ): + return visitor.visitBool_constant(self) + else: + return visitor.visitChildren(self) + + + + + def bool_constant(self): + + localctx = CoreDSL2Parser.Bool_constantContext(self, self._ctx, self.state) + self.enterRule(localctx, 80, self.RULE_bool_constant) + try: + self.enterOuterAlt(localctx, 1) + self.state = 776 + localctx.value = self.match(CoreDSL2Parser.BOOLEAN) + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class Character_constantContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + self.value = None # Token + + def CHARCONST(self): + return self.getToken(CoreDSL2Parser.CHARCONST, 0) + + def getRuleIndex(self): + return CoreDSL2Parser.RULE_character_constant + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterCharacter_constant" ): + listener.enterCharacter_constant(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitCharacter_constant" ): + listener.exitCharacter_constant(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitCharacter_constant" ): + return visitor.visitCharacter_constant(self) + else: + return visitor.visitChildren(self) + + + + + def character_constant(self): + + localctx = CoreDSL2Parser.Character_constantContext(self, self._ctx, self.state) + self.enterRule(localctx, 82, self.RULE_character_constant) + try: + self.enterOuterAlt(localctx, 1) + self.state = 778 + localctx.value = self.match(CoreDSL2Parser.CHARCONST) + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class String_constantContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + self.value = None # Token + + def STRING(self): + return self.getToken(CoreDSL2Parser.STRING, 0) + + def getRuleIndex(self): + return CoreDSL2Parser.RULE_string_constant + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterString_constant" ): + listener.enterString_constant(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitString_constant" ): + listener.exitString_constant(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitString_constant" ): + return visitor.visitString_constant(self) + else: + return visitor.visitChildren(self) + + + + + def string_constant(self): + + localctx = CoreDSL2Parser.String_constantContext(self, self._ctx, self.state) + self.enterRule(localctx, 84, self.RULE_string_constant) + try: + self.enterOuterAlt(localctx, 1) + self.state = 780 + localctx.value = self.match(CoreDSL2Parser.STRING) + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class Double_left_bracketContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def LEFT_BR(self, i:int=None): + if i is None: + return self.getTokens(CoreDSL2Parser.LEFT_BR) + else: + return self.getToken(CoreDSL2Parser.LEFT_BR, i) + + def getRuleIndex(self): + return CoreDSL2Parser.RULE_double_left_bracket + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterDouble_left_bracket" ): + listener.enterDouble_left_bracket(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitDouble_left_bracket" ): + listener.exitDouble_left_bracket(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitDouble_left_bracket" ): + return visitor.visitDouble_left_bracket(self) + else: + return visitor.visitChildren(self) + + + + + def double_left_bracket(self): + + localctx = CoreDSL2Parser.Double_left_bracketContext(self, self._ctx, self.state) + self.enterRule(localctx, 86, self.RULE_double_left_bracket) + try: + self.enterOuterAlt(localctx, 1) + self.state = 782 + self.match(CoreDSL2Parser.LEFT_BR) + self.state = 783 + self.match(CoreDSL2Parser.LEFT_BR) + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class Double_right_bracketContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def RIGHT_BR(self, i:int=None): + if i is None: + return self.getTokens(CoreDSL2Parser.RIGHT_BR) + else: + return self.getToken(CoreDSL2Parser.RIGHT_BR, i) + + def getRuleIndex(self): + return CoreDSL2Parser.RULE_double_right_bracket + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterDouble_right_bracket" ): + listener.enterDouble_right_bracket(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitDouble_right_bracket" ): + listener.exitDouble_right_bracket(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitDouble_right_bracket" ): + return visitor.visitDouble_right_bracket(self) + else: + return visitor.visitChildren(self) + + + + + def double_right_bracket(self): + + localctx = CoreDSL2Parser.Double_right_bracketContext(self, self._ctx, self.state) + self.enterRule(localctx, 88, self.RULE_double_right_bracket) + try: + self.enterOuterAlt(localctx, 1) + self.state = 785 + self.match(CoreDSL2Parser.RIGHT_BR) + self.state = 786 + self.match(CoreDSL2Parser.RIGHT_BR) + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class Data_typesContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + + def getRuleIndex(self): + return CoreDSL2Parser.RULE_data_types + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterData_types" ): + listener.enterData_types(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitData_types" ): + listener.exitData_types(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitData_types" ): + return visitor.visitData_types(self) + else: + return visitor.visitChildren(self) + + + + + def data_types(self): + + localctx = CoreDSL2Parser.Data_typesContext(self, self._ctx, self.state) + self.enterRule(localctx, 90, self.RULE_data_types) + self._la = 0 # Token type + try: + self.enterOuterAlt(localctx, 1) + self.state = 788 + _la = self._input.LA(1) + if not(((((_la - 38)) & ~0x3f) == 0 and ((1 << (_la - 38)) & 70368744179707) != 0)): + self._errHandler.recoverInline(self) + else: + self._errHandler.reportMatch(self) + self.consume() + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class Type_qualifierContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + + def getRuleIndex(self): + return CoreDSL2Parser.RULE_type_qualifier + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterType_qualifier" ): + listener.enterType_qualifier(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitType_qualifier" ): + listener.exitType_qualifier(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitType_qualifier" ): + return visitor.visitType_qualifier(self) + else: + return visitor.visitChildren(self) + + + + + def type_qualifier(self): + + localctx = CoreDSL2Parser.Type_qualifierContext(self, self._ctx, self.state) + self.enterRule(localctx, 92, self.RULE_type_qualifier) + self._la = 0 # Token type + try: + self.enterOuterAlt(localctx, 1) + self.state = 790 + _la = self._input.LA(1) + if not(_la==85 or _la==86): + self._errHandler.recoverInline(self) + else: + self._errHandler.reportMatch(self) + self.consume() + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class Storage_class_specifierContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + + def getRuleIndex(self): + return CoreDSL2Parser.RULE_storage_class_specifier + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterStorage_class_specifier" ): + listener.enterStorage_class_specifier(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitStorage_class_specifier" ): + listener.exitStorage_class_specifier(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitStorage_class_specifier" ): + return visitor.visitStorage_class_specifier(self) + else: + return visitor.visitChildren(self) + + + + + def storage_class_specifier(self): + + localctx = CoreDSL2Parser.Storage_class_specifierContext(self, self._ctx, self.state) + self.enterRule(localctx, 94, self.RULE_storage_class_specifier) + self._la = 0 # Token type + try: + self.enterOuterAlt(localctx, 1) + self.state = 792 + _la = self._input.LA(1) + if not(_la==19 or _la==87 or _la==88): + self._errHandler.recoverInline(self) + else: + self._errHandler.reportMatch(self) + self.consume() + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class Struct_or_unionContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + + def getRuleIndex(self): + return CoreDSL2Parser.RULE_struct_or_union + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterStruct_or_union" ): + listener.enterStruct_or_union(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitStruct_or_union" ): + listener.exitStruct_or_union(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitStruct_or_union" ): + return visitor.visitStruct_or_union(self) + else: + return visitor.visitChildren(self) + + + + + def struct_or_union(self): + + localctx = CoreDSL2Parser.Struct_or_unionContext(self, self._ctx, self.state) + self.enterRule(localctx, 96, self.RULE_struct_or_union) + self._la = 0 # Token type + try: + self.enterOuterAlt(localctx, 1) + self.state = 794 + _la = self._input.LA(1) + if not(_la==89 or _la==90): + self._errHandler.recoverInline(self) + else: + self._errHandler.reportMatch(self) + self.consume() + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + + def sempred(self, localctx:RuleContext, ruleIndex:int, predIndex:int): + if self._predicates == None: + self._predicates = dict() + self._predicates[34] = self.expression_sempred + pred = self._predicates.get(ruleIndex, None) + if pred is None: + raise Exception("No predicate with index:" + str(ruleIndex)) + else: + return pred(localctx, predIndex) + + def expression_sempred(self, localctx:ExpressionContext, predIndex:int): + if predIndex == 0: + return self.precpred(self._ctx, 13) + + + if predIndex == 1: + return self.precpred(self._ctx, 12) + + + if predIndex == 2: + return self.precpred(self._ctx, 11) + + + if predIndex == 3: + return self.precpred(self._ctx, 10) + + + if predIndex == 4: + return self.precpred(self._ctx, 9) + + + if predIndex == 5: + return self.precpred(self._ctx, 8) + + + if predIndex == 6: + return self.precpred(self._ctx, 7) + + + if predIndex == 7: + return self.precpred(self._ctx, 6) + + + if predIndex == 8: + return self.precpred(self._ctx, 5) + + + if predIndex == 9: + return self.precpred(self._ctx, 4) + + + if predIndex == 10: + return self.precpred(self._ctx, 3) + + + if predIndex == 11: + return self.precpred(self._ctx, 2) + + + if predIndex == 12: + return self.precpred(self._ctx, 1) + + + if predIndex == 13: + return self.precpred(self._ctx, 20) + + + if predIndex == 14: + return self.precpred(self._ctx, 18) + + + + + diff --git a/m2isar/frontends/coredsl2_set/parser_gen/CoreDSL2Visitor.py b/m2isar/frontends/coredsl2_set/parser_gen/CoreDSL2Visitor.py new file mode 100644 index 00000000..9702326c --- /dev/null +++ b/m2isar/frontends/coredsl2_set/parser_gen/CoreDSL2Visitor.py @@ -0,0 +1,443 @@ +# Generated from CoreDSL2.g4 by ANTLR 4.13.1 +from antlr4 import * +if "." in __name__: + from .CoreDSL2Parser import CoreDSL2Parser +else: + from CoreDSL2Parser import CoreDSL2Parser + +# This class defines a complete generic visitor for a parse tree produced by CoreDSL2Parser. + +class CoreDSL2Visitor(ParseTreeVisitor): + + # Visit a parse tree produced by CoreDSL2Parser#description_content. + def visitDescription_content(self, ctx:CoreDSL2Parser.Description_contentContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by CoreDSL2Parser#import_file. + def visitImport_file(self, ctx:CoreDSL2Parser.Import_fileContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by CoreDSL2Parser#instruction_set. + def visitInstruction_set(self, ctx:CoreDSL2Parser.Instruction_setContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by CoreDSL2Parser#core_def. + def visitCore_def(self, ctx:CoreDSL2Parser.Core_defContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by CoreDSL2Parser#section_arch_state. + def visitSection_arch_state(self, ctx:CoreDSL2Parser.Section_arch_stateContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by CoreDSL2Parser#section_functions. + def visitSection_functions(self, ctx:CoreDSL2Parser.Section_functionsContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by CoreDSL2Parser#section_instructions. + def visitSection_instructions(self, ctx:CoreDSL2Parser.Section_instructionsContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by CoreDSL2Parser#section_always. + def visitSection_always(self, ctx:CoreDSL2Parser.Section_alwaysContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by CoreDSL2Parser#always_block. + def visitAlways_block(self, ctx:CoreDSL2Parser.Always_blockContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by CoreDSL2Parser#instruction. + def visitInstruction(self, ctx:CoreDSL2Parser.InstructionContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by CoreDSL2Parser#rule_encoding. + def visitRule_encoding(self, ctx:CoreDSL2Parser.Rule_encodingContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by CoreDSL2Parser#bit_value. + def visitBit_value(self, ctx:CoreDSL2Parser.Bit_valueContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by CoreDSL2Parser#bit_field. + def visitBit_field(self, ctx:CoreDSL2Parser.Bit_fieldContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by CoreDSL2Parser#function_definition. + def visitFunction_definition(self, ctx:CoreDSL2Parser.Function_definitionContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by CoreDSL2Parser#parameter_list. + def visitParameter_list(self, ctx:CoreDSL2Parser.Parameter_listContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by CoreDSL2Parser#parameter_declaration. + def visitParameter_declaration(self, ctx:CoreDSL2Parser.Parameter_declarationContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by CoreDSL2Parser#block_statement. + def visitBlock_statement(self, ctx:CoreDSL2Parser.Block_statementContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by CoreDSL2Parser#procedure_call. + def visitProcedure_call(self, ctx:CoreDSL2Parser.Procedure_callContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by CoreDSL2Parser#if_statement. + def visitIf_statement(self, ctx:CoreDSL2Parser.If_statementContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by CoreDSL2Parser#for_statement. + def visitFor_statement(self, ctx:CoreDSL2Parser.For_statementContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by CoreDSL2Parser#while_statement. + def visitWhile_statement(self, ctx:CoreDSL2Parser.While_statementContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by CoreDSL2Parser#do_statement. + def visitDo_statement(self, ctx:CoreDSL2Parser.Do_statementContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by CoreDSL2Parser#switch_statement. + def visitSwitch_statement(self, ctx:CoreDSL2Parser.Switch_statementContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by CoreDSL2Parser#return_statement. + def visitReturn_statement(self, ctx:CoreDSL2Parser.Return_statementContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by CoreDSL2Parser#break_statement. + def visitBreak_statement(self, ctx:CoreDSL2Parser.Break_statementContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by CoreDSL2Parser#continue_statement. + def visitContinue_statement(self, ctx:CoreDSL2Parser.Continue_statementContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by CoreDSL2Parser#spawn_statement. + def visitSpawn_statement(self, ctx:CoreDSL2Parser.Spawn_statementContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by CoreDSL2Parser#expression_statement. + def visitExpression_statement(self, ctx:CoreDSL2Parser.Expression_statementContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by CoreDSL2Parser#switch_block_statement_group. + def visitSwitch_block_statement_group(self, ctx:CoreDSL2Parser.Switch_block_statement_groupContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by CoreDSL2Parser#switch_label. + def visitSwitch_label(self, ctx:CoreDSL2Parser.Switch_labelContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by CoreDSL2Parser#block. + def visitBlock(self, ctx:CoreDSL2Parser.BlockContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by CoreDSL2Parser#block_item. + def visitBlock_item(self, ctx:CoreDSL2Parser.Block_itemContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by CoreDSL2Parser#for_condition. + def visitFor_condition(self, ctx:CoreDSL2Parser.For_conditionContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by CoreDSL2Parser#declaration. + def visitDeclaration(self, ctx:CoreDSL2Parser.DeclarationContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by CoreDSL2Parser#type_specifier. + def visitType_specifier(self, ctx:CoreDSL2Parser.Type_specifierContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by CoreDSL2Parser#integer_type. + def visitInteger_type(self, ctx:CoreDSL2Parser.Integer_typeContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by CoreDSL2Parser#float_type. + def visitFloat_type(self, ctx:CoreDSL2Parser.Float_typeContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by CoreDSL2Parser#bool_type. + def visitBool_type(self, ctx:CoreDSL2Parser.Bool_typeContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by CoreDSL2Parser#void_type. + def visitVoid_type(self, ctx:CoreDSL2Parser.Void_typeContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by CoreDSL2Parser#composite_declaration. + def visitComposite_declaration(self, ctx:CoreDSL2Parser.Composite_declarationContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by CoreDSL2Parser#composite_reference. + def visitComposite_reference(self, ctx:CoreDSL2Parser.Composite_referenceContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by CoreDSL2Parser#enum_declaration. + def visitEnum_declaration(self, ctx:CoreDSL2Parser.Enum_declarationContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by CoreDSL2Parser#enum_reference. + def visitEnum_reference(self, ctx:CoreDSL2Parser.Enum_referenceContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by CoreDSL2Parser#integer_signedness. + def visitInteger_signedness(self, ctx:CoreDSL2Parser.Integer_signednessContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by CoreDSL2Parser#integer_shorthand. + def visitInteger_shorthand(self, ctx:CoreDSL2Parser.Integer_shorthandContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by CoreDSL2Parser#float_shorthand. + def visitFloat_shorthand(self, ctx:CoreDSL2Parser.Float_shorthandContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by CoreDSL2Parser#attribute. + def visitAttribute(self, ctx:CoreDSL2Parser.AttributeContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by CoreDSL2Parser#bit_size_specifier. + def visitBit_size_specifier(self, ctx:CoreDSL2Parser.Bit_size_specifierContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by CoreDSL2Parser#enumerator_list. + def visitEnumerator_list(self, ctx:CoreDSL2Parser.Enumerator_listContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by CoreDSL2Parser#enumerator. + def visitEnumerator(self, ctx:CoreDSL2Parser.EnumeratorContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by CoreDSL2Parser#struct_declaration. + def visitStruct_declaration(self, ctx:CoreDSL2Parser.Struct_declarationContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by CoreDSL2Parser#struct_declaration_specifier. + def visitStruct_declaration_specifier(self, ctx:CoreDSL2Parser.Struct_declaration_specifierContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by CoreDSL2Parser#declarator. + def visitDeclarator(self, ctx:CoreDSL2Parser.DeclaratorContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by CoreDSL2Parser#initializer. + def visitInitializer(self, ctx:CoreDSL2Parser.InitializerContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by CoreDSL2Parser#initializerList. + def visitInitializerList(self, ctx:CoreDSL2Parser.InitializerListContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by CoreDSL2Parser#designated_initializer. + def visitDesignated_initializer(self, ctx:CoreDSL2Parser.Designated_initializerContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by CoreDSL2Parser#designator. + def visitDesignator(self, ctx:CoreDSL2Parser.DesignatorContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by CoreDSL2Parser#cast_expression. + def visitCast_expression(self, ctx:CoreDSL2Parser.Cast_expressionContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by CoreDSL2Parser#binary_expression. + def visitBinary_expression(self, ctx:CoreDSL2Parser.Binary_expressionContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by CoreDSL2Parser#preinc_expression. + def visitPreinc_expression(self, ctx:CoreDSL2Parser.Preinc_expressionContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by CoreDSL2Parser#conditional_expression. + def visitConditional_expression(self, ctx:CoreDSL2Parser.Conditional_expressionContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by CoreDSL2Parser#deref_expression. + def visitDeref_expression(self, ctx:CoreDSL2Parser.Deref_expressionContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by CoreDSL2Parser#prefix_expression. + def visitPrefix_expression(self, ctx:CoreDSL2Parser.Prefix_expressionContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by CoreDSL2Parser#postinc_expression. + def visitPostinc_expression(self, ctx:CoreDSL2Parser.Postinc_expressionContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by CoreDSL2Parser#concat_expression. + def visitConcat_expression(self, ctx:CoreDSL2Parser.Concat_expressionContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by CoreDSL2Parser#assignment_expression. + def visitAssignment_expression(self, ctx:CoreDSL2Parser.Assignment_expressionContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by CoreDSL2Parser#method_call. + def visitMethod_call(self, ctx:CoreDSL2Parser.Method_callContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by CoreDSL2Parser#primary_expression. + def visitPrimary_expression(self, ctx:CoreDSL2Parser.Primary_expressionContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by CoreDSL2Parser#slice_expression. + def visitSlice_expression(self, ctx:CoreDSL2Parser.Slice_expressionContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by CoreDSL2Parser#reference_expression. + def visitReference_expression(self, ctx:CoreDSL2Parser.Reference_expressionContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by CoreDSL2Parser#constant_expression. + def visitConstant_expression(self, ctx:CoreDSL2Parser.Constant_expressionContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by CoreDSL2Parser#literal_expression. + def visitLiteral_expression(self, ctx:CoreDSL2Parser.Literal_expressionContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by CoreDSL2Parser#parens_expression. + def visitParens_expression(self, ctx:CoreDSL2Parser.Parens_expressionContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by CoreDSL2Parser#string_literal. + def visitString_literal(self, ctx:CoreDSL2Parser.String_literalContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by CoreDSL2Parser#constant. + def visitConstant(self, ctx:CoreDSL2Parser.ConstantContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by CoreDSL2Parser#integer_constant. + def visitInteger_constant(self, ctx:CoreDSL2Parser.Integer_constantContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by CoreDSL2Parser#floating_constant. + def visitFloating_constant(self, ctx:CoreDSL2Parser.Floating_constantContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by CoreDSL2Parser#bool_constant. + def visitBool_constant(self, ctx:CoreDSL2Parser.Bool_constantContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by CoreDSL2Parser#character_constant. + def visitCharacter_constant(self, ctx:CoreDSL2Parser.Character_constantContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by CoreDSL2Parser#string_constant. + def visitString_constant(self, ctx:CoreDSL2Parser.String_constantContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by CoreDSL2Parser#double_left_bracket. + def visitDouble_left_bracket(self, ctx:CoreDSL2Parser.Double_left_bracketContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by CoreDSL2Parser#double_right_bracket. + def visitDouble_right_bracket(self, ctx:CoreDSL2Parser.Double_right_bracketContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by CoreDSL2Parser#data_types. + def visitData_types(self, ctx:CoreDSL2Parser.Data_typesContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by CoreDSL2Parser#type_qualifier. + def visitType_qualifier(self, ctx:CoreDSL2Parser.Type_qualifierContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by CoreDSL2Parser#storage_class_specifier. + def visitStorage_class_specifier(self, ctx:CoreDSL2Parser.Storage_class_specifierContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by CoreDSL2Parser#struct_or_union. + def visitStruct_or_union(self, ctx:CoreDSL2Parser.Struct_or_unionContext): + return self.visitChildren(ctx) + + + +del CoreDSL2Parser \ No newline at end of file diff --git a/m2isar/frontends/coredsl2_set/parser_gen/__init__.py b/m2isar/frontends/coredsl2_set/parser_gen/__init__.py new file mode 100644 index 00000000..18f965d7 --- /dev/null +++ b/m2isar/frontends/coredsl2_set/parser_gen/__init__.py @@ -0,0 +1,16 @@ +# SPDX-License-Identifier: Apache-2.0 +# +# This file is part of the M2-ISA-R project: https://github.com/tum-ei-eda/M2-ISA-R +# +# Copyright (C) 2022 +# Chair of Electrical Design Automation +# Technical University of Munich + +"""This module contains the python files generated by ANTLR. These are version controlled +to allow users without a working ANTLR and/or Java setup to also use M2-ISA-R. +""" + +from .CoreDSL2Lexer import CoreDSL2Lexer +from .CoreDSL2Listener import CoreDSL2Listener +from .CoreDSL2Parser import CoreDSL2Parser +from .CoreDSL2Visitor import CoreDSL2Visitor \ No newline at end of file diff --git a/m2isar/frontends/coredsl2_set/utils.py b/m2isar/frontends/coredsl2_set/utils.py new file mode 100644 index 00000000..ffe63588 --- /dev/null +++ b/m2isar/frontends/coredsl2_set/utils.py @@ -0,0 +1,41 @@ +# SPDX-License-Identifier: Apache-2.0 +# +# This file is part of the M2-ISA-R project: https://github.com/tum-ei-eda/M2-ISA-R +# +# Copyright (C) 2022 +# Chair of Electrical Design Automation +# Technical University of Munich + +import antlr4 +import antlr4.error.ErrorListener + +from m2isar import M2SyntaxError +from .parser_gen import CoreDSL2Lexer, CoreDSL2Parser + +RADIX = {"b": 2, "h": 16, "d": 10, "o": 8} + +SHORTHANDS = {"char": 8, "short": 16, "int": 32, "long": 64} + +SIGNEDNESS = {"signed": True, "unsigned": False} + +BOOLCONST = {"true": 1, "false": 0} + + +class MyErrorListener(antlr4.error.ErrorListener.ErrorListener): + def __init__(self, filename=None) -> None: + self.filename = filename + super().__init__() + + def syntaxError(self, recognizer, offendingSymbol, line, column, msg, e): + raise M2SyntaxError(f"Syntax error in file {self.filename}, line {line}, column {column}: {msg}") + + +def make_parser(filename): + input_stream = antlr4.FileStream(filename) + lexer = CoreDSL2Lexer(input_stream) + stream = antlr4.CommonTokenStream(lexer) + parser = CoreDSL2Parser(stream) + error_handler = MyErrorListener(filename) + parser.removeErrorListeners() + parser.addErrorListener(error_handler) + return parser From 6008378ee61154dcbd2075edc49a043b8487aa68 Mon Sep 17 00:00:00 2001 From: Philipp van Kempen Date: Sat, 8 Mar 2025 11:27:39 +0100 Subject: [PATCH 3/8] m2isar/frontends/coredsl2_set/CoreDSL2.g4: align with coredsl2 frontend (TODO: use same file?) --- m2isar/frontends/coredsl2_set/CoreDSL2.g4 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/m2isar/frontends/coredsl2_set/CoreDSL2.g4 b/m2isar/frontends/coredsl2_set/CoreDSL2.g4 index 4bf2b521..21e9d672 100644 --- a/m2isar/frontends/coredsl2_set/CoreDSL2.g4 +++ b/m2isar/frontends/coredsl2_set/CoreDSL2.g4 @@ -19,7 +19,7 @@ import_file ; isa - : 'InstructionSet' name=IDENTIFIER ('extends' extension+=IDENTIFIER (',' extension+=IDENTIFIER)*)? '{' sections+=section+ '}' # instruction_set + : 'InstructionSet' name=IDENTIFIER ('extends' extension+=IDENTIFIER (',' extension+=IDENTIFIER)*)? '{' sections+=section* '}' # instruction_set | 'Core' name=IDENTIFIER ('provides' contributing_types+=IDENTIFIER (',' contributing_types+=IDENTIFIER)*)? '{' sections+=section* '}' # core_def ; From 39f2907fdcea200f87f6dd4f200d08bb682ae22c Mon Sep 17 00:00:00 2001 From: Philipp van Kempen Date: Sat, 8 Mar 2025 11:28:30 +0100 Subject: [PATCH 4/8] m2isar/frontends/coredsl2/CoreDSL2.g4: align with coredsl2_set frontend (allow empty functions section) --- m2isar/frontends/coredsl2/CoreDSL2.g4 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/m2isar/frontends/coredsl2/CoreDSL2.g4 b/m2isar/frontends/coredsl2/CoreDSL2.g4 index 81ff1a73..21e9d672 100644 --- a/m2isar/frontends/coredsl2/CoreDSL2.g4 +++ b/m2isar/frontends/coredsl2/CoreDSL2.g4 @@ -25,7 +25,7 @@ isa section : type_='architectural_state' '{' (declarations+=declaration | expressions+=expression ';')+ '}' # section_arch_state - | type_='functions' '{' functions+=function_definition+ '}' # section_functions + | type_='functions' '{' functions+=function_definition* '}' # section_functions | type_='instructions' attributes+=attribute* '{' instructions+=instruction* '}' # section_instructions | type_='always' attributes+=attribute* '{' always_blocks+=always_block+ '}' # section_always ; From d95d36925b379b6e194f4a842ec4fbd07cd1d75d Mon Sep 17 00:00:00 2001 From: Philipp van Kempen Date: Sat, 8 Mar 2025 11:30:12 +0100 Subject: [PATCH 5/8] use shared grammar file for coredsl2 and coredsl2_set frontend (TODO: share parser_gen, too) --- m2isar/frontends/coredsl2_set/CoreDSL2.g4 | 319 ---------------------- m2isar/frontends/coredsl2_set/antlr.sh | 2 +- 2 files changed, 1 insertion(+), 320 deletions(-) delete mode 100644 m2isar/frontends/coredsl2_set/CoreDSL2.g4 diff --git a/m2isar/frontends/coredsl2_set/CoreDSL2.g4 b/m2isar/frontends/coredsl2_set/CoreDSL2.g4 deleted file mode 100644 index 21e9d672..00000000 --- a/m2isar/frontends/coredsl2_set/CoreDSL2.g4 +++ /dev/null @@ -1,319 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 - -/* - * This file is part of the M2-ISA-R project: https://github.com/tum-ei-eda/M2-ISA-R - * - * Copyright (C) 2022 - * Chair of Electrical Design Automation - * Technical University of Munich - */ - -grammar CoreDSL2; - -description_content - : imports+=import_file* definitions+=isa+ - ; - -import_file - : 'import' uri=STRING - ; - -isa - : 'InstructionSet' name=IDENTIFIER ('extends' extension+=IDENTIFIER (',' extension+=IDENTIFIER)*)? '{' sections+=section* '}' # instruction_set - | 'Core' name=IDENTIFIER ('provides' contributing_types+=IDENTIFIER (',' contributing_types+=IDENTIFIER)*)? '{' sections+=section* '}' # core_def - ; - -section - : type_='architectural_state' '{' (declarations+=declaration | expressions+=expression ';')+ '}' # section_arch_state - | type_='functions' '{' functions+=function_definition* '}' # section_functions - | type_='instructions' attributes+=attribute* '{' instructions+=instruction* '}' # section_instructions - | type_='always' attributes+=attribute* '{' always_blocks+=always_block+ '}' # section_always - ; - -always_block - : name=IDENTIFIER attributes+=attribute* behavior=block; - -instruction - : name=IDENTIFIER attributes+=attribute* '{' - 'encoding' ':' encoding+=encoding_entry ('::' encoding+=encoding_entry)*';' - ('assembly' ':' (assembly=STRING | '{' mnemonic=STRING ',' assembly=STRING '}') ';')? - 'behavior' ':' behavior=statement - '}' - ; - -rule_encoding - : fields+=encoding_entry ('::' fields+=encoding_entry)* - ; - -encoding_entry - : value=integer_constant # bit_value - | name=IDENTIFIER '[' left=integer_constant ':' right=integer_constant ']' # bit_field - ; - -function_definition - : extern='extern' type_=type_specifier name=IDENTIFIER '(' params=parameter_list? ')' attributes+=attribute* ';' - | type_=type_specifier name=IDENTIFIER '(' params=parameter_list? ')' attributes+=attribute* (behavior=block | ';') - ; - -parameter_list - : params+=parameter_declaration (',' params+=parameter_declaration)* - ; - -parameter_declaration - : type_=type_specifier decl=declarator? - ; - -statement - : block # block_statement - | ref=IDENTIFIER '(' (args+=expression (',' args+=expression)*)? ')' ';' # procedure_call - | type_='if' '(' cond+=expression ')' stmt+=statement ('else' 'if' '(' cond+=expression ')' stmt+=statement)* ('else' stmt+=statement)? # if_statement - | type_='for' '(' cond=for_condition ')' stmt=statement # for_statement - | type_='while' '(' cond=expression ')' stmt=statement # while_statement - | type_='do' stmt=statement 'while' '(' cond=expression ')' ';' # do_statement - | type_='switch' '(' cond=expression ')' '{' items+=switch_block_statement_group* switch_label* '}' # switch_statement - | type_='return' expr=expression? ';' # return_statement - | type_='break' ';' # break_statement - | type_='continue' ';' # continue_statement - | type_='spawn' stmt=statement # spawn_statement - | expr=expression ';' # expression_statement - ; - -switch_block_statement_group - : labels+=switch_label+ statements+=statement+ - ; - -switch_label - : 'case' const_expr=expression ':' - | 'default' ':' - ; - -block - : '{' items+=block_item* '}' - ; - -block_item - : statement - | declaration - ; - -for_condition - : (start_decl=declaration | start_expr=expression? ';') - end_expr=expression? ';' - (loop_exprs+=expression (',' loop_exprs+=expression)*)? - ; - -declaration - : (storage+=storage_class_specifier | qualifiers+=type_qualifier | attributes+=attribute)* - type_=type_specifier - (declarations+=declarator (',' declarations+=declarator)*)? ';' - ; - -type_specifier - : type_=value_type_specifier (ptr='*' | ptr='&')? - ; - -value_type_specifier - : signed=integer_signedness (shorthand=integer_shorthand | '<' size=primary '>') # integer_type - | shorthand=integer_shorthand # integer_type - | shorthand=float_shorthand # float_type - | type_='bool' # bool_type - | type_='void' # void_type - | type_=struct_or_union name=IDENTIFIER? '{' declarations+=struct_declaration* '}' # composite_declaration - | type_=struct_or_union name=IDENTIFIER # composite_reference - | type_='enum' name=IDENTIFIER? '{' enumerator_list ','? '}' # enum_declaration - | type_='enum' name=IDENTIFIER # enum_reference - ; - -integer_signedness - : 'unsigned' - | 'signed' - ; - -integer_shorthand - : 'char' - | 'short' - | 'int' - | 'long' - ; - -float_shorthand - : 'float' - | 'double' - ; - -attribute - : '[[' name=IDENTIFIER ('=' params+=expression | '(' params+=expression (',' params+=expression)* ')')? ']]' - ; - -bit_size_specifier - : '<' size+=primary (',' size+=primary ',' size+=primary ',' size+=primary)? '>' - ; - -enumerator_list - : enumerators+=enumerator (',' enumerators+=enumerator)* - ; - -enumerator - : name=IDENTIFIER - | name=IDENTIFIER '=' expression - ; - -struct_declaration - : specifier=struct_declaration_specifier declarators+=declarator(',' declarators+=declarator)* ';' - ; - -struct_declaration_specifier - : type_=type_specifier - | qualifiers+=type_qualifier - ; - -declarator - : name=IDENTIFIER - (LEFT_BR size+=expression RIGHT_BR)* - attributes+=attribute* - ('=' init=initializer)? - ; - -initializer - : expr=expression - | '{' initializerList ','? '}' - ; - -initializerList - : (designated_initializer | initializer) (',' (designated_initializer | initializer))* - ; - -designated_initializer - : designators+=designator+ '=' init=initializer - ; - -designator - : LEFT_BR idx=expression RIGHT_BR - | '.' prop=IDENTIFIER - ; - -expression - : primary # primary_expression - | bop=('.' | '->') ref=IDENTIFIER # deref_expression - | expr=expression bop='[' left=expression (':' right=expression)? ']' # slice_expression - | ref=IDENTIFIER '(' (args+=expression (',' args+=expression)*)? ')' # method_call - | left=expression op=('++' | '--') # postinc_expression - | op=('++'|'--') right=expression # preinc_expression - | prefix=('&'|'*'|'+'|'-') right=expression # prefix_expression - | prefix=('~'|'!') right=expression # prefix_expression - | '(' (type_=type_specifier | sign=integer_signedness) ')' right=expression # cast_expression - | left=expression bop=('*'|'/'|'%') right=expression # binary_expression - | left=expression bop=('+'|'-') right=expression # binary_expression - | left=expression bop=('<<' | '>>') right=expression # binary_expression - | left=expression bop=('<=' | '>=' | '>' | '<') right=expression # binary_expression - | left=expression bop=('==' | '!=') right=expression # binary_expression - | left=expression bop='&' right=expression # binary_expression - | left=expression bop='^' right=expression # binary_expression - | left=expression bop='|' right=expression # binary_expression - | left=expression bop='&&' right=expression # binary_expression - | left=expression bop='||' right=expression # binary_expression - | left=expression bop='::' right=expression # concat_expression - | cond=expression bop='?' then_expr=expression ':' else_expr=expression # conditional_expression - | left=expression bop=('=' | '+=' | '-=' | '*=' | '/=' | '&=' | '|=' | '^=' | '>>=' | '>>>=' | '<<=' | '%=') right=expression # assignment_expression - ; - -primary - : ref=IDENTIFIER # reference_expression - | const_expr=constant # constant_expression - | literal+=string_literal+ # literal_expression - | '(' expr=expression ')' # parens_expression - ; - -string_literal - : ENCSTRINGCONST - | STRING - ; - -constant - : integer_constant - | floating_constant - | character_constant - | string_constant - | bool_constant - ; - -integer_constant - : value=INTEGER - ; - -floating_constant - : value=FLOAT - ; - -bool_constant - : value=BOOLEAN - ; - -character_constant - : value=CHARCONST - ; - -string_constant - : value=STRING - ; - -double_left_bracket - : LEFT_BR LEFT_BR - ; - -double_right_bracket - : RIGHT_BR RIGHT_BR - ; - -data_types - : 'bool' - | 'char' - | 'short' - | 'int' - | 'long' - | 'signed' - | 'unsigned' - | 'float' - | 'double' - | 'void' - | 'alias' - ; - -type_qualifier - : 'const' - | 'volatile' - ; - -storage_class_specifier - : 'extern' - | 'static' - | 'register' - ; - -struct_or_union - : 'struct' - | 'union' - ; - -LEFT_BR: '['; -RIGHT_BR: ']'; - -BOOLEAN: ('true'|'false'); -FLOAT: ('0'..'9')+ '.' ('0'..'9')* (('e'|'E') ('+'|'-')? ('0'..'9')+)? ('f'|'F'|'l'|'L')?; -INTEGER: (BINARYINT|HEXADECIMALINT|OCTALINT|DECIMALINT|VLOGINT) ('u'|'U')? (('l'|'L') ('l'|'L')?)?; - -fragment BINARYINT: ('0b'|'0B') '0'..'1' ('_'? '0'..'1')*; -fragment OCTALINT: '0' '_'? '0'..'7' ('_'? '0'..'7')*; -fragment DECIMALINT: ('0'|'1'..'9' ('_'? '0'..'9')*); -fragment HEXADECIMALINT: ('0x'|'0X') ('0'..'9'|'a'..'f'|'A'..'F') ('_'? ('0'..'9'|'a'..'f'|'A'..'F'))*; -fragment VLOGINT: ('0'..'9')+ '\'' ('s')? ('b' ('0'..'1')+|'o' ('0'..'7')+|'d' ('0'..'9')+|'h' ('0'..'9'|'a'..'f'|'A'..'F')+); - -IDENTIFIER: '^'? ('a'..'z'|'A'..'Z'|'_') ('a'..'z'|'A'..'Z'|'_'|'0'..'9')*; - -CHARCONST: ('u'|'U'|'L')? '\'' ('\\' .|~('\\'|'\''))* '\''; -ENCSTRINGCONST: ('u8'|'u'|'U'|'L') '"' ('\\' .|~('\\'|'"'))* '"'; -STRING: ('"' ('\\' .|~('\\'|'"'))* '"'|'\'' ('\\' .|~('\\'|'\''))* '\''); - -ML_COMMENT: '/*' .*?'*/' -> skip; -SL_COMMENT: '//' ~('\n'|'\r')* ('\r'? '\n')? -> skip; -WS: (' '|'\t'|'\r'|'\n')+ -> skip; diff --git a/m2isar/frontends/coredsl2_set/antlr.sh b/m2isar/frontends/coredsl2_set/antlr.sh index 17d8e6b0..18d3f2ba 100755 --- a/m2isar/frontends/coredsl2_set/antlr.sh +++ b/m2isar/frontends/coredsl2_set/antlr.sh @@ -8,4 +8,4 @@ # Chair of Electrical Design Automation # Technical University of Munich -java -jar antlr-4.13.1-complete.jar -o parser_gen -listener -visitor -Dlanguage=Python3 CoreDSL2.g4 +java -jar antlr-4.13.1-complete.jar -o parser_gen -listener -visitor -Dlanguage=Python3 ../coredsl2/CoreDSL2.g4 From 9b2805c9ff22c1771312d717dbd771386fb3025e Mon Sep 17 00:00:00 2001 From: Philipp van Kempen Date: Sat, 8 Mar 2025 11:31:27 +0100 Subject: [PATCH 6/8] regenerate coredsl2 parser --- .../coredsl2/parser_gen/CoreDSL2Listener.py | 9 + .../coredsl2/parser_gen/CoreDSL2Parser.py | 1677 +++++++++-------- .../coredsl2/parser_gen/CoreDSL2Visitor.py | 5 + 3 files changed, 882 insertions(+), 809 deletions(-) diff --git a/m2isar/frontends/coredsl2/parser_gen/CoreDSL2Listener.py b/m2isar/frontends/coredsl2/parser_gen/CoreDSL2Listener.py index ce53f1f5..f8a03bdd 100644 --- a/m2isar/frontends/coredsl2/parser_gen/CoreDSL2Listener.py +++ b/m2isar/frontends/coredsl2/parser_gen/CoreDSL2Listener.py @@ -719,6 +719,15 @@ def exitCharacter_constant(self, ctx:CoreDSL2Parser.Character_constantContext): pass + # Enter a parse tree produced by CoreDSL2Parser#string_constant. + def enterString_constant(self, ctx:CoreDSL2Parser.String_constantContext): + pass + + # Exit a parse tree produced by CoreDSL2Parser#string_constant. + def exitString_constant(self, ctx:CoreDSL2Parser.String_constantContext): + pass + + # Enter a parse tree produced by CoreDSL2Parser#double_left_bracket. def enterDouble_left_bracket(self, ctx:CoreDSL2Parser.Double_left_bracketContext): pass diff --git a/m2isar/frontends/coredsl2/parser_gen/CoreDSL2Parser.py b/m2isar/frontends/coredsl2/parser_gen/CoreDSL2Parser.py index 2839cb3f..2629356f 100644 --- a/m2isar/frontends/coredsl2/parser_gen/CoreDSL2Parser.py +++ b/m2isar/frontends/coredsl2/parser_gen/CoreDSL2Parser.py @@ -10,306 +10,307 @@ def serializedATN(): return [ - 4,1,102,792,2,0,7,0,2,1,7,1,2,2,7,2,2,3,7,3,2,4,7,4,2,5,7,5,2,6, + 4,1,102,797,2,0,7,0,2,1,7,1,2,2,7,2,2,3,7,3,2,4,7,4,2,5,7,5,2,6, 7,6,2,7,7,7,2,8,7,8,2,9,7,9,2,10,7,10,2,11,7,11,2,12,7,12,2,13,7, 13,2,14,7,14,2,15,7,15,2,16,7,16,2,17,7,17,2,18,7,18,2,19,7,19,2, 20,7,20,2,21,7,21,2,22,7,22,2,23,7,23,2,24,7,24,2,25,7,25,2,26,7, 26,2,27,7,27,2,28,7,28,2,29,7,29,2,30,7,30,2,31,7,31,2,32,7,32,2, 33,7,33,2,34,7,34,2,35,7,35,2,36,7,36,2,37,7,37,2,38,7,38,2,39,7, 39,2,40,7,40,2,41,7,41,2,42,7,42,2,43,7,43,2,44,7,44,2,45,7,45,2, - 46,7,46,2,47,7,47,1,0,5,0,98,8,0,10,0,12,0,101,9,0,1,0,4,0,104,8, - 0,11,0,12,0,105,1,1,1,1,1,1,1,2,1,2,1,2,1,2,1,2,1,2,5,2,117,8,2, - 10,2,12,2,120,9,2,3,2,122,8,2,1,2,1,2,5,2,126,8,2,10,2,12,2,129, - 9,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,5,2,138,8,2,10,2,12,2,141,9,2,3, - 2,143,8,2,1,2,1,2,5,2,147,8,2,10,2,12,2,150,9,2,1,2,3,2,153,8,2, - 1,3,1,3,1,3,1,3,1,3,1,3,4,3,161,8,3,11,3,12,3,162,1,3,1,3,1,3,1, - 3,1,3,4,3,170,8,3,11,3,12,3,171,1,3,1,3,1,3,1,3,5,3,178,8,3,10,3, - 12,3,181,9,3,1,3,1,3,5,3,185,8,3,10,3,12,3,188,9,3,1,3,1,3,1,3,5, - 3,193,8,3,10,3,12,3,196,9,3,1,3,1,3,4,3,200,8,3,11,3,12,3,201,1, - 3,1,3,3,3,206,8,3,1,4,1,4,5,4,210,8,4,10,4,12,4,213,9,4,1,4,1,4, - 1,5,1,5,5,5,219,8,5,10,5,12,5,222,9,5,1,5,1,5,1,5,1,5,1,5,1,5,5, - 5,230,8,5,10,5,12,5,233,9,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5, - 3,5,244,8,5,1,5,3,5,247,8,5,1,5,1,5,1,5,1,5,1,5,1,6,1,6,1,6,5,6, - 257,8,6,10,6,12,6,260,9,6,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,3,7,270, - 8,7,1,8,1,8,1,8,1,8,1,8,3,8,277,8,8,1,8,1,8,5,8,281,8,8,10,8,12, - 8,284,9,8,1,8,1,8,1,8,1,8,1,8,1,8,3,8,292,8,8,1,8,1,8,5,8,296,8, - 8,10,8,12,8,299,9,8,1,8,1,8,3,8,303,8,8,3,8,305,8,8,1,9,1,9,1,9, - 5,9,310,8,9,10,9,12,9,313,9,9,1,10,1,10,3,10,317,8,10,1,11,1,11, - 1,11,1,11,1,11,1,11,5,11,325,8,11,10,11,12,11,328,9,11,3,11,330, - 8,11,1,11,1,11,1,11,1,11,1,11,1,11,1,11,1,11,1,11,1,11,1,11,1,11, - 1,11,1,11,5,11,346,8,11,10,11,12,11,349,9,11,1,11,1,11,3,11,353, - 8,11,1,11,1,11,1,11,1,11,1,11,1,11,1,11,1,11,1,11,1,11,1,11,1,11, + 46,7,46,2,47,7,47,2,48,7,48,1,0,5,0,100,8,0,10,0,12,0,103,9,0,1, + 0,4,0,106,8,0,11,0,12,0,107,1,1,1,1,1,1,1,2,1,2,1,2,1,2,1,2,1,2, + 5,2,119,8,2,10,2,12,2,122,9,2,3,2,124,8,2,1,2,1,2,5,2,128,8,2,10, + 2,12,2,131,9,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,5,2,140,8,2,10,2,12,2, + 143,9,2,3,2,145,8,2,1,2,1,2,5,2,149,8,2,10,2,12,2,152,9,2,1,2,3, + 2,155,8,2,1,3,1,3,1,3,1,3,1,3,1,3,4,3,163,8,3,11,3,12,3,164,1,3, + 1,3,1,3,1,3,1,3,5,3,172,8,3,10,3,12,3,175,9,3,1,3,1,3,1,3,5,3,180, + 8,3,10,3,12,3,183,9,3,1,3,1,3,5,3,187,8,3,10,3,12,3,190,9,3,1,3, + 1,3,1,3,5,3,195,8,3,10,3,12,3,198,9,3,1,3,1,3,4,3,202,8,3,11,3,12, + 3,203,1,3,1,3,3,3,208,8,3,1,4,1,4,5,4,212,8,4,10,4,12,4,215,9,4, + 1,4,1,4,1,5,1,5,5,5,221,8,5,10,5,12,5,224,9,5,1,5,1,5,1,5,1,5,1, + 5,1,5,5,5,232,8,5,10,5,12,5,235,9,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5, + 1,5,1,5,3,5,246,8,5,1,5,3,5,249,8,5,1,5,1,5,1,5,1,5,1,5,1,6,1,6, + 1,6,5,6,259,8,6,10,6,12,6,262,9,6,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1, + 7,3,7,272,8,7,1,8,1,8,1,8,1,8,1,8,3,8,279,8,8,1,8,1,8,5,8,283,8, + 8,10,8,12,8,286,9,8,1,8,1,8,1,8,1,8,1,8,1,8,3,8,294,8,8,1,8,1,8, + 5,8,298,8,8,10,8,12,8,301,9,8,1,8,1,8,3,8,305,8,8,3,8,307,8,8,1, + 9,1,9,1,9,5,9,312,8,9,10,9,12,9,315,9,9,1,10,1,10,3,10,319,8,10, + 1,11,1,11,1,11,1,11,1,11,1,11,5,11,327,8,11,10,11,12,11,330,9,11, + 3,11,332,8,11,1,11,1,11,1,11,1,11,1,11,1,11,1,11,1,11,1,11,1,11, + 1,11,1,11,1,11,1,11,5,11,348,8,11,10,11,12,11,351,9,11,1,11,1,11, + 3,11,355,8,11,1,11,1,11,1,11,1,11,1,11,1,11,1,11,1,11,1,11,1,11, 1,11,1,11,1,11,1,11,1,11,1,11,1,11,1,11,1,11,1,11,1,11,1,11,1,11, - 1,11,5,11,381,8,11,10,11,12,11,384,9,11,1,11,5,11,387,8,11,10,11, - 12,11,390,9,11,1,11,1,11,1,11,1,11,3,11,396,8,11,1,11,1,11,1,11, - 1,11,1,11,1,11,1,11,1,11,1,11,1,11,3,11,408,8,11,1,12,4,12,411,8, - 12,11,12,12,12,412,1,12,4,12,416,8,12,11,12,12,12,417,1,13,1,13, - 1,13,1,13,1,13,1,13,3,13,426,8,13,1,14,1,14,5,14,430,8,14,10,14, - 12,14,433,9,14,1,14,1,14,1,15,1,15,3,15,439,8,15,1,16,1,16,3,16, - 443,8,16,1,16,3,16,446,8,16,1,16,3,16,449,8,16,1,16,1,16,1,16,1, - 16,5,16,455,8,16,10,16,12,16,458,9,16,3,16,460,8,16,1,17,1,17,1, - 17,5,17,465,8,17,10,17,12,17,468,9,17,1,17,1,17,1,17,1,17,5,17,474, - 8,17,10,17,12,17,477,9,17,3,17,479,8,17,1,17,1,17,1,18,1,18,1,18, - 3,18,486,8,18,1,19,1,19,1,19,1,19,1,19,1,19,3,19,494,8,19,1,19,1, - 19,1,19,1,19,1,19,1,19,3,19,502,8,19,1,19,1,19,5,19,506,8,19,10, - 19,12,19,509,9,19,1,19,1,19,1,19,1,19,1,19,1,19,1,19,3,19,518,8, - 19,1,19,1,19,1,19,3,19,523,8,19,1,19,1,19,1,19,1,19,3,19,529,8,19, - 1,20,1,20,1,21,1,21,1,22,1,22,1,23,1,23,1,23,1,23,1,23,1,23,1,23, - 1,23,5,23,545,8,23,10,23,12,23,548,9,23,1,23,1,23,3,23,552,8,23, - 1,23,1,23,1,24,1,24,1,24,1,24,1,24,1,24,1,24,1,24,1,24,3,24,565, - 8,24,1,24,1,24,1,25,1,25,1,25,5,25,572,8,25,10,25,12,25,575,9,25, - 1,26,1,26,1,26,1,26,3,26,581,8,26,1,27,1,27,1,27,1,27,5,27,587,8, - 27,10,27,12,27,590,9,27,1,27,1,27,1,28,1,28,3,28,596,8,28,1,29,1, - 29,1,29,1,29,1,29,5,29,603,8,29,10,29,12,29,606,9,29,1,29,5,29,609, - 8,29,10,29,12,29,612,9,29,1,29,1,29,3,29,616,8,29,1,30,1,30,1,30, - 1,30,3,30,622,8,30,1,30,1,30,3,30,626,8,30,1,31,1,31,3,31,630,8, - 31,1,31,1,31,1,31,3,31,635,8,31,5,31,637,8,31,10,31,12,31,640,9, - 31,1,32,4,32,643,8,32,11,32,12,32,644,1,32,1,32,1,32,1,33,1,33,1, - 33,1,33,1,33,1,33,3,33,656,8,33,1,34,1,34,1,34,1,34,1,34,1,34,1, - 34,1,34,1,34,5,34,667,8,34,10,34,12,34,670,9,34,3,34,672,8,34,1, - 34,1,34,1,34,1,34,1,34,1,34,1,34,1,34,1,34,1,34,3,34,684,8,34,1, - 34,1,34,1,34,3,34,689,8,34,1,34,1,34,1,34,1,34,1,34,1,34,1,34,1, - 34,1,34,1,34,1,34,1,34,1,34,1,34,1,34,1,34,1,34,1,34,1,34,1,34,1, - 34,1,34,1,34,1,34,1,34,1,34,1,34,1,34,1,34,1,34,1,34,1,34,1,34,1, - 34,1,34,1,34,1,34,1,34,1,34,1,34,1,34,1,34,1,34,1,34,1,34,1,34,1, - 34,3,34,738,8,34,1,34,1,34,1,34,1,34,5,34,744,8,34,10,34,12,34,747, - 9,34,1,35,1,35,1,35,4,35,752,8,35,11,35,12,35,753,1,35,1,35,1,35, - 1,35,3,35,760,8,35,1,36,1,36,1,37,1,37,1,37,1,37,3,37,768,8,37,1, - 38,1,38,1,39,1,39,1,40,1,40,1,41,1,41,1,42,1,42,1,42,1,43,1,43,1, - 43,1,44,1,44,1,45,1,45,1,46,1,46,1,47,1,47,1,47,0,1,68,48,0,2,4, - 6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48, - 50,52,54,56,58,60,62,64,66,68,70,72,74,76,78,80,82,84,86,88,90,92, - 94,0,18,1,0,41,42,1,0,43,46,1,0,47,48,1,0,52,53,1,0,54,55,2,0,34, - 35,56,57,1,0,58,59,2,0,34,34,60,61,1,0,56,57,1,0,62,63,2,0,36,37, - 64,65,1,0,66,67,2,0,50,50,73,83,1,0,98,99,3,0,38,39,41,48,84,84, - 1,0,85,86,2,0,19,19,87,88,1,0,89,90,875,0,99,1,0,0,0,2,107,1,0,0, - 0,4,152,1,0,0,0,6,205,1,0,0,0,8,207,1,0,0,0,10,216,1,0,0,0,12,253, - 1,0,0,0,14,269,1,0,0,0,16,304,1,0,0,0,18,306,1,0,0,0,20,314,1,0, - 0,0,22,407,1,0,0,0,24,410,1,0,0,0,26,425,1,0,0,0,28,427,1,0,0,0, - 30,438,1,0,0,0,32,445,1,0,0,0,34,466,1,0,0,0,36,482,1,0,0,0,38,528, - 1,0,0,0,40,530,1,0,0,0,42,532,1,0,0,0,44,534,1,0,0,0,46,536,1,0, - 0,0,48,555,1,0,0,0,50,568,1,0,0,0,52,580,1,0,0,0,54,582,1,0,0,0, - 56,595,1,0,0,0,58,597,1,0,0,0,60,625,1,0,0,0,62,629,1,0,0,0,64,642, - 1,0,0,0,66,655,1,0,0,0,68,688,1,0,0,0,70,759,1,0,0,0,72,761,1,0, - 0,0,74,767,1,0,0,0,76,769,1,0,0,0,78,771,1,0,0,0,80,773,1,0,0,0, - 82,775,1,0,0,0,84,777,1,0,0,0,86,780,1,0,0,0,88,783,1,0,0,0,90,785, - 1,0,0,0,92,787,1,0,0,0,94,789,1,0,0,0,96,98,3,2,1,0,97,96,1,0,0, - 0,98,101,1,0,0,0,99,97,1,0,0,0,99,100,1,0,0,0,100,103,1,0,0,0,101, - 99,1,0,0,0,102,104,3,4,2,0,103,102,1,0,0,0,104,105,1,0,0,0,105,103, - 1,0,0,0,105,106,1,0,0,0,106,1,1,0,0,0,107,108,5,1,0,0,108,109,5, - 99,0,0,109,3,1,0,0,0,110,111,5,2,0,0,111,121,5,96,0,0,112,113,5, - 3,0,0,113,118,5,96,0,0,114,115,5,4,0,0,115,117,5,96,0,0,116,114, - 1,0,0,0,117,120,1,0,0,0,118,116,1,0,0,0,118,119,1,0,0,0,119,122, - 1,0,0,0,120,118,1,0,0,0,121,112,1,0,0,0,121,122,1,0,0,0,122,123, - 1,0,0,0,123,127,5,5,0,0,124,126,3,6,3,0,125,124,1,0,0,0,126,129, - 1,0,0,0,127,125,1,0,0,0,127,128,1,0,0,0,128,130,1,0,0,0,129,127, - 1,0,0,0,130,153,5,6,0,0,131,132,5,7,0,0,132,142,5,96,0,0,133,134, - 5,8,0,0,134,139,5,96,0,0,135,136,5,4,0,0,136,138,5,96,0,0,137,135, - 1,0,0,0,138,141,1,0,0,0,139,137,1,0,0,0,139,140,1,0,0,0,140,143, - 1,0,0,0,141,139,1,0,0,0,142,133,1,0,0,0,142,143,1,0,0,0,143,144, - 1,0,0,0,144,148,5,5,0,0,145,147,3,6,3,0,146,145,1,0,0,0,147,150, - 1,0,0,0,148,146,1,0,0,0,148,149,1,0,0,0,149,151,1,0,0,0,150,148, - 1,0,0,0,151,153,5,6,0,0,152,110,1,0,0,0,152,131,1,0,0,0,153,5,1, - 0,0,0,154,155,5,9,0,0,155,160,5,5,0,0,156,161,3,34,17,0,157,158, - 3,68,34,0,158,159,5,10,0,0,159,161,1,0,0,0,160,156,1,0,0,0,160,157, - 1,0,0,0,161,162,1,0,0,0,162,160,1,0,0,0,162,163,1,0,0,0,163,164, - 1,0,0,0,164,165,5,6,0,0,165,206,1,0,0,0,166,167,5,11,0,0,167,169, - 5,5,0,0,168,170,3,16,8,0,169,168,1,0,0,0,170,171,1,0,0,0,171,169, - 1,0,0,0,171,172,1,0,0,0,172,173,1,0,0,0,173,174,5,6,0,0,174,206, - 1,0,0,0,175,179,5,12,0,0,176,178,3,46,23,0,177,176,1,0,0,0,178,181, - 1,0,0,0,179,177,1,0,0,0,179,180,1,0,0,0,180,182,1,0,0,0,181,179, - 1,0,0,0,182,186,5,5,0,0,183,185,3,10,5,0,184,183,1,0,0,0,185,188, - 1,0,0,0,186,184,1,0,0,0,186,187,1,0,0,0,187,189,1,0,0,0,188,186, - 1,0,0,0,189,206,5,6,0,0,190,194,5,13,0,0,191,193,3,46,23,0,192,191, - 1,0,0,0,193,196,1,0,0,0,194,192,1,0,0,0,194,195,1,0,0,0,195,197, - 1,0,0,0,196,194,1,0,0,0,197,199,5,5,0,0,198,200,3,8,4,0,199,198, - 1,0,0,0,200,201,1,0,0,0,201,199,1,0,0,0,201,202,1,0,0,0,202,203, - 1,0,0,0,203,204,5,6,0,0,204,206,1,0,0,0,205,154,1,0,0,0,205,166, - 1,0,0,0,205,175,1,0,0,0,205,190,1,0,0,0,206,7,1,0,0,0,207,211,5, - 96,0,0,208,210,3,46,23,0,209,208,1,0,0,0,210,213,1,0,0,0,211,209, - 1,0,0,0,211,212,1,0,0,0,212,214,1,0,0,0,213,211,1,0,0,0,214,215, - 3,28,14,0,215,9,1,0,0,0,216,220,5,96,0,0,217,219,3,46,23,0,218,217, - 1,0,0,0,219,222,1,0,0,0,220,218,1,0,0,0,220,221,1,0,0,0,221,223, - 1,0,0,0,222,220,1,0,0,0,223,224,5,5,0,0,224,225,5,14,0,0,225,226, - 5,15,0,0,226,231,3,14,7,0,227,228,5,16,0,0,228,230,3,14,7,0,229, - 227,1,0,0,0,230,233,1,0,0,0,231,229,1,0,0,0,231,232,1,0,0,0,232, - 234,1,0,0,0,233,231,1,0,0,0,234,246,5,10,0,0,235,236,5,17,0,0,236, - 243,5,15,0,0,237,244,5,99,0,0,238,239,5,5,0,0,239,240,5,99,0,0,240, - 241,5,4,0,0,241,242,5,99,0,0,242,244,5,6,0,0,243,237,1,0,0,0,243, - 238,1,0,0,0,244,245,1,0,0,0,245,247,5,10,0,0,246,235,1,0,0,0,246, - 247,1,0,0,0,247,248,1,0,0,0,248,249,5,18,0,0,249,250,5,15,0,0,250, - 251,3,22,11,0,251,252,5,6,0,0,252,11,1,0,0,0,253,258,3,14,7,0,254, - 255,5,16,0,0,255,257,3,14,7,0,256,254,1,0,0,0,257,260,1,0,0,0,258, - 256,1,0,0,0,258,259,1,0,0,0,259,13,1,0,0,0,260,258,1,0,0,0,261,270, - 3,76,38,0,262,263,5,96,0,0,263,264,5,91,0,0,264,265,3,76,38,0,265, - 266,5,15,0,0,266,267,3,76,38,0,267,268,5,92,0,0,268,270,1,0,0,0, - 269,261,1,0,0,0,269,262,1,0,0,0,270,15,1,0,0,0,271,272,5,19,0,0, - 272,273,3,36,18,0,273,274,5,96,0,0,274,276,5,20,0,0,275,277,3,18, - 9,0,276,275,1,0,0,0,276,277,1,0,0,0,277,278,1,0,0,0,278,282,5,21, - 0,0,279,281,3,46,23,0,280,279,1,0,0,0,281,284,1,0,0,0,282,280,1, - 0,0,0,282,283,1,0,0,0,283,285,1,0,0,0,284,282,1,0,0,0,285,286,5, - 10,0,0,286,305,1,0,0,0,287,288,3,36,18,0,288,289,5,96,0,0,289,291, - 5,20,0,0,290,292,3,18,9,0,291,290,1,0,0,0,291,292,1,0,0,0,292,293, - 1,0,0,0,293,297,5,21,0,0,294,296,3,46,23,0,295,294,1,0,0,0,296,299, - 1,0,0,0,297,295,1,0,0,0,297,298,1,0,0,0,298,302,1,0,0,0,299,297, - 1,0,0,0,300,303,3,28,14,0,301,303,5,10,0,0,302,300,1,0,0,0,302,301, - 1,0,0,0,303,305,1,0,0,0,304,271,1,0,0,0,304,287,1,0,0,0,305,17,1, - 0,0,0,306,311,3,20,10,0,307,308,5,4,0,0,308,310,3,20,10,0,309,307, - 1,0,0,0,310,313,1,0,0,0,311,309,1,0,0,0,311,312,1,0,0,0,312,19,1, - 0,0,0,313,311,1,0,0,0,314,316,3,36,18,0,315,317,3,58,29,0,316,315, - 1,0,0,0,316,317,1,0,0,0,317,21,1,0,0,0,318,408,3,28,14,0,319,320, - 5,96,0,0,320,329,5,20,0,0,321,326,3,68,34,0,322,323,5,4,0,0,323, - 325,3,68,34,0,324,322,1,0,0,0,325,328,1,0,0,0,326,324,1,0,0,0,326, - 327,1,0,0,0,327,330,1,0,0,0,328,326,1,0,0,0,329,321,1,0,0,0,329, - 330,1,0,0,0,330,331,1,0,0,0,331,332,5,21,0,0,332,408,5,10,0,0,333, - 334,5,22,0,0,334,335,5,20,0,0,335,336,3,68,34,0,336,337,5,21,0,0, - 337,347,3,22,11,0,338,339,5,23,0,0,339,340,5,22,0,0,340,341,5,20, - 0,0,341,342,3,68,34,0,342,343,5,21,0,0,343,344,3,22,11,0,344,346, - 1,0,0,0,345,338,1,0,0,0,346,349,1,0,0,0,347,345,1,0,0,0,347,348, - 1,0,0,0,348,352,1,0,0,0,349,347,1,0,0,0,350,351,5,23,0,0,351,353, - 3,22,11,0,352,350,1,0,0,0,352,353,1,0,0,0,353,408,1,0,0,0,354,355, - 5,24,0,0,355,356,5,20,0,0,356,357,3,32,16,0,357,358,5,21,0,0,358, - 359,3,22,11,0,359,408,1,0,0,0,360,361,5,25,0,0,361,362,5,20,0,0, - 362,363,3,68,34,0,363,364,5,21,0,0,364,365,3,22,11,0,365,408,1,0, - 0,0,366,367,5,26,0,0,367,368,3,22,11,0,368,369,5,25,0,0,369,370, - 5,20,0,0,370,371,3,68,34,0,371,372,5,21,0,0,372,373,5,10,0,0,373, - 408,1,0,0,0,374,375,5,27,0,0,375,376,5,20,0,0,376,377,3,68,34,0, - 377,378,5,21,0,0,378,382,5,5,0,0,379,381,3,24,12,0,380,379,1,0,0, - 0,381,384,1,0,0,0,382,380,1,0,0,0,382,383,1,0,0,0,383,388,1,0,0, - 0,384,382,1,0,0,0,385,387,3,26,13,0,386,385,1,0,0,0,387,390,1,0, - 0,0,388,386,1,0,0,0,388,389,1,0,0,0,389,391,1,0,0,0,390,388,1,0, - 0,0,391,392,5,6,0,0,392,408,1,0,0,0,393,395,5,28,0,0,394,396,3,68, - 34,0,395,394,1,0,0,0,395,396,1,0,0,0,396,397,1,0,0,0,397,408,5,10, - 0,0,398,399,5,29,0,0,399,408,5,10,0,0,400,401,5,30,0,0,401,408,5, - 10,0,0,402,403,5,31,0,0,403,408,3,22,11,0,404,405,3,68,34,0,405, - 406,5,10,0,0,406,408,1,0,0,0,407,318,1,0,0,0,407,319,1,0,0,0,407, - 333,1,0,0,0,407,354,1,0,0,0,407,360,1,0,0,0,407,366,1,0,0,0,407, - 374,1,0,0,0,407,393,1,0,0,0,407,398,1,0,0,0,407,400,1,0,0,0,407, - 402,1,0,0,0,407,404,1,0,0,0,408,23,1,0,0,0,409,411,3,26,13,0,410, - 409,1,0,0,0,411,412,1,0,0,0,412,410,1,0,0,0,412,413,1,0,0,0,413, - 415,1,0,0,0,414,416,3,22,11,0,415,414,1,0,0,0,416,417,1,0,0,0,417, - 415,1,0,0,0,417,418,1,0,0,0,418,25,1,0,0,0,419,420,5,32,0,0,420, - 421,3,68,34,0,421,422,5,15,0,0,422,426,1,0,0,0,423,424,5,33,0,0, - 424,426,5,15,0,0,425,419,1,0,0,0,425,423,1,0,0,0,426,27,1,0,0,0, - 427,431,5,5,0,0,428,430,3,30,15,0,429,428,1,0,0,0,430,433,1,0,0, - 0,431,429,1,0,0,0,431,432,1,0,0,0,432,434,1,0,0,0,433,431,1,0,0, - 0,434,435,5,6,0,0,435,29,1,0,0,0,436,439,3,22,11,0,437,439,3,34, - 17,0,438,436,1,0,0,0,438,437,1,0,0,0,439,31,1,0,0,0,440,446,3,34, - 17,0,441,443,3,68,34,0,442,441,1,0,0,0,442,443,1,0,0,0,443,444,1, - 0,0,0,444,446,5,10,0,0,445,440,1,0,0,0,445,442,1,0,0,0,446,448,1, - 0,0,0,447,449,3,68,34,0,448,447,1,0,0,0,448,449,1,0,0,0,449,450, - 1,0,0,0,450,459,5,10,0,0,451,456,3,68,34,0,452,453,5,4,0,0,453,455, - 3,68,34,0,454,452,1,0,0,0,455,458,1,0,0,0,456,454,1,0,0,0,456,457, - 1,0,0,0,457,460,1,0,0,0,458,456,1,0,0,0,459,451,1,0,0,0,459,460, - 1,0,0,0,460,33,1,0,0,0,461,465,3,92,46,0,462,465,3,90,45,0,463,465, - 3,46,23,0,464,461,1,0,0,0,464,462,1,0,0,0,464,463,1,0,0,0,465,468, - 1,0,0,0,466,464,1,0,0,0,466,467,1,0,0,0,467,469,1,0,0,0,468,466, - 1,0,0,0,469,478,3,36,18,0,470,475,3,58,29,0,471,472,5,4,0,0,472, - 474,3,58,29,0,473,471,1,0,0,0,474,477,1,0,0,0,475,473,1,0,0,0,475, - 476,1,0,0,0,476,479,1,0,0,0,477,475,1,0,0,0,478,470,1,0,0,0,478, - 479,1,0,0,0,479,480,1,0,0,0,480,481,5,10,0,0,481,35,1,0,0,0,482, - 485,3,38,19,0,483,486,5,34,0,0,484,486,5,35,0,0,485,483,1,0,0,0, - 485,484,1,0,0,0,485,486,1,0,0,0,486,37,1,0,0,0,487,493,3,40,20,0, - 488,494,3,42,21,0,489,490,5,36,0,0,490,491,3,70,35,0,491,492,5,37, - 0,0,492,494,1,0,0,0,493,488,1,0,0,0,493,489,1,0,0,0,494,529,1,0, - 0,0,495,529,3,42,21,0,496,529,3,44,22,0,497,529,5,38,0,0,498,529, - 5,39,0,0,499,501,3,94,47,0,500,502,5,96,0,0,501,500,1,0,0,0,501, - 502,1,0,0,0,502,503,1,0,0,0,503,507,5,5,0,0,504,506,3,54,27,0,505, - 504,1,0,0,0,506,509,1,0,0,0,507,505,1,0,0,0,507,508,1,0,0,0,508, - 510,1,0,0,0,509,507,1,0,0,0,510,511,5,6,0,0,511,529,1,0,0,0,512, - 513,3,94,47,0,513,514,5,96,0,0,514,529,1,0,0,0,515,517,5,40,0,0, - 516,518,5,96,0,0,517,516,1,0,0,0,517,518,1,0,0,0,518,519,1,0,0,0, - 519,520,5,5,0,0,520,522,3,50,25,0,521,523,5,4,0,0,522,521,1,0,0, - 0,522,523,1,0,0,0,523,524,1,0,0,0,524,525,5,6,0,0,525,529,1,0,0, - 0,526,527,5,40,0,0,527,529,5,96,0,0,528,487,1,0,0,0,528,495,1,0, - 0,0,528,496,1,0,0,0,528,497,1,0,0,0,528,498,1,0,0,0,528,499,1,0, - 0,0,528,512,1,0,0,0,528,515,1,0,0,0,528,526,1,0,0,0,529,39,1,0,0, - 0,530,531,7,0,0,0,531,41,1,0,0,0,532,533,7,1,0,0,533,43,1,0,0,0, - 534,535,7,2,0,0,535,45,1,0,0,0,536,537,5,49,0,0,537,551,5,96,0,0, - 538,539,5,50,0,0,539,552,3,68,34,0,540,541,5,20,0,0,541,546,3,68, - 34,0,542,543,5,4,0,0,543,545,3,68,34,0,544,542,1,0,0,0,545,548,1, - 0,0,0,546,544,1,0,0,0,546,547,1,0,0,0,547,549,1,0,0,0,548,546,1, - 0,0,0,549,550,5,21,0,0,550,552,1,0,0,0,551,538,1,0,0,0,551,540,1, - 0,0,0,551,552,1,0,0,0,552,553,1,0,0,0,553,554,5,51,0,0,554,47,1, - 0,0,0,555,556,5,36,0,0,556,564,3,70,35,0,557,558,5,4,0,0,558,559, - 3,70,35,0,559,560,5,4,0,0,560,561,3,70,35,0,561,562,5,4,0,0,562, - 563,3,70,35,0,563,565,1,0,0,0,564,557,1,0,0,0,564,565,1,0,0,0,565, - 566,1,0,0,0,566,567,5,37,0,0,567,49,1,0,0,0,568,573,3,52,26,0,569, - 570,5,4,0,0,570,572,3,52,26,0,571,569,1,0,0,0,572,575,1,0,0,0,573, - 571,1,0,0,0,573,574,1,0,0,0,574,51,1,0,0,0,575,573,1,0,0,0,576,581, - 5,96,0,0,577,578,5,96,0,0,578,579,5,50,0,0,579,581,3,68,34,0,580, - 576,1,0,0,0,580,577,1,0,0,0,581,53,1,0,0,0,582,583,3,56,28,0,583, - 588,3,58,29,0,584,585,5,4,0,0,585,587,3,58,29,0,586,584,1,0,0,0, - 587,590,1,0,0,0,588,586,1,0,0,0,588,589,1,0,0,0,589,591,1,0,0,0, - 590,588,1,0,0,0,591,592,5,10,0,0,592,55,1,0,0,0,593,596,3,36,18, - 0,594,596,3,90,45,0,595,593,1,0,0,0,595,594,1,0,0,0,596,57,1,0,0, - 0,597,604,5,96,0,0,598,599,5,91,0,0,599,600,3,68,34,0,600,601,5, - 92,0,0,601,603,1,0,0,0,602,598,1,0,0,0,603,606,1,0,0,0,604,602,1, - 0,0,0,604,605,1,0,0,0,605,610,1,0,0,0,606,604,1,0,0,0,607,609,3, - 46,23,0,608,607,1,0,0,0,609,612,1,0,0,0,610,608,1,0,0,0,610,611, - 1,0,0,0,611,615,1,0,0,0,612,610,1,0,0,0,613,614,5,50,0,0,614,616, - 3,60,30,0,615,613,1,0,0,0,615,616,1,0,0,0,616,59,1,0,0,0,617,626, - 3,68,34,0,618,619,5,5,0,0,619,621,3,62,31,0,620,622,5,4,0,0,621, - 620,1,0,0,0,621,622,1,0,0,0,622,623,1,0,0,0,623,624,5,6,0,0,624, - 626,1,0,0,0,625,617,1,0,0,0,625,618,1,0,0,0,626,61,1,0,0,0,627,630, - 3,64,32,0,628,630,3,60,30,0,629,627,1,0,0,0,629,628,1,0,0,0,630, - 638,1,0,0,0,631,634,5,4,0,0,632,635,3,64,32,0,633,635,3,60,30,0, - 634,632,1,0,0,0,634,633,1,0,0,0,635,637,1,0,0,0,636,631,1,0,0,0, - 637,640,1,0,0,0,638,636,1,0,0,0,638,639,1,0,0,0,639,63,1,0,0,0,640, - 638,1,0,0,0,641,643,3,66,33,0,642,641,1,0,0,0,643,644,1,0,0,0,644, - 642,1,0,0,0,644,645,1,0,0,0,645,646,1,0,0,0,646,647,5,50,0,0,647, - 648,3,60,30,0,648,65,1,0,0,0,649,650,5,91,0,0,650,651,3,68,34,0, - 651,652,5,92,0,0,652,656,1,0,0,0,653,654,5,52,0,0,654,656,5,96,0, - 0,655,649,1,0,0,0,655,653,1,0,0,0,656,67,1,0,0,0,657,658,6,34,-1, - 0,658,689,3,70,35,0,659,660,7,3,0,0,660,689,5,96,0,0,661,662,5,96, - 0,0,662,671,5,20,0,0,663,668,3,68,34,0,664,665,5,4,0,0,665,667,3, - 68,34,0,666,664,1,0,0,0,667,670,1,0,0,0,668,666,1,0,0,0,668,669, - 1,0,0,0,669,672,1,0,0,0,670,668,1,0,0,0,671,663,1,0,0,0,671,672, - 1,0,0,0,672,673,1,0,0,0,673,689,5,21,0,0,674,675,7,4,0,0,675,689, - 3,68,34,17,676,677,7,5,0,0,677,689,3,68,34,16,678,679,7,6,0,0,679, - 689,3,68,34,15,680,683,5,20,0,0,681,684,3,36,18,0,682,684,3,40,20, - 0,683,681,1,0,0,0,683,682,1,0,0,0,684,685,1,0,0,0,685,686,5,21,0, - 0,686,687,3,68,34,14,687,689,1,0,0,0,688,657,1,0,0,0,688,659,1,0, - 0,0,688,661,1,0,0,0,688,674,1,0,0,0,688,676,1,0,0,0,688,678,1,0, - 0,0,688,680,1,0,0,0,689,745,1,0,0,0,690,691,10,13,0,0,691,692,7, - 7,0,0,692,744,3,68,34,14,693,694,10,12,0,0,694,695,7,8,0,0,695,744, - 3,68,34,13,696,697,10,11,0,0,697,698,7,9,0,0,698,744,3,68,34,12, - 699,700,10,10,0,0,700,701,7,10,0,0,701,744,3,68,34,11,702,703,10, - 9,0,0,703,704,7,11,0,0,704,744,3,68,34,10,705,706,10,8,0,0,706,707, - 5,35,0,0,707,744,3,68,34,9,708,709,10,7,0,0,709,710,5,68,0,0,710, - 744,3,68,34,8,711,712,10,6,0,0,712,713,5,69,0,0,713,744,3,68,34, - 7,714,715,10,5,0,0,715,716,5,70,0,0,716,744,3,68,34,6,717,718,10, - 4,0,0,718,719,5,71,0,0,719,744,3,68,34,5,720,721,10,3,0,0,721,722, - 5,16,0,0,722,744,3,68,34,4,723,724,10,2,0,0,724,725,5,72,0,0,725, - 726,3,68,34,0,726,727,5,15,0,0,727,728,3,68,34,2,728,744,1,0,0,0, - 729,730,10,1,0,0,730,731,7,12,0,0,731,744,3,68,34,1,732,733,10,20, - 0,0,733,734,5,91,0,0,734,737,3,68,34,0,735,736,5,15,0,0,736,738, - 3,68,34,0,737,735,1,0,0,0,737,738,1,0,0,0,738,739,1,0,0,0,739,740, - 5,92,0,0,740,744,1,0,0,0,741,742,10,18,0,0,742,744,7,4,0,0,743,690, - 1,0,0,0,743,693,1,0,0,0,743,696,1,0,0,0,743,699,1,0,0,0,743,702, - 1,0,0,0,743,705,1,0,0,0,743,708,1,0,0,0,743,711,1,0,0,0,743,714, - 1,0,0,0,743,717,1,0,0,0,743,720,1,0,0,0,743,723,1,0,0,0,743,729, - 1,0,0,0,743,732,1,0,0,0,743,741,1,0,0,0,744,747,1,0,0,0,745,743, - 1,0,0,0,745,746,1,0,0,0,746,69,1,0,0,0,747,745,1,0,0,0,748,760,5, - 96,0,0,749,760,3,74,37,0,750,752,3,72,36,0,751,750,1,0,0,0,752,753, - 1,0,0,0,753,751,1,0,0,0,753,754,1,0,0,0,754,760,1,0,0,0,755,756, - 5,20,0,0,756,757,3,68,34,0,757,758,5,21,0,0,758,760,1,0,0,0,759, - 748,1,0,0,0,759,749,1,0,0,0,759,751,1,0,0,0,759,755,1,0,0,0,760, - 71,1,0,0,0,761,762,7,13,0,0,762,73,1,0,0,0,763,768,3,76,38,0,764, - 768,3,78,39,0,765,768,3,82,41,0,766,768,3,80,40,0,767,763,1,0,0, - 0,767,764,1,0,0,0,767,765,1,0,0,0,767,766,1,0,0,0,768,75,1,0,0,0, - 769,770,5,95,0,0,770,77,1,0,0,0,771,772,5,94,0,0,772,79,1,0,0,0, - 773,774,5,93,0,0,774,81,1,0,0,0,775,776,5,97,0,0,776,83,1,0,0,0, - 777,778,5,91,0,0,778,779,5,91,0,0,779,85,1,0,0,0,780,781,5,92,0, - 0,781,782,5,92,0,0,782,87,1,0,0,0,783,784,7,14,0,0,784,89,1,0,0, - 0,785,786,7,15,0,0,786,91,1,0,0,0,787,788,7,16,0,0,788,93,1,0,0, - 0,789,790,7,17,0,0,790,95,1,0,0,0,88,99,105,118,121,127,139,142, - 148,152,160,162,171,179,186,194,201,205,211,220,231,243,246,258, - 269,276,282,291,297,302,304,311,316,326,329,347,352,382,388,395, - 407,412,417,425,431,438,442,445,448,456,459,464,466,475,478,485, - 493,501,507,517,522,528,546,551,564,573,580,588,595,604,610,615, - 621,625,629,634,638,644,655,668,671,683,688,737,743,745,753,759, - 767 + 1,11,1,11,1,11,5,11,383,8,11,10,11,12,11,386,9,11,1,11,5,11,389, + 8,11,10,11,12,11,392,9,11,1,11,1,11,1,11,1,11,3,11,398,8,11,1,11, + 1,11,1,11,1,11,1,11,1,11,1,11,1,11,1,11,1,11,3,11,410,8,11,1,12, + 4,12,413,8,12,11,12,12,12,414,1,12,4,12,418,8,12,11,12,12,12,419, + 1,13,1,13,1,13,1,13,1,13,1,13,3,13,428,8,13,1,14,1,14,5,14,432,8, + 14,10,14,12,14,435,9,14,1,14,1,14,1,15,1,15,3,15,441,8,15,1,16,1, + 16,3,16,445,8,16,1,16,3,16,448,8,16,1,16,3,16,451,8,16,1,16,1,16, + 1,16,1,16,5,16,457,8,16,10,16,12,16,460,9,16,3,16,462,8,16,1,17, + 1,17,1,17,5,17,467,8,17,10,17,12,17,470,9,17,1,17,1,17,1,17,1,17, + 5,17,476,8,17,10,17,12,17,479,9,17,3,17,481,8,17,1,17,1,17,1,18, + 1,18,1,18,3,18,488,8,18,1,19,1,19,1,19,1,19,1,19,1,19,3,19,496,8, + 19,1,19,1,19,1,19,1,19,1,19,1,19,3,19,504,8,19,1,19,1,19,5,19,508, + 8,19,10,19,12,19,511,9,19,1,19,1,19,1,19,1,19,1,19,1,19,1,19,3,19, + 520,8,19,1,19,1,19,1,19,3,19,525,8,19,1,19,1,19,1,19,1,19,3,19,531, + 8,19,1,20,1,20,1,21,1,21,1,22,1,22,1,23,1,23,1,23,1,23,1,23,1,23, + 1,23,1,23,5,23,547,8,23,10,23,12,23,550,9,23,1,23,1,23,3,23,554, + 8,23,1,23,1,23,1,24,1,24,1,24,1,24,1,24,1,24,1,24,1,24,1,24,3,24, + 567,8,24,1,24,1,24,1,25,1,25,1,25,5,25,574,8,25,10,25,12,25,577, + 9,25,1,26,1,26,1,26,1,26,3,26,583,8,26,1,27,1,27,1,27,1,27,5,27, + 589,8,27,10,27,12,27,592,9,27,1,27,1,27,1,28,1,28,3,28,598,8,28, + 1,29,1,29,1,29,1,29,1,29,5,29,605,8,29,10,29,12,29,608,9,29,1,29, + 5,29,611,8,29,10,29,12,29,614,9,29,1,29,1,29,3,29,618,8,29,1,30, + 1,30,1,30,1,30,3,30,624,8,30,1,30,1,30,3,30,628,8,30,1,31,1,31,3, + 31,632,8,31,1,31,1,31,1,31,3,31,637,8,31,5,31,639,8,31,10,31,12, + 31,642,9,31,1,32,4,32,645,8,32,11,32,12,32,646,1,32,1,32,1,32,1, + 33,1,33,1,33,1,33,1,33,1,33,3,33,658,8,33,1,34,1,34,1,34,1,34,1, + 34,1,34,1,34,1,34,1,34,5,34,669,8,34,10,34,12,34,672,9,34,3,34,674, + 8,34,1,34,1,34,1,34,1,34,1,34,1,34,1,34,1,34,1,34,1,34,3,34,686, + 8,34,1,34,1,34,1,34,3,34,691,8,34,1,34,1,34,1,34,1,34,1,34,1,34, + 1,34,1,34,1,34,1,34,1,34,1,34,1,34,1,34,1,34,1,34,1,34,1,34,1,34, + 1,34,1,34,1,34,1,34,1,34,1,34,1,34,1,34,1,34,1,34,1,34,1,34,1,34, + 1,34,1,34,1,34,1,34,1,34,1,34,1,34,1,34,1,34,1,34,1,34,1,34,1,34, + 1,34,1,34,3,34,740,8,34,1,34,1,34,1,34,1,34,5,34,746,8,34,10,34, + 12,34,749,9,34,1,35,1,35,1,35,4,35,754,8,35,11,35,12,35,755,1,35, + 1,35,1,35,1,35,3,35,762,8,35,1,36,1,36,1,37,1,37,1,37,1,37,1,37, + 3,37,771,8,37,1,38,1,38,1,39,1,39,1,40,1,40,1,41,1,41,1,42,1,42, + 1,43,1,43,1,43,1,44,1,44,1,44,1,45,1,45,1,46,1,46,1,47,1,47,1,48, + 1,48,1,48,0,1,68,49,0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32, + 34,36,38,40,42,44,46,48,50,52,54,56,58,60,62,64,66,68,70,72,74,76, + 78,80,82,84,86,88,90,92,94,96,0,18,1,0,41,42,1,0,43,46,1,0,47,48, + 1,0,52,53,1,0,54,55,2,0,34,35,56,57,1,0,58,59,2,0,34,34,60,61,1, + 0,56,57,1,0,62,63,2,0,36,37,64,65,1,0,66,67,2,0,50,50,73,83,1,0, + 98,99,3,0,38,39,41,48,84,84,1,0,85,86,2,0,19,19,87,88,1,0,89,90, + 880,0,101,1,0,0,0,2,109,1,0,0,0,4,154,1,0,0,0,6,207,1,0,0,0,8,209, + 1,0,0,0,10,218,1,0,0,0,12,255,1,0,0,0,14,271,1,0,0,0,16,306,1,0, + 0,0,18,308,1,0,0,0,20,316,1,0,0,0,22,409,1,0,0,0,24,412,1,0,0,0, + 26,427,1,0,0,0,28,429,1,0,0,0,30,440,1,0,0,0,32,447,1,0,0,0,34,468, + 1,0,0,0,36,484,1,0,0,0,38,530,1,0,0,0,40,532,1,0,0,0,42,534,1,0, + 0,0,44,536,1,0,0,0,46,538,1,0,0,0,48,557,1,0,0,0,50,570,1,0,0,0, + 52,582,1,0,0,0,54,584,1,0,0,0,56,597,1,0,0,0,58,599,1,0,0,0,60,627, + 1,0,0,0,62,631,1,0,0,0,64,644,1,0,0,0,66,657,1,0,0,0,68,690,1,0, + 0,0,70,761,1,0,0,0,72,763,1,0,0,0,74,770,1,0,0,0,76,772,1,0,0,0, + 78,774,1,0,0,0,80,776,1,0,0,0,82,778,1,0,0,0,84,780,1,0,0,0,86,782, + 1,0,0,0,88,785,1,0,0,0,90,788,1,0,0,0,92,790,1,0,0,0,94,792,1,0, + 0,0,96,794,1,0,0,0,98,100,3,2,1,0,99,98,1,0,0,0,100,103,1,0,0,0, + 101,99,1,0,0,0,101,102,1,0,0,0,102,105,1,0,0,0,103,101,1,0,0,0,104, + 106,3,4,2,0,105,104,1,0,0,0,106,107,1,0,0,0,107,105,1,0,0,0,107, + 108,1,0,0,0,108,1,1,0,0,0,109,110,5,1,0,0,110,111,5,99,0,0,111,3, + 1,0,0,0,112,113,5,2,0,0,113,123,5,96,0,0,114,115,5,3,0,0,115,120, + 5,96,0,0,116,117,5,4,0,0,117,119,5,96,0,0,118,116,1,0,0,0,119,122, + 1,0,0,0,120,118,1,0,0,0,120,121,1,0,0,0,121,124,1,0,0,0,122,120, + 1,0,0,0,123,114,1,0,0,0,123,124,1,0,0,0,124,125,1,0,0,0,125,129, + 5,5,0,0,126,128,3,6,3,0,127,126,1,0,0,0,128,131,1,0,0,0,129,127, + 1,0,0,0,129,130,1,0,0,0,130,132,1,0,0,0,131,129,1,0,0,0,132,155, + 5,6,0,0,133,134,5,7,0,0,134,144,5,96,0,0,135,136,5,8,0,0,136,141, + 5,96,0,0,137,138,5,4,0,0,138,140,5,96,0,0,139,137,1,0,0,0,140,143, + 1,0,0,0,141,139,1,0,0,0,141,142,1,0,0,0,142,145,1,0,0,0,143,141, + 1,0,0,0,144,135,1,0,0,0,144,145,1,0,0,0,145,146,1,0,0,0,146,150, + 5,5,0,0,147,149,3,6,3,0,148,147,1,0,0,0,149,152,1,0,0,0,150,148, + 1,0,0,0,150,151,1,0,0,0,151,153,1,0,0,0,152,150,1,0,0,0,153,155, + 5,6,0,0,154,112,1,0,0,0,154,133,1,0,0,0,155,5,1,0,0,0,156,157,5, + 9,0,0,157,162,5,5,0,0,158,163,3,34,17,0,159,160,3,68,34,0,160,161, + 5,10,0,0,161,163,1,0,0,0,162,158,1,0,0,0,162,159,1,0,0,0,163,164, + 1,0,0,0,164,162,1,0,0,0,164,165,1,0,0,0,165,166,1,0,0,0,166,167, + 5,6,0,0,167,208,1,0,0,0,168,169,5,11,0,0,169,173,5,5,0,0,170,172, + 3,16,8,0,171,170,1,0,0,0,172,175,1,0,0,0,173,171,1,0,0,0,173,174, + 1,0,0,0,174,176,1,0,0,0,175,173,1,0,0,0,176,208,5,6,0,0,177,181, + 5,12,0,0,178,180,3,46,23,0,179,178,1,0,0,0,180,183,1,0,0,0,181,179, + 1,0,0,0,181,182,1,0,0,0,182,184,1,0,0,0,183,181,1,0,0,0,184,188, + 5,5,0,0,185,187,3,10,5,0,186,185,1,0,0,0,187,190,1,0,0,0,188,186, + 1,0,0,0,188,189,1,0,0,0,189,191,1,0,0,0,190,188,1,0,0,0,191,208, + 5,6,0,0,192,196,5,13,0,0,193,195,3,46,23,0,194,193,1,0,0,0,195,198, + 1,0,0,0,196,194,1,0,0,0,196,197,1,0,0,0,197,199,1,0,0,0,198,196, + 1,0,0,0,199,201,5,5,0,0,200,202,3,8,4,0,201,200,1,0,0,0,202,203, + 1,0,0,0,203,201,1,0,0,0,203,204,1,0,0,0,204,205,1,0,0,0,205,206, + 5,6,0,0,206,208,1,0,0,0,207,156,1,0,0,0,207,168,1,0,0,0,207,177, + 1,0,0,0,207,192,1,0,0,0,208,7,1,0,0,0,209,213,5,96,0,0,210,212,3, + 46,23,0,211,210,1,0,0,0,212,215,1,0,0,0,213,211,1,0,0,0,213,214, + 1,0,0,0,214,216,1,0,0,0,215,213,1,0,0,0,216,217,3,28,14,0,217,9, + 1,0,0,0,218,222,5,96,0,0,219,221,3,46,23,0,220,219,1,0,0,0,221,224, + 1,0,0,0,222,220,1,0,0,0,222,223,1,0,0,0,223,225,1,0,0,0,224,222, + 1,0,0,0,225,226,5,5,0,0,226,227,5,14,0,0,227,228,5,15,0,0,228,233, + 3,14,7,0,229,230,5,16,0,0,230,232,3,14,7,0,231,229,1,0,0,0,232,235, + 1,0,0,0,233,231,1,0,0,0,233,234,1,0,0,0,234,236,1,0,0,0,235,233, + 1,0,0,0,236,248,5,10,0,0,237,238,5,17,0,0,238,245,5,15,0,0,239,246, + 5,99,0,0,240,241,5,5,0,0,241,242,5,99,0,0,242,243,5,4,0,0,243,244, + 5,99,0,0,244,246,5,6,0,0,245,239,1,0,0,0,245,240,1,0,0,0,246,247, + 1,0,0,0,247,249,5,10,0,0,248,237,1,0,0,0,248,249,1,0,0,0,249,250, + 1,0,0,0,250,251,5,18,0,0,251,252,5,15,0,0,252,253,3,22,11,0,253, + 254,5,6,0,0,254,11,1,0,0,0,255,260,3,14,7,0,256,257,5,16,0,0,257, + 259,3,14,7,0,258,256,1,0,0,0,259,262,1,0,0,0,260,258,1,0,0,0,260, + 261,1,0,0,0,261,13,1,0,0,0,262,260,1,0,0,0,263,272,3,76,38,0,264, + 265,5,96,0,0,265,266,5,91,0,0,266,267,3,76,38,0,267,268,5,15,0,0, + 268,269,3,76,38,0,269,270,5,92,0,0,270,272,1,0,0,0,271,263,1,0,0, + 0,271,264,1,0,0,0,272,15,1,0,0,0,273,274,5,19,0,0,274,275,3,36,18, + 0,275,276,5,96,0,0,276,278,5,20,0,0,277,279,3,18,9,0,278,277,1,0, + 0,0,278,279,1,0,0,0,279,280,1,0,0,0,280,284,5,21,0,0,281,283,3,46, + 23,0,282,281,1,0,0,0,283,286,1,0,0,0,284,282,1,0,0,0,284,285,1,0, + 0,0,285,287,1,0,0,0,286,284,1,0,0,0,287,288,5,10,0,0,288,307,1,0, + 0,0,289,290,3,36,18,0,290,291,5,96,0,0,291,293,5,20,0,0,292,294, + 3,18,9,0,293,292,1,0,0,0,293,294,1,0,0,0,294,295,1,0,0,0,295,299, + 5,21,0,0,296,298,3,46,23,0,297,296,1,0,0,0,298,301,1,0,0,0,299,297, + 1,0,0,0,299,300,1,0,0,0,300,304,1,0,0,0,301,299,1,0,0,0,302,305, + 3,28,14,0,303,305,5,10,0,0,304,302,1,0,0,0,304,303,1,0,0,0,305,307, + 1,0,0,0,306,273,1,0,0,0,306,289,1,0,0,0,307,17,1,0,0,0,308,313,3, + 20,10,0,309,310,5,4,0,0,310,312,3,20,10,0,311,309,1,0,0,0,312,315, + 1,0,0,0,313,311,1,0,0,0,313,314,1,0,0,0,314,19,1,0,0,0,315,313,1, + 0,0,0,316,318,3,36,18,0,317,319,3,58,29,0,318,317,1,0,0,0,318,319, + 1,0,0,0,319,21,1,0,0,0,320,410,3,28,14,0,321,322,5,96,0,0,322,331, + 5,20,0,0,323,328,3,68,34,0,324,325,5,4,0,0,325,327,3,68,34,0,326, + 324,1,0,0,0,327,330,1,0,0,0,328,326,1,0,0,0,328,329,1,0,0,0,329, + 332,1,0,0,0,330,328,1,0,0,0,331,323,1,0,0,0,331,332,1,0,0,0,332, + 333,1,0,0,0,333,334,5,21,0,0,334,410,5,10,0,0,335,336,5,22,0,0,336, + 337,5,20,0,0,337,338,3,68,34,0,338,339,5,21,0,0,339,349,3,22,11, + 0,340,341,5,23,0,0,341,342,5,22,0,0,342,343,5,20,0,0,343,344,3,68, + 34,0,344,345,5,21,0,0,345,346,3,22,11,0,346,348,1,0,0,0,347,340, + 1,0,0,0,348,351,1,0,0,0,349,347,1,0,0,0,349,350,1,0,0,0,350,354, + 1,0,0,0,351,349,1,0,0,0,352,353,5,23,0,0,353,355,3,22,11,0,354,352, + 1,0,0,0,354,355,1,0,0,0,355,410,1,0,0,0,356,357,5,24,0,0,357,358, + 5,20,0,0,358,359,3,32,16,0,359,360,5,21,0,0,360,361,3,22,11,0,361, + 410,1,0,0,0,362,363,5,25,0,0,363,364,5,20,0,0,364,365,3,68,34,0, + 365,366,5,21,0,0,366,367,3,22,11,0,367,410,1,0,0,0,368,369,5,26, + 0,0,369,370,3,22,11,0,370,371,5,25,0,0,371,372,5,20,0,0,372,373, + 3,68,34,0,373,374,5,21,0,0,374,375,5,10,0,0,375,410,1,0,0,0,376, + 377,5,27,0,0,377,378,5,20,0,0,378,379,3,68,34,0,379,380,5,21,0,0, + 380,384,5,5,0,0,381,383,3,24,12,0,382,381,1,0,0,0,383,386,1,0,0, + 0,384,382,1,0,0,0,384,385,1,0,0,0,385,390,1,0,0,0,386,384,1,0,0, + 0,387,389,3,26,13,0,388,387,1,0,0,0,389,392,1,0,0,0,390,388,1,0, + 0,0,390,391,1,0,0,0,391,393,1,0,0,0,392,390,1,0,0,0,393,394,5,6, + 0,0,394,410,1,0,0,0,395,397,5,28,0,0,396,398,3,68,34,0,397,396,1, + 0,0,0,397,398,1,0,0,0,398,399,1,0,0,0,399,410,5,10,0,0,400,401,5, + 29,0,0,401,410,5,10,0,0,402,403,5,30,0,0,403,410,5,10,0,0,404,405, + 5,31,0,0,405,410,3,22,11,0,406,407,3,68,34,0,407,408,5,10,0,0,408, + 410,1,0,0,0,409,320,1,0,0,0,409,321,1,0,0,0,409,335,1,0,0,0,409, + 356,1,0,0,0,409,362,1,0,0,0,409,368,1,0,0,0,409,376,1,0,0,0,409, + 395,1,0,0,0,409,400,1,0,0,0,409,402,1,0,0,0,409,404,1,0,0,0,409, + 406,1,0,0,0,410,23,1,0,0,0,411,413,3,26,13,0,412,411,1,0,0,0,413, + 414,1,0,0,0,414,412,1,0,0,0,414,415,1,0,0,0,415,417,1,0,0,0,416, + 418,3,22,11,0,417,416,1,0,0,0,418,419,1,0,0,0,419,417,1,0,0,0,419, + 420,1,0,0,0,420,25,1,0,0,0,421,422,5,32,0,0,422,423,3,68,34,0,423, + 424,5,15,0,0,424,428,1,0,0,0,425,426,5,33,0,0,426,428,5,15,0,0,427, + 421,1,0,0,0,427,425,1,0,0,0,428,27,1,0,0,0,429,433,5,5,0,0,430,432, + 3,30,15,0,431,430,1,0,0,0,432,435,1,0,0,0,433,431,1,0,0,0,433,434, + 1,0,0,0,434,436,1,0,0,0,435,433,1,0,0,0,436,437,5,6,0,0,437,29,1, + 0,0,0,438,441,3,22,11,0,439,441,3,34,17,0,440,438,1,0,0,0,440,439, + 1,0,0,0,441,31,1,0,0,0,442,448,3,34,17,0,443,445,3,68,34,0,444,443, + 1,0,0,0,444,445,1,0,0,0,445,446,1,0,0,0,446,448,5,10,0,0,447,442, + 1,0,0,0,447,444,1,0,0,0,448,450,1,0,0,0,449,451,3,68,34,0,450,449, + 1,0,0,0,450,451,1,0,0,0,451,452,1,0,0,0,452,461,5,10,0,0,453,458, + 3,68,34,0,454,455,5,4,0,0,455,457,3,68,34,0,456,454,1,0,0,0,457, + 460,1,0,0,0,458,456,1,0,0,0,458,459,1,0,0,0,459,462,1,0,0,0,460, + 458,1,0,0,0,461,453,1,0,0,0,461,462,1,0,0,0,462,33,1,0,0,0,463,467, + 3,94,47,0,464,467,3,92,46,0,465,467,3,46,23,0,466,463,1,0,0,0,466, + 464,1,0,0,0,466,465,1,0,0,0,467,470,1,0,0,0,468,466,1,0,0,0,468, + 469,1,0,0,0,469,471,1,0,0,0,470,468,1,0,0,0,471,480,3,36,18,0,472, + 477,3,58,29,0,473,474,5,4,0,0,474,476,3,58,29,0,475,473,1,0,0,0, + 476,479,1,0,0,0,477,475,1,0,0,0,477,478,1,0,0,0,478,481,1,0,0,0, + 479,477,1,0,0,0,480,472,1,0,0,0,480,481,1,0,0,0,481,482,1,0,0,0, + 482,483,5,10,0,0,483,35,1,0,0,0,484,487,3,38,19,0,485,488,5,34,0, + 0,486,488,5,35,0,0,487,485,1,0,0,0,487,486,1,0,0,0,487,488,1,0,0, + 0,488,37,1,0,0,0,489,495,3,40,20,0,490,496,3,42,21,0,491,492,5,36, + 0,0,492,493,3,70,35,0,493,494,5,37,0,0,494,496,1,0,0,0,495,490,1, + 0,0,0,495,491,1,0,0,0,496,531,1,0,0,0,497,531,3,42,21,0,498,531, + 3,44,22,0,499,531,5,38,0,0,500,531,5,39,0,0,501,503,3,96,48,0,502, + 504,5,96,0,0,503,502,1,0,0,0,503,504,1,0,0,0,504,505,1,0,0,0,505, + 509,5,5,0,0,506,508,3,54,27,0,507,506,1,0,0,0,508,511,1,0,0,0,509, + 507,1,0,0,0,509,510,1,0,0,0,510,512,1,0,0,0,511,509,1,0,0,0,512, + 513,5,6,0,0,513,531,1,0,0,0,514,515,3,96,48,0,515,516,5,96,0,0,516, + 531,1,0,0,0,517,519,5,40,0,0,518,520,5,96,0,0,519,518,1,0,0,0,519, + 520,1,0,0,0,520,521,1,0,0,0,521,522,5,5,0,0,522,524,3,50,25,0,523, + 525,5,4,0,0,524,523,1,0,0,0,524,525,1,0,0,0,525,526,1,0,0,0,526, + 527,5,6,0,0,527,531,1,0,0,0,528,529,5,40,0,0,529,531,5,96,0,0,530, + 489,1,0,0,0,530,497,1,0,0,0,530,498,1,0,0,0,530,499,1,0,0,0,530, + 500,1,0,0,0,530,501,1,0,0,0,530,514,1,0,0,0,530,517,1,0,0,0,530, + 528,1,0,0,0,531,39,1,0,0,0,532,533,7,0,0,0,533,41,1,0,0,0,534,535, + 7,1,0,0,535,43,1,0,0,0,536,537,7,2,0,0,537,45,1,0,0,0,538,539,5, + 49,0,0,539,553,5,96,0,0,540,541,5,50,0,0,541,554,3,68,34,0,542,543, + 5,20,0,0,543,548,3,68,34,0,544,545,5,4,0,0,545,547,3,68,34,0,546, + 544,1,0,0,0,547,550,1,0,0,0,548,546,1,0,0,0,548,549,1,0,0,0,549, + 551,1,0,0,0,550,548,1,0,0,0,551,552,5,21,0,0,552,554,1,0,0,0,553, + 540,1,0,0,0,553,542,1,0,0,0,553,554,1,0,0,0,554,555,1,0,0,0,555, + 556,5,51,0,0,556,47,1,0,0,0,557,558,5,36,0,0,558,566,3,70,35,0,559, + 560,5,4,0,0,560,561,3,70,35,0,561,562,5,4,0,0,562,563,3,70,35,0, + 563,564,5,4,0,0,564,565,3,70,35,0,565,567,1,0,0,0,566,559,1,0,0, + 0,566,567,1,0,0,0,567,568,1,0,0,0,568,569,5,37,0,0,569,49,1,0,0, + 0,570,575,3,52,26,0,571,572,5,4,0,0,572,574,3,52,26,0,573,571,1, + 0,0,0,574,577,1,0,0,0,575,573,1,0,0,0,575,576,1,0,0,0,576,51,1,0, + 0,0,577,575,1,0,0,0,578,583,5,96,0,0,579,580,5,96,0,0,580,581,5, + 50,0,0,581,583,3,68,34,0,582,578,1,0,0,0,582,579,1,0,0,0,583,53, + 1,0,0,0,584,585,3,56,28,0,585,590,3,58,29,0,586,587,5,4,0,0,587, + 589,3,58,29,0,588,586,1,0,0,0,589,592,1,0,0,0,590,588,1,0,0,0,590, + 591,1,0,0,0,591,593,1,0,0,0,592,590,1,0,0,0,593,594,5,10,0,0,594, + 55,1,0,0,0,595,598,3,36,18,0,596,598,3,92,46,0,597,595,1,0,0,0,597, + 596,1,0,0,0,598,57,1,0,0,0,599,606,5,96,0,0,600,601,5,91,0,0,601, + 602,3,68,34,0,602,603,5,92,0,0,603,605,1,0,0,0,604,600,1,0,0,0,605, + 608,1,0,0,0,606,604,1,0,0,0,606,607,1,0,0,0,607,612,1,0,0,0,608, + 606,1,0,0,0,609,611,3,46,23,0,610,609,1,0,0,0,611,614,1,0,0,0,612, + 610,1,0,0,0,612,613,1,0,0,0,613,617,1,0,0,0,614,612,1,0,0,0,615, + 616,5,50,0,0,616,618,3,60,30,0,617,615,1,0,0,0,617,618,1,0,0,0,618, + 59,1,0,0,0,619,628,3,68,34,0,620,621,5,5,0,0,621,623,3,62,31,0,622, + 624,5,4,0,0,623,622,1,0,0,0,623,624,1,0,0,0,624,625,1,0,0,0,625, + 626,5,6,0,0,626,628,1,0,0,0,627,619,1,0,0,0,627,620,1,0,0,0,628, + 61,1,0,0,0,629,632,3,64,32,0,630,632,3,60,30,0,631,629,1,0,0,0,631, + 630,1,0,0,0,632,640,1,0,0,0,633,636,5,4,0,0,634,637,3,64,32,0,635, + 637,3,60,30,0,636,634,1,0,0,0,636,635,1,0,0,0,637,639,1,0,0,0,638, + 633,1,0,0,0,639,642,1,0,0,0,640,638,1,0,0,0,640,641,1,0,0,0,641, + 63,1,0,0,0,642,640,1,0,0,0,643,645,3,66,33,0,644,643,1,0,0,0,645, + 646,1,0,0,0,646,644,1,0,0,0,646,647,1,0,0,0,647,648,1,0,0,0,648, + 649,5,50,0,0,649,650,3,60,30,0,650,65,1,0,0,0,651,652,5,91,0,0,652, + 653,3,68,34,0,653,654,5,92,0,0,654,658,1,0,0,0,655,656,5,52,0,0, + 656,658,5,96,0,0,657,651,1,0,0,0,657,655,1,0,0,0,658,67,1,0,0,0, + 659,660,6,34,-1,0,660,691,3,70,35,0,661,662,7,3,0,0,662,691,5,96, + 0,0,663,664,5,96,0,0,664,673,5,20,0,0,665,670,3,68,34,0,666,667, + 5,4,0,0,667,669,3,68,34,0,668,666,1,0,0,0,669,672,1,0,0,0,670,668, + 1,0,0,0,670,671,1,0,0,0,671,674,1,0,0,0,672,670,1,0,0,0,673,665, + 1,0,0,0,673,674,1,0,0,0,674,675,1,0,0,0,675,691,5,21,0,0,676,677, + 7,4,0,0,677,691,3,68,34,17,678,679,7,5,0,0,679,691,3,68,34,16,680, + 681,7,6,0,0,681,691,3,68,34,15,682,685,5,20,0,0,683,686,3,36,18, + 0,684,686,3,40,20,0,685,683,1,0,0,0,685,684,1,0,0,0,686,687,1,0, + 0,0,687,688,5,21,0,0,688,689,3,68,34,14,689,691,1,0,0,0,690,659, + 1,0,0,0,690,661,1,0,0,0,690,663,1,0,0,0,690,676,1,0,0,0,690,678, + 1,0,0,0,690,680,1,0,0,0,690,682,1,0,0,0,691,747,1,0,0,0,692,693, + 10,13,0,0,693,694,7,7,0,0,694,746,3,68,34,14,695,696,10,12,0,0,696, + 697,7,8,0,0,697,746,3,68,34,13,698,699,10,11,0,0,699,700,7,9,0,0, + 700,746,3,68,34,12,701,702,10,10,0,0,702,703,7,10,0,0,703,746,3, + 68,34,11,704,705,10,9,0,0,705,706,7,11,0,0,706,746,3,68,34,10,707, + 708,10,8,0,0,708,709,5,35,0,0,709,746,3,68,34,9,710,711,10,7,0,0, + 711,712,5,68,0,0,712,746,3,68,34,8,713,714,10,6,0,0,714,715,5,69, + 0,0,715,746,3,68,34,7,716,717,10,5,0,0,717,718,5,70,0,0,718,746, + 3,68,34,6,719,720,10,4,0,0,720,721,5,71,0,0,721,746,3,68,34,5,722, + 723,10,3,0,0,723,724,5,16,0,0,724,746,3,68,34,4,725,726,10,2,0,0, + 726,727,5,72,0,0,727,728,3,68,34,0,728,729,5,15,0,0,729,730,3,68, + 34,2,730,746,1,0,0,0,731,732,10,1,0,0,732,733,7,12,0,0,733,746,3, + 68,34,1,734,735,10,20,0,0,735,736,5,91,0,0,736,739,3,68,34,0,737, + 738,5,15,0,0,738,740,3,68,34,0,739,737,1,0,0,0,739,740,1,0,0,0,740, + 741,1,0,0,0,741,742,5,92,0,0,742,746,1,0,0,0,743,744,10,18,0,0,744, + 746,7,4,0,0,745,692,1,0,0,0,745,695,1,0,0,0,745,698,1,0,0,0,745, + 701,1,0,0,0,745,704,1,0,0,0,745,707,1,0,0,0,745,710,1,0,0,0,745, + 713,1,0,0,0,745,716,1,0,0,0,745,719,1,0,0,0,745,722,1,0,0,0,745, + 725,1,0,0,0,745,731,1,0,0,0,745,734,1,0,0,0,745,743,1,0,0,0,746, + 749,1,0,0,0,747,745,1,0,0,0,747,748,1,0,0,0,748,69,1,0,0,0,749,747, + 1,0,0,0,750,762,5,96,0,0,751,762,3,74,37,0,752,754,3,72,36,0,753, + 752,1,0,0,0,754,755,1,0,0,0,755,753,1,0,0,0,755,756,1,0,0,0,756, + 762,1,0,0,0,757,758,5,20,0,0,758,759,3,68,34,0,759,760,5,21,0,0, + 760,762,1,0,0,0,761,750,1,0,0,0,761,751,1,0,0,0,761,753,1,0,0,0, + 761,757,1,0,0,0,762,71,1,0,0,0,763,764,7,13,0,0,764,73,1,0,0,0,765, + 771,3,76,38,0,766,771,3,78,39,0,767,771,3,82,41,0,768,771,3,84,42, + 0,769,771,3,80,40,0,770,765,1,0,0,0,770,766,1,0,0,0,770,767,1,0, + 0,0,770,768,1,0,0,0,770,769,1,0,0,0,771,75,1,0,0,0,772,773,5,95, + 0,0,773,77,1,0,0,0,774,775,5,94,0,0,775,79,1,0,0,0,776,777,5,93, + 0,0,777,81,1,0,0,0,778,779,5,97,0,0,779,83,1,0,0,0,780,781,5,99, + 0,0,781,85,1,0,0,0,782,783,5,91,0,0,783,784,5,91,0,0,784,87,1,0, + 0,0,785,786,5,92,0,0,786,787,5,92,0,0,787,89,1,0,0,0,788,789,7,14, + 0,0,789,91,1,0,0,0,790,791,7,15,0,0,791,93,1,0,0,0,792,793,7,16, + 0,0,793,95,1,0,0,0,794,795,7,17,0,0,795,97,1,0,0,0,88,101,107,120, + 123,129,141,144,150,154,162,164,173,181,188,196,203,207,213,222, + 233,245,248,260,271,278,284,293,299,304,306,313,318,328,331,349, + 354,384,390,397,409,414,419,427,433,440,444,447,450,458,461,466, + 468,477,480,487,495,503,509,519,524,530,548,553,566,575,582,590, + 597,606,612,617,623,627,631,636,640,646,657,670,673,685,690,739, + 745,747,755,761,770 ] class CoreDSL2Parser ( Parser ): @@ -409,12 +410,13 @@ class CoreDSL2Parser ( Parser ): RULE_floating_constant = 39 RULE_bool_constant = 40 RULE_character_constant = 41 - RULE_double_left_bracket = 42 - RULE_double_right_bracket = 43 - RULE_data_types = 44 - RULE_type_qualifier = 45 - RULE_storage_class_specifier = 46 - RULE_struct_or_union = 47 + RULE_string_constant = 42 + RULE_double_left_bracket = 43 + RULE_double_right_bracket = 44 + RULE_data_types = 45 + RULE_type_qualifier = 46 + RULE_storage_class_specifier = 47 + RULE_struct_or_union = 48 ruleNames = [ "description_content", "import_file", "isa", "section", "always_block", "instruction", "rule_encoding", "encoding_entry", @@ -428,9 +430,9 @@ class CoreDSL2Parser ( Parser ): "declarator", "initializer", "initializerList", "designated_initializer", "designator", "expression", "primary", "string_literal", "constant", "integer_constant", "floating_constant", - "bool_constant", "character_constant", "double_left_bracket", - "double_right_bracket", "data_types", "type_qualifier", - "storage_class_specifier", "struct_or_union" ] + "bool_constant", "character_constant", "string_constant", + "double_left_bracket", "double_right_bracket", "data_types", + "type_qualifier", "storage_class_specifier", "struct_or_union" ] EOF = Token.EOF T__0=1 @@ -597,25 +599,25 @@ def description_content(self): self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) - self.state = 99 + self.state = 101 self._errHandler.sync(self) _la = self._input.LA(1) while _la==1: - self.state = 96 + self.state = 98 localctx._import_file = self.import_file() localctx.imports.append(localctx._import_file) - self.state = 101 + self.state = 103 self._errHandler.sync(self) _la = self._input.LA(1) - self.state = 103 + self.state = 105 self._errHandler.sync(self) _la = self._input.LA(1) while True: - self.state = 102 + self.state = 104 localctx._isa = self.isa() localctx.definitions.append(localctx._isa) - self.state = 105 + self.state = 107 self._errHandler.sync(self) _la = self._input.LA(1) if not (_la==2 or _la==7): @@ -667,9 +669,9 @@ def import_file(self): self.enterRule(localctx, 2, self.RULE_import_file) try: self.enterOuterAlt(localctx, 1) - self.state = 107 + self.state = 109 self.match(CoreDSL2Parser.T__0) - self.state = 108 + self.state = 110 localctx.uri = self.match(CoreDSL2Parser.STRING) except RecognitionException as re: localctx.exception = re @@ -780,101 +782,101 @@ def isa(self): self.enterRule(localctx, 4, self.RULE_isa) self._la = 0 # Token type try: - self.state = 152 + self.state = 154 self._errHandler.sync(self) token = self._input.LA(1) if token in [2]: localctx = CoreDSL2Parser.Instruction_setContext(self, localctx) self.enterOuterAlt(localctx, 1) - self.state = 110 + self.state = 112 self.match(CoreDSL2Parser.T__1) - self.state = 111 + self.state = 113 localctx.name = self.match(CoreDSL2Parser.IDENTIFIER) - self.state = 121 + self.state = 123 self._errHandler.sync(self) _la = self._input.LA(1) if _la==3: - self.state = 112 + self.state = 114 self.match(CoreDSL2Parser.T__2) - self.state = 113 + self.state = 115 localctx._IDENTIFIER = self.match(CoreDSL2Parser.IDENTIFIER) localctx.extension.append(localctx._IDENTIFIER) - self.state = 118 + self.state = 120 self._errHandler.sync(self) _la = self._input.LA(1) while _la==4: - self.state = 114 + self.state = 116 self.match(CoreDSL2Parser.T__3) - self.state = 115 + self.state = 117 localctx._IDENTIFIER = self.match(CoreDSL2Parser.IDENTIFIER) localctx.extension.append(localctx._IDENTIFIER) - self.state = 120 + self.state = 122 self._errHandler.sync(self) _la = self._input.LA(1) - self.state = 123 + self.state = 125 self.match(CoreDSL2Parser.T__4) - self.state = 127 + self.state = 129 self._errHandler.sync(self) _la = self._input.LA(1) while (((_la) & ~0x3f) == 0 and ((1 << _la) & 14848) != 0): - self.state = 124 + self.state = 126 localctx._section = self.section() localctx.sections.append(localctx._section) - self.state = 129 + self.state = 131 self._errHandler.sync(self) _la = self._input.LA(1) - self.state = 130 + self.state = 132 self.match(CoreDSL2Parser.T__5) pass elif token in [7]: localctx = CoreDSL2Parser.Core_defContext(self, localctx) self.enterOuterAlt(localctx, 2) - self.state = 131 + self.state = 133 self.match(CoreDSL2Parser.T__6) - self.state = 132 + self.state = 134 localctx.name = self.match(CoreDSL2Parser.IDENTIFIER) - self.state = 142 + self.state = 144 self._errHandler.sync(self) _la = self._input.LA(1) if _la==8: - self.state = 133 + self.state = 135 self.match(CoreDSL2Parser.T__7) - self.state = 134 + self.state = 136 localctx._IDENTIFIER = self.match(CoreDSL2Parser.IDENTIFIER) localctx.contributing_types.append(localctx._IDENTIFIER) - self.state = 139 + self.state = 141 self._errHandler.sync(self) _la = self._input.LA(1) while _la==4: - self.state = 135 + self.state = 137 self.match(CoreDSL2Parser.T__3) - self.state = 136 + self.state = 138 localctx._IDENTIFIER = self.match(CoreDSL2Parser.IDENTIFIER) localctx.contributing_types.append(localctx._IDENTIFIER) - self.state = 141 + self.state = 143 self._errHandler.sync(self) _la = self._input.LA(1) - self.state = 144 + self.state = 146 self.match(CoreDSL2Parser.T__4) - self.state = 148 + self.state = 150 self._errHandler.sync(self) _la = self._input.LA(1) while (((_la) & ~0x3f) == 0 and ((1 << _la) & 14848) != 0): - self.state = 145 + self.state = 147 localctx._section = self.section() localctx.sections.append(localctx._section) - self.state = 150 + self.state = 152 self._errHandler.sync(self) _la = self._input.LA(1) - self.state = 151 + self.state = 153 self.match(CoreDSL2Parser.T__5) pass else: @@ -1061,134 +1063,132 @@ def section(self): self.enterRule(localctx, 6, self.RULE_section) self._la = 0 # Token type try: - self.state = 205 + self.state = 207 self._errHandler.sync(self) token = self._input.LA(1) if token in [9]: localctx = CoreDSL2Parser.Section_arch_stateContext(self, localctx) self.enterOuterAlt(localctx, 1) - self.state = 154 + self.state = 156 localctx.type_ = self.match(CoreDSL2Parser.T__8) - self.state = 155 + self.state = 157 self.match(CoreDSL2Parser.T__4) - self.state = 160 + self.state = 162 self._errHandler.sync(self) _la = self._input.LA(1) while True: - self.state = 160 + self.state = 162 self._errHandler.sync(self) token = self._input.LA(1) if token in [19, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 85, 86, 87, 88, 89, 90]: - self.state = 156 + self.state = 158 localctx._declaration = self.declaration() localctx.declarations.append(localctx._declaration) pass elif token in [20, 34, 35, 52, 53, 54, 55, 56, 57, 58, 59, 93, 94, 95, 96, 97, 98, 99]: - self.state = 157 + self.state = 159 localctx._expression = self.expression(0) localctx.expressions.append(localctx._expression) - self.state = 158 + self.state = 160 self.match(CoreDSL2Parser.T__9) pass else: raise NoViableAltException(self) - self.state = 162 + self.state = 164 self._errHandler.sync(self) _la = self._input.LA(1) if not ((((_la) & ~0x3f) == 0 and ((1 << _la) & 1149543581549592576) != 0) or ((((_la - 85)) & ~0x3f) == 0 and ((1 << (_la - 85)) & 32575) != 0)): break - self.state = 164 + self.state = 166 self.match(CoreDSL2Parser.T__5) pass elif token in [11]: localctx = CoreDSL2Parser.Section_functionsContext(self, localctx) self.enterOuterAlt(localctx, 2) - self.state = 166 + self.state = 168 localctx.type_ = self.match(CoreDSL2Parser.T__10) - self.state = 167 + self.state = 169 self.match(CoreDSL2Parser.T__4) - self.state = 169 + self.state = 173 self._errHandler.sync(self) _la = self._input.LA(1) - while True: - self.state = 168 + while (((_la) & ~0x3f) == 0 and ((1 << _la) & 562675076038656) != 0) or _la==89 or _la==90: + self.state = 170 localctx._function_definition = self.function_definition() localctx.functions.append(localctx._function_definition) - self.state = 171 + self.state = 175 self._errHandler.sync(self) _la = self._input.LA(1) - if not ((((_la) & ~0x3f) == 0 and ((1 << _la) & 562675076038656) != 0) or _la==89 or _la==90): - break - self.state = 173 + self.state = 176 self.match(CoreDSL2Parser.T__5) pass elif token in [12]: localctx = CoreDSL2Parser.Section_instructionsContext(self, localctx) self.enterOuterAlt(localctx, 3) - self.state = 175 + self.state = 177 localctx.type_ = self.match(CoreDSL2Parser.T__11) - self.state = 179 + self.state = 181 self._errHandler.sync(self) _la = self._input.LA(1) while _la==49: - self.state = 176 + self.state = 178 localctx._attribute = self.attribute() localctx.attributes.append(localctx._attribute) - self.state = 181 + self.state = 183 self._errHandler.sync(self) _la = self._input.LA(1) - self.state = 182 + self.state = 184 self.match(CoreDSL2Parser.T__4) - self.state = 186 + self.state = 188 self._errHandler.sync(self) _la = self._input.LA(1) while _la==96: - self.state = 183 + self.state = 185 localctx._instruction = self.instruction() localctx.instructions.append(localctx._instruction) - self.state = 188 + self.state = 190 self._errHandler.sync(self) _la = self._input.LA(1) - self.state = 189 + self.state = 191 self.match(CoreDSL2Parser.T__5) pass elif token in [13]: localctx = CoreDSL2Parser.Section_alwaysContext(self, localctx) self.enterOuterAlt(localctx, 4) - self.state = 190 + self.state = 192 localctx.type_ = self.match(CoreDSL2Parser.T__12) - self.state = 194 + self.state = 196 self._errHandler.sync(self) _la = self._input.LA(1) while _la==49: - self.state = 191 + self.state = 193 localctx._attribute = self.attribute() localctx.attributes.append(localctx._attribute) - self.state = 196 + self.state = 198 self._errHandler.sync(self) _la = self._input.LA(1) - self.state = 197 + self.state = 199 self.match(CoreDSL2Parser.T__4) - self.state = 199 + self.state = 201 self._errHandler.sync(self) _la = self._input.LA(1) while True: - self.state = 198 + self.state = 200 localctx._always_block = self.always_block() localctx.always_blocks.append(localctx._always_block) - self.state = 201 + self.state = 203 self._errHandler.sync(self) _la = self._input.LA(1) if not (_la==96): break - self.state = 203 + self.state = 205 self.match(CoreDSL2Parser.T__5) pass else: @@ -1255,20 +1255,20 @@ def always_block(self): self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) - self.state = 207 + self.state = 209 localctx.name = self.match(CoreDSL2Parser.IDENTIFIER) - self.state = 211 + self.state = 213 self._errHandler.sync(self) _la = self._input.LA(1) while _la==49: - self.state = 208 + self.state = 210 localctx._attribute = self.attribute() localctx.attributes.append(localctx._attribute) - self.state = 213 + self.state = 215 self._errHandler.sync(self) _la = self._input.LA(1) - self.state = 214 + self.state = 216 localctx.behavior = self.block() except RecognitionException as re: localctx.exception = re @@ -1348,84 +1348,84 @@ def instruction(self): self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) - self.state = 216 + self.state = 218 localctx.name = self.match(CoreDSL2Parser.IDENTIFIER) - self.state = 220 + self.state = 222 self._errHandler.sync(self) _la = self._input.LA(1) while _la==49: - self.state = 217 + self.state = 219 localctx._attribute = self.attribute() localctx.attributes.append(localctx._attribute) - self.state = 222 + self.state = 224 self._errHandler.sync(self) _la = self._input.LA(1) - self.state = 223 + self.state = 225 self.match(CoreDSL2Parser.T__4) - self.state = 224 + self.state = 226 self.match(CoreDSL2Parser.T__13) - self.state = 225 + self.state = 227 self.match(CoreDSL2Parser.T__14) - self.state = 226 + self.state = 228 localctx._encoding_entry = self.encoding_entry() localctx.encoding.append(localctx._encoding_entry) - self.state = 231 + self.state = 233 self._errHandler.sync(self) _la = self._input.LA(1) while _la==16: - self.state = 227 + self.state = 229 self.match(CoreDSL2Parser.T__15) - self.state = 228 + self.state = 230 localctx._encoding_entry = self.encoding_entry() localctx.encoding.append(localctx._encoding_entry) - self.state = 233 + self.state = 235 self._errHandler.sync(self) _la = self._input.LA(1) - self.state = 234 + self.state = 236 self.match(CoreDSL2Parser.T__9) - self.state = 246 + self.state = 248 self._errHandler.sync(self) _la = self._input.LA(1) if _la==17: - self.state = 235 + self.state = 237 self.match(CoreDSL2Parser.T__16) - self.state = 236 + self.state = 238 self.match(CoreDSL2Parser.T__14) - self.state = 243 + self.state = 245 self._errHandler.sync(self) token = self._input.LA(1) if token in [99]: - self.state = 237 + self.state = 239 localctx.assembly = self.match(CoreDSL2Parser.STRING) pass elif token in [5]: - self.state = 238 + self.state = 240 self.match(CoreDSL2Parser.T__4) - self.state = 239 + self.state = 241 localctx.mnemonic = self.match(CoreDSL2Parser.STRING) - self.state = 240 + self.state = 242 self.match(CoreDSL2Parser.T__3) - self.state = 241 + self.state = 243 localctx.assembly = self.match(CoreDSL2Parser.STRING) - self.state = 242 + self.state = 244 self.match(CoreDSL2Parser.T__5) pass else: raise NoViableAltException(self) - self.state = 245 + self.state = 247 self.match(CoreDSL2Parser.T__9) - self.state = 248 + self.state = 250 self.match(CoreDSL2Parser.T__17) - self.state = 249 + self.state = 251 self.match(CoreDSL2Parser.T__14) - self.state = 250 + self.state = 252 localctx.behavior = self.statement() - self.state = 251 + self.state = 253 self.match(CoreDSL2Parser.T__5) except RecognitionException as re: localctx.exception = re @@ -1479,19 +1479,19 @@ def rule_encoding(self): self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) - self.state = 253 + self.state = 255 localctx._encoding_entry = self.encoding_entry() localctx.fields.append(localctx._encoding_entry) - self.state = 258 + self.state = 260 self._errHandler.sync(self) _la = self._input.LA(1) while _la==16: - self.state = 254 + self.state = 256 self.match(CoreDSL2Parser.T__15) - self.state = 255 + self.state = 257 localctx._encoding_entry = self.encoding_entry() localctx.fields.append(localctx._encoding_entry) - self.state = 260 + self.state = 262 self._errHandler.sync(self) _la = self._input.LA(1) @@ -1590,29 +1590,29 @@ def encoding_entry(self): localctx = CoreDSL2Parser.Encoding_entryContext(self, self._ctx, self.state) self.enterRule(localctx, 14, self.RULE_encoding_entry) try: - self.state = 269 + self.state = 271 self._errHandler.sync(self) token = self._input.LA(1) if token in [95]: localctx = CoreDSL2Parser.Bit_valueContext(self, localctx) self.enterOuterAlt(localctx, 1) - self.state = 261 + self.state = 263 localctx.value = self.integer_constant() pass elif token in [96]: localctx = CoreDSL2Parser.Bit_fieldContext(self, localctx) self.enterOuterAlt(localctx, 2) - self.state = 262 + self.state = 264 localctx.name = self.match(CoreDSL2Parser.IDENTIFIER) - self.state = 263 + self.state = 265 self.match(CoreDSL2Parser.LEFT_BR) - self.state = 264 + self.state = 266 localctx.left = self.integer_constant() - self.state = 265 + self.state = 267 self.match(CoreDSL2Parser.T__14) - self.state = 266 + self.state = 268 localctx.right = self.integer_constant() - self.state = 267 + self.state = 269 self.match(CoreDSL2Parser.RIGHT_BR) pass else: @@ -1689,81 +1689,81 @@ def function_definition(self): self.enterRule(localctx, 16, self.RULE_function_definition) self._la = 0 # Token type try: - self.state = 304 + self.state = 306 self._errHandler.sync(self) token = self._input.LA(1) if token in [19]: self.enterOuterAlt(localctx, 1) - self.state = 271 + self.state = 273 localctx.extern = self.match(CoreDSL2Parser.T__18) - self.state = 272 + self.state = 274 localctx.type_ = self.type_specifier() - self.state = 273 + self.state = 275 localctx.name = self.match(CoreDSL2Parser.IDENTIFIER) - self.state = 274 - self.match(CoreDSL2Parser.T__19) self.state = 276 + self.match(CoreDSL2Parser.T__19) + self.state = 278 self._errHandler.sync(self) _la = self._input.LA(1) if ((((_la - 38)) & ~0x3f) == 0 and ((1 << (_la - 38)) & 6755399441057791) != 0): - self.state = 275 + self.state = 277 localctx.params = self.parameter_list() - self.state = 278 + self.state = 280 self.match(CoreDSL2Parser.T__20) - self.state = 282 + self.state = 284 self._errHandler.sync(self) _la = self._input.LA(1) while _la==49: - self.state = 279 + self.state = 281 localctx._attribute = self.attribute() localctx.attributes.append(localctx._attribute) - self.state = 284 + self.state = 286 self._errHandler.sync(self) _la = self._input.LA(1) - self.state = 285 + self.state = 287 self.match(CoreDSL2Parser.T__9) pass elif token in [38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 89, 90]: self.enterOuterAlt(localctx, 2) - self.state = 287 + self.state = 289 localctx.type_ = self.type_specifier() - self.state = 288 + self.state = 290 localctx.name = self.match(CoreDSL2Parser.IDENTIFIER) - self.state = 289 - self.match(CoreDSL2Parser.T__19) self.state = 291 + self.match(CoreDSL2Parser.T__19) + self.state = 293 self._errHandler.sync(self) _la = self._input.LA(1) if ((((_la - 38)) & ~0x3f) == 0 and ((1 << (_la - 38)) & 6755399441057791) != 0): - self.state = 290 + self.state = 292 localctx.params = self.parameter_list() - self.state = 293 + self.state = 295 self.match(CoreDSL2Parser.T__20) - self.state = 297 + self.state = 299 self._errHandler.sync(self) _la = self._input.LA(1) while _la==49: - self.state = 294 + self.state = 296 localctx._attribute = self.attribute() localctx.attributes.append(localctx._attribute) - self.state = 299 + self.state = 301 self._errHandler.sync(self) _la = self._input.LA(1) - self.state = 302 + self.state = 304 self._errHandler.sync(self) token = self._input.LA(1) if token in [5]: - self.state = 300 + self.state = 302 localctx.behavior = self.block() pass elif token in [10]: - self.state = 301 + self.state = 303 self.match(CoreDSL2Parser.T__9) pass else: @@ -1825,19 +1825,19 @@ def parameter_list(self): self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) - self.state = 306 + self.state = 308 localctx._parameter_declaration = self.parameter_declaration() localctx.params.append(localctx._parameter_declaration) - self.state = 311 + self.state = 313 self._errHandler.sync(self) _la = self._input.LA(1) while _la==4: - self.state = 307 + self.state = 309 self.match(CoreDSL2Parser.T__3) - self.state = 308 + self.state = 310 localctx._parameter_declaration = self.parameter_declaration() localctx.params.append(localctx._parameter_declaration) - self.state = 313 + self.state = 315 self._errHandler.sync(self) _la = self._input.LA(1) @@ -1894,13 +1894,13 @@ def parameter_declaration(self): self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) - self.state = 314 - localctx.type_ = self.type_specifier() self.state = 316 + localctx.type_ = self.type_specifier() + self.state = 318 self._errHandler.sync(self) _la = self._input.LA(1) if _la==96: - self.state = 315 + self.state = 317 localctx.decl = self.declarator() @@ -2294,96 +2294,96 @@ def statement(self): self.enterRule(localctx, 22, self.RULE_statement) self._la = 0 # Token type try: - self.state = 407 + self.state = 409 self._errHandler.sync(self) la_ = self._interp.adaptivePredict(self._input,39,self._ctx) if la_ == 1: localctx = CoreDSL2Parser.Block_statementContext(self, localctx) self.enterOuterAlt(localctx, 1) - self.state = 318 + self.state = 320 self.block() pass elif la_ == 2: localctx = CoreDSL2Parser.Procedure_callContext(self, localctx) self.enterOuterAlt(localctx, 2) - self.state = 319 + self.state = 321 localctx.ref = self.match(CoreDSL2Parser.IDENTIFIER) - self.state = 320 + self.state = 322 self.match(CoreDSL2Parser.T__19) - self.state = 329 + self.state = 331 self._errHandler.sync(self) _la = self._input.LA(1) if (((_la) & ~0x3f) == 0 and ((1 << _la) & 1148417956520132608) != 0) or ((((_la - 93)) & ~0x3f) == 0 and ((1 << (_la - 93)) & 127) != 0): - self.state = 321 + self.state = 323 localctx._expression = self.expression(0) localctx.args.append(localctx._expression) - self.state = 326 + self.state = 328 self._errHandler.sync(self) _la = self._input.LA(1) while _la==4: - self.state = 322 + self.state = 324 self.match(CoreDSL2Parser.T__3) - self.state = 323 + self.state = 325 localctx._expression = self.expression(0) localctx.args.append(localctx._expression) - self.state = 328 + self.state = 330 self._errHandler.sync(self) _la = self._input.LA(1) - self.state = 331 + self.state = 333 self.match(CoreDSL2Parser.T__20) - self.state = 332 + self.state = 334 self.match(CoreDSL2Parser.T__9) pass elif la_ == 3: localctx = CoreDSL2Parser.If_statementContext(self, localctx) self.enterOuterAlt(localctx, 3) - self.state = 333 + self.state = 335 localctx.type_ = self.match(CoreDSL2Parser.T__21) - self.state = 334 + self.state = 336 self.match(CoreDSL2Parser.T__19) - self.state = 335 + self.state = 337 localctx._expression = self.expression(0) localctx.cond.append(localctx._expression) - self.state = 336 + self.state = 338 self.match(CoreDSL2Parser.T__20) - self.state = 337 + self.state = 339 localctx._statement = self.statement() localctx.stmt.append(localctx._statement) - self.state = 347 + self.state = 349 self._errHandler.sync(self) _alt = self._interp.adaptivePredict(self._input,34,self._ctx) while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER: if _alt==1: - self.state = 338 + self.state = 340 self.match(CoreDSL2Parser.T__22) - self.state = 339 + self.state = 341 self.match(CoreDSL2Parser.T__21) - self.state = 340 + self.state = 342 self.match(CoreDSL2Parser.T__19) - self.state = 341 + self.state = 343 localctx._expression = self.expression(0) localctx.cond.append(localctx._expression) - self.state = 342 + self.state = 344 self.match(CoreDSL2Parser.T__20) - self.state = 343 + self.state = 345 localctx._statement = self.statement() localctx.stmt.append(localctx._statement) - self.state = 349 + self.state = 351 self._errHandler.sync(self) _alt = self._interp.adaptivePredict(self._input,34,self._ctx) - self.state = 352 + self.state = 354 self._errHandler.sync(self) la_ = self._interp.adaptivePredict(self._input,35,self._ctx) if la_ == 1: - self.state = 350 + self.state = 352 self.match(CoreDSL2Parser.T__22) - self.state = 351 + self.state = 353 localctx._statement = self.statement() localctx.stmt.append(localctx._statement) @@ -2393,141 +2393,141 @@ def statement(self): elif la_ == 4: localctx = CoreDSL2Parser.For_statementContext(self, localctx) self.enterOuterAlt(localctx, 4) - self.state = 354 + self.state = 356 localctx.type_ = self.match(CoreDSL2Parser.T__23) - self.state = 355 + self.state = 357 self.match(CoreDSL2Parser.T__19) - self.state = 356 + self.state = 358 localctx.cond = self.for_condition() - self.state = 357 + self.state = 359 self.match(CoreDSL2Parser.T__20) - self.state = 358 + self.state = 360 localctx.stmt = self.statement() pass elif la_ == 5: localctx = CoreDSL2Parser.While_statementContext(self, localctx) self.enterOuterAlt(localctx, 5) - self.state = 360 + self.state = 362 localctx.type_ = self.match(CoreDSL2Parser.T__24) - self.state = 361 + self.state = 363 self.match(CoreDSL2Parser.T__19) - self.state = 362 + self.state = 364 localctx.cond = self.expression(0) - self.state = 363 + self.state = 365 self.match(CoreDSL2Parser.T__20) - self.state = 364 + self.state = 366 localctx.stmt = self.statement() pass elif la_ == 6: localctx = CoreDSL2Parser.Do_statementContext(self, localctx) self.enterOuterAlt(localctx, 6) - self.state = 366 + self.state = 368 localctx.type_ = self.match(CoreDSL2Parser.T__25) - self.state = 367 + self.state = 369 localctx.stmt = self.statement() - self.state = 368 + self.state = 370 self.match(CoreDSL2Parser.T__24) - self.state = 369 + self.state = 371 self.match(CoreDSL2Parser.T__19) - self.state = 370 + self.state = 372 localctx.cond = self.expression(0) - self.state = 371 + self.state = 373 self.match(CoreDSL2Parser.T__20) - self.state = 372 + self.state = 374 self.match(CoreDSL2Parser.T__9) pass elif la_ == 7: localctx = CoreDSL2Parser.Switch_statementContext(self, localctx) self.enterOuterAlt(localctx, 7) - self.state = 374 + self.state = 376 localctx.type_ = self.match(CoreDSL2Parser.T__26) - self.state = 375 + self.state = 377 self.match(CoreDSL2Parser.T__19) - self.state = 376 + self.state = 378 localctx.cond = self.expression(0) - self.state = 377 + self.state = 379 self.match(CoreDSL2Parser.T__20) - self.state = 378 + self.state = 380 self.match(CoreDSL2Parser.T__4) - self.state = 382 + self.state = 384 self._errHandler.sync(self) _alt = self._interp.adaptivePredict(self._input,36,self._ctx) while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER: if _alt==1: - self.state = 379 + self.state = 381 localctx._switch_block_statement_group = self.switch_block_statement_group() localctx.items.append(localctx._switch_block_statement_group) - self.state = 384 + self.state = 386 self._errHandler.sync(self) _alt = self._interp.adaptivePredict(self._input,36,self._ctx) - self.state = 388 + self.state = 390 self._errHandler.sync(self) _la = self._input.LA(1) while _la==32 or _la==33: - self.state = 385 + self.state = 387 self.switch_label() - self.state = 390 + self.state = 392 self._errHandler.sync(self) _la = self._input.LA(1) - self.state = 391 + self.state = 393 self.match(CoreDSL2Parser.T__5) pass elif la_ == 8: localctx = CoreDSL2Parser.Return_statementContext(self, localctx) self.enterOuterAlt(localctx, 8) - self.state = 393 - localctx.type_ = self.match(CoreDSL2Parser.T__27) self.state = 395 + localctx.type_ = self.match(CoreDSL2Parser.T__27) + self.state = 397 self._errHandler.sync(self) _la = self._input.LA(1) if (((_la) & ~0x3f) == 0 and ((1 << _la) & 1148417956520132608) != 0) or ((((_la - 93)) & ~0x3f) == 0 and ((1 << (_la - 93)) & 127) != 0): - self.state = 394 + self.state = 396 localctx.expr = self.expression(0) - self.state = 397 + self.state = 399 self.match(CoreDSL2Parser.T__9) pass elif la_ == 9: localctx = CoreDSL2Parser.Break_statementContext(self, localctx) self.enterOuterAlt(localctx, 9) - self.state = 398 + self.state = 400 localctx.type_ = self.match(CoreDSL2Parser.T__28) - self.state = 399 + self.state = 401 self.match(CoreDSL2Parser.T__9) pass elif la_ == 10: localctx = CoreDSL2Parser.Continue_statementContext(self, localctx) self.enterOuterAlt(localctx, 10) - self.state = 400 + self.state = 402 localctx.type_ = self.match(CoreDSL2Parser.T__29) - self.state = 401 + self.state = 403 self.match(CoreDSL2Parser.T__9) pass elif la_ == 11: localctx = CoreDSL2Parser.Spawn_statementContext(self, localctx) self.enterOuterAlt(localctx, 11) - self.state = 402 + self.state = 404 localctx.type_ = self.match(CoreDSL2Parser.T__30) - self.state = 403 + self.state = 405 localctx.stmt = self.statement() pass elif la_ == 12: localctx = CoreDSL2Parser.Expression_statementContext(self, localctx) self.enterOuterAlt(localctx, 12) - self.state = 404 + self.state = 406 localctx.expr = self.expression(0) - self.state = 405 + self.state = 407 self.match(CoreDSL2Parser.T__9) pass @@ -2593,27 +2593,27 @@ def switch_block_statement_group(self): self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) - self.state = 410 + self.state = 412 self._errHandler.sync(self) _la = self._input.LA(1) while True: - self.state = 409 + self.state = 411 localctx._switch_label = self.switch_label() localctx.labels.append(localctx._switch_label) - self.state = 412 + self.state = 414 self._errHandler.sync(self) _la = self._input.LA(1) if not (_la==32 or _la==33): break - self.state = 415 + self.state = 417 self._errHandler.sync(self) _la = self._input.LA(1) while True: - self.state = 414 + self.state = 416 localctx._statement = self.statement() localctx.statements.append(localctx._statement) - self.state = 417 + self.state = 419 self._errHandler.sync(self) _la = self._input.LA(1) if not ((((_la) & ~0x3f) == 0 and ((1 << _la) & 1148417960802517024) != 0) or ((((_la - 93)) & ~0x3f) == 0 and ((1 << (_la - 93)) & 127) != 0)): @@ -2665,23 +2665,23 @@ def switch_label(self): localctx = CoreDSL2Parser.Switch_labelContext(self, self._ctx, self.state) self.enterRule(localctx, 26, self.RULE_switch_label) try: - self.state = 425 + self.state = 427 self._errHandler.sync(self) token = self._input.LA(1) if token in [32]: self.enterOuterAlt(localctx, 1) - self.state = 419 + self.state = 421 self.match(CoreDSL2Parser.T__31) - self.state = 420 + self.state = 422 localctx.const_expr = self.expression(0) - self.state = 421 + self.state = 423 self.match(CoreDSL2Parser.T__14) pass elif token in [33]: self.enterOuterAlt(localctx, 2) - self.state = 423 + self.state = 425 self.match(CoreDSL2Parser.T__32) - self.state = 424 + self.state = 426 self.match(CoreDSL2Parser.T__14) pass else: @@ -2739,20 +2739,20 @@ def block(self): self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) - self.state = 427 + self.state = 429 self.match(CoreDSL2Parser.T__4) - self.state = 431 + self.state = 433 self._errHandler.sync(self) _la = self._input.LA(1) while (((_la) & ~0x3f) == 0 and ((1 << _la) & 1149543585831976992) != 0) or ((((_la - 85)) & ~0x3f) == 0 and ((1 << (_la - 85)) & 32575) != 0): - self.state = 428 + self.state = 430 localctx._block_item = self.block_item() localctx.items.append(localctx._block_item) - self.state = 433 + self.state = 435 self._errHandler.sync(self) _la = self._input.LA(1) - self.state = 434 + self.state = 436 self.match(CoreDSL2Parser.T__5) except RecognitionException as re: localctx.exception = re @@ -2803,17 +2803,17 @@ def block_item(self): localctx = CoreDSL2Parser.Block_itemContext(self, self._ctx, self.state) self.enterRule(localctx, 30, self.RULE_block_item) try: - self.state = 438 + self.state = 440 self._errHandler.sync(self) token = self._input.LA(1) if token in [5, 20, 22, 24, 25, 26, 27, 28, 29, 30, 31, 34, 35, 52, 53, 54, 55, 56, 57, 58, 59, 93, 94, 95, 96, 97, 98, 99]: self.enterOuterAlt(localctx, 1) - self.state = 436 + self.state = 438 self.statement() pass elif token in [19, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 85, 86, 87, 88, 89, 90]: self.enterOuterAlt(localctx, 2) - self.state = 437 + self.state = 439 self.declaration() pass else: @@ -2878,55 +2878,55 @@ def for_condition(self): self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) - self.state = 445 + self.state = 447 self._errHandler.sync(self) token = self._input.LA(1) if token in [19, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 85, 86, 87, 88, 89, 90]: - self.state = 440 + self.state = 442 localctx.start_decl = self.declaration() pass elif token in [10, 20, 34, 35, 52, 53, 54, 55, 56, 57, 58, 59, 93, 94, 95, 96, 97, 98, 99]: - self.state = 442 + self.state = 444 self._errHandler.sync(self) _la = self._input.LA(1) if (((_la) & ~0x3f) == 0 and ((1 << _la) & 1148417956520132608) != 0) or ((((_la - 93)) & ~0x3f) == 0 and ((1 << (_la - 93)) & 127) != 0): - self.state = 441 + self.state = 443 localctx.start_expr = self.expression(0) - self.state = 444 + self.state = 446 self.match(CoreDSL2Parser.T__9) pass else: raise NoViableAltException(self) - self.state = 448 + self.state = 450 self._errHandler.sync(self) _la = self._input.LA(1) if (((_la) & ~0x3f) == 0 and ((1 << _la) & 1148417956520132608) != 0) or ((((_la - 93)) & ~0x3f) == 0 and ((1 << (_la - 93)) & 127) != 0): - self.state = 447 + self.state = 449 localctx.end_expr = self.expression(0) - self.state = 450 + self.state = 452 self.match(CoreDSL2Parser.T__9) - self.state = 459 + self.state = 461 self._errHandler.sync(self) _la = self._input.LA(1) if (((_la) & ~0x3f) == 0 and ((1 << _la) & 1148417956520132608) != 0) or ((((_la - 93)) & ~0x3f) == 0 and ((1 << (_la - 93)) & 127) != 0): - self.state = 451 + self.state = 453 localctx._expression = self.expression(0) localctx.loop_exprs.append(localctx._expression) - self.state = 456 + self.state = 458 self._errHandler.sync(self) _la = self._input.LA(1) while _la==4: - self.state = 452 + self.state = 454 self.match(CoreDSL2Parser.T__3) - self.state = 453 + self.state = 455 localctx._expression = self.expression(0) localctx.loop_exprs.append(localctx._expression) - self.state = 458 + self.state = 460 self._errHandler.sync(self) _la = self._input.LA(1) @@ -3016,60 +3016,60 @@ def declaration(self): self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) - self.state = 466 + self.state = 468 self._errHandler.sync(self) _la = self._input.LA(1) while _la==19 or _la==49 or ((((_la - 85)) & ~0x3f) == 0 and ((1 << (_la - 85)) & 15) != 0): - self.state = 464 + self.state = 466 self._errHandler.sync(self) token = self._input.LA(1) if token in [19, 87, 88]: - self.state = 461 + self.state = 463 localctx._storage_class_specifier = self.storage_class_specifier() localctx.storage.append(localctx._storage_class_specifier) pass elif token in [85, 86]: - self.state = 462 + self.state = 464 localctx._type_qualifier = self.type_qualifier() localctx.qualifiers.append(localctx._type_qualifier) pass elif token in [49]: - self.state = 463 + self.state = 465 localctx._attribute = self.attribute() localctx.attributes.append(localctx._attribute) pass else: raise NoViableAltException(self) - self.state = 468 + self.state = 470 self._errHandler.sync(self) _la = self._input.LA(1) - self.state = 469 + self.state = 471 localctx.type_ = self.type_specifier() - self.state = 478 + self.state = 480 self._errHandler.sync(self) _la = self._input.LA(1) if _la==96: - self.state = 470 + self.state = 472 localctx._declarator = self.declarator() localctx.declarations.append(localctx._declarator) - self.state = 475 + self.state = 477 self._errHandler.sync(self) _la = self._input.LA(1) while _la==4: - self.state = 471 + self.state = 473 self.match(CoreDSL2Parser.T__3) - self.state = 472 + self.state = 474 localctx._declarator = self.declarator() localctx.declarations.append(localctx._declarator) - self.state = 477 + self.state = 479 self._errHandler.sync(self) _la = self._input.LA(1) - self.state = 480 + self.state = 482 self.match(CoreDSL2Parser.T__9) except RecognitionException as re: localctx.exception = re @@ -3119,17 +3119,17 @@ def type_specifier(self): self.enterRule(localctx, 36, self.RULE_type_specifier) try: self.enterOuterAlt(localctx, 1) - self.state = 482 + self.state = 484 localctx.type_ = self.value_type_specifier() - self.state = 485 + self.state = 487 self._errHandler.sync(self) token = self._input.LA(1) if token in [34]: - self.state = 483 + self.state = 485 localctx.ptr = self.match(CoreDSL2Parser.T__33) pass elif token in [35]: - self.state = 484 + self.state = 486 localctx.ptr = self.match(CoreDSL2Parser.T__34) pass elif token in [4, 10, 21, 96]: @@ -3396,27 +3396,27 @@ def value_type_specifier(self): self.enterRule(localctx, 38, self.RULE_value_type_specifier) self._la = 0 # Token type try: - self.state = 528 + self.state = 530 self._errHandler.sync(self) la_ = self._interp.adaptivePredict(self._input,60,self._ctx) if la_ == 1: localctx = CoreDSL2Parser.Integer_typeContext(self, localctx) self.enterOuterAlt(localctx, 1) - self.state = 487 + self.state = 489 localctx.signed = self.integer_signedness() - self.state = 493 + self.state = 495 self._errHandler.sync(self) token = self._input.LA(1) if token in [43, 44, 45, 46]: - self.state = 488 + self.state = 490 localctx.shorthand = self.integer_shorthand() pass elif token in [36]: - self.state = 489 + self.state = 491 self.match(CoreDSL2Parser.T__35) - self.state = 490 + self.state = 492 localctx.size = self.primary() - self.state = 491 + self.state = 493 self.match(CoreDSL2Parser.T__36) pass else: @@ -3427,105 +3427,105 @@ def value_type_specifier(self): elif la_ == 2: localctx = CoreDSL2Parser.Integer_typeContext(self, localctx) self.enterOuterAlt(localctx, 2) - self.state = 495 + self.state = 497 localctx.shorthand = self.integer_shorthand() pass elif la_ == 3: localctx = CoreDSL2Parser.Float_typeContext(self, localctx) self.enterOuterAlt(localctx, 3) - self.state = 496 + self.state = 498 localctx.shorthand = self.float_shorthand() pass elif la_ == 4: localctx = CoreDSL2Parser.Bool_typeContext(self, localctx) self.enterOuterAlt(localctx, 4) - self.state = 497 + self.state = 499 localctx.type_ = self.match(CoreDSL2Parser.T__37) pass elif la_ == 5: localctx = CoreDSL2Parser.Void_typeContext(self, localctx) self.enterOuterAlt(localctx, 5) - self.state = 498 + self.state = 500 localctx.type_ = self.match(CoreDSL2Parser.T__38) pass elif la_ == 6: localctx = CoreDSL2Parser.Composite_declarationContext(self, localctx) self.enterOuterAlt(localctx, 6) - self.state = 499 - localctx.type_ = self.struct_or_union() self.state = 501 + localctx.type_ = self.struct_or_union() + self.state = 503 self._errHandler.sync(self) _la = self._input.LA(1) if _la==96: - self.state = 500 + self.state = 502 localctx.name = self.match(CoreDSL2Parser.IDENTIFIER) - self.state = 503 + self.state = 505 self.match(CoreDSL2Parser.T__4) - self.state = 507 + self.state = 509 self._errHandler.sync(self) _la = self._input.LA(1) while ((((_la - 38)) & ~0x3f) == 0 and ((1 << (_la - 38)) & 7177611906123775) != 0): - self.state = 504 + self.state = 506 localctx._struct_declaration = self.struct_declaration() localctx.declarations.append(localctx._struct_declaration) - self.state = 509 + self.state = 511 self._errHandler.sync(self) _la = self._input.LA(1) - self.state = 510 + self.state = 512 self.match(CoreDSL2Parser.T__5) pass elif la_ == 7: localctx = CoreDSL2Parser.Composite_referenceContext(self, localctx) self.enterOuterAlt(localctx, 7) - self.state = 512 + self.state = 514 localctx.type_ = self.struct_or_union() - self.state = 513 + self.state = 515 localctx.name = self.match(CoreDSL2Parser.IDENTIFIER) pass elif la_ == 8: localctx = CoreDSL2Parser.Enum_declarationContext(self, localctx) self.enterOuterAlt(localctx, 8) - self.state = 515 - localctx.type_ = self.match(CoreDSL2Parser.T__39) self.state = 517 + localctx.type_ = self.match(CoreDSL2Parser.T__39) + self.state = 519 self._errHandler.sync(self) _la = self._input.LA(1) if _la==96: - self.state = 516 + self.state = 518 localctx.name = self.match(CoreDSL2Parser.IDENTIFIER) - self.state = 519 + self.state = 521 self.match(CoreDSL2Parser.T__4) - self.state = 520 - self.enumerator_list() self.state = 522 + self.enumerator_list() + self.state = 524 self._errHandler.sync(self) _la = self._input.LA(1) if _la==4: - self.state = 521 + self.state = 523 self.match(CoreDSL2Parser.T__3) - self.state = 524 + self.state = 526 self.match(CoreDSL2Parser.T__5) pass elif la_ == 9: localctx = CoreDSL2Parser.Enum_referenceContext(self, localctx) self.enterOuterAlt(localctx, 9) - self.state = 526 + self.state = 528 localctx.type_ = self.match(CoreDSL2Parser.T__39) - self.state = 527 + self.state = 529 localctx.name = self.match(CoreDSL2Parser.IDENTIFIER) pass @@ -3574,7 +3574,7 @@ def integer_signedness(self): self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) - self.state = 530 + self.state = 532 _la = self._input.LA(1) if not(_la==41 or _la==42): self._errHandler.recoverInline(self) @@ -3625,7 +3625,7 @@ def integer_shorthand(self): self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) - self.state = 532 + self.state = 534 _la = self._input.LA(1) if not((((_la) & ~0x3f) == 0 and ((1 << _la) & 131941395333120) != 0)): self._errHandler.recoverInline(self) @@ -3676,7 +3676,7 @@ def float_shorthand(self): self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) - self.state = 534 + self.state = 536 _la = self._input.LA(1) if not(_la==47 or _la==48): self._errHandler.recoverInline(self) @@ -3739,47 +3739,47 @@ def attribute(self): self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) - self.state = 536 + self.state = 538 self.match(CoreDSL2Parser.T__48) - self.state = 537 + self.state = 539 localctx.name = self.match(CoreDSL2Parser.IDENTIFIER) - self.state = 551 + self.state = 553 self._errHandler.sync(self) token = self._input.LA(1) if token in [50]: - self.state = 538 + self.state = 540 self.match(CoreDSL2Parser.T__49) - self.state = 539 + self.state = 541 localctx._expression = self.expression(0) localctx.params.append(localctx._expression) pass elif token in [20]: - self.state = 540 + self.state = 542 self.match(CoreDSL2Parser.T__19) - self.state = 541 + self.state = 543 localctx._expression = self.expression(0) localctx.params.append(localctx._expression) - self.state = 546 + self.state = 548 self._errHandler.sync(self) _la = self._input.LA(1) while _la==4: - self.state = 542 + self.state = 544 self.match(CoreDSL2Parser.T__3) - self.state = 543 + self.state = 545 localctx._expression = self.expression(0) localctx.params.append(localctx._expression) - self.state = 548 + self.state = 550 self._errHandler.sync(self) _la = self._input.LA(1) - self.state = 549 + self.state = 551 self.match(CoreDSL2Parser.T__20) pass elif token in [51]: pass else: pass - self.state = 553 + self.state = 555 self.match(CoreDSL2Parser.T__50) except RecognitionException as re: localctx.exception = re @@ -3833,20 +3833,15 @@ def bit_size_specifier(self): self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) - self.state = 555 + self.state = 557 self.match(CoreDSL2Parser.T__35) - self.state = 556 + self.state = 558 localctx._primary = self.primary() localctx.size.append(localctx._primary) - self.state = 564 + self.state = 566 self._errHandler.sync(self) _la = self._input.LA(1) if _la==4: - self.state = 557 - self.match(CoreDSL2Parser.T__3) - self.state = 558 - localctx._primary = self.primary() - localctx.size.append(localctx._primary) self.state = 559 self.match(CoreDSL2Parser.T__3) self.state = 560 @@ -3857,9 +3852,14 @@ def bit_size_specifier(self): self.state = 562 localctx._primary = self.primary() localctx.size.append(localctx._primary) + self.state = 563 + self.match(CoreDSL2Parser.T__3) + self.state = 564 + localctx._primary = self.primary() + localctx.size.append(localctx._primary) - self.state = 566 + self.state = 568 self.match(CoreDSL2Parser.T__36) except RecognitionException as re: localctx.exception = re @@ -3912,20 +3912,20 @@ def enumerator_list(self): self.enterRule(localctx, 50, self.RULE_enumerator_list) try: self.enterOuterAlt(localctx, 1) - self.state = 568 + self.state = 570 localctx._enumerator = self.enumerator() localctx.enumerators.append(localctx._enumerator) - self.state = 573 + self.state = 575 self._errHandler.sync(self) _alt = self._interp.adaptivePredict(self._input,64,self._ctx) while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER: if _alt==1: - self.state = 569 + self.state = 571 self.match(CoreDSL2Parser.T__3) - self.state = 570 + self.state = 572 localctx._enumerator = self.enumerator() localctx.enumerators.append(localctx._enumerator) - self.state = 575 + self.state = 577 self._errHandler.sync(self) _alt = self._interp.adaptivePredict(self._input,64,self._ctx) @@ -3978,22 +3978,22 @@ def enumerator(self): localctx = CoreDSL2Parser.EnumeratorContext(self, self._ctx, self.state) self.enterRule(localctx, 52, self.RULE_enumerator) try: - self.state = 580 + self.state = 582 self._errHandler.sync(self) la_ = self._interp.adaptivePredict(self._input,65,self._ctx) if la_ == 1: self.enterOuterAlt(localctx, 1) - self.state = 576 + self.state = 578 localctx.name = self.match(CoreDSL2Parser.IDENTIFIER) pass elif la_ == 2: self.enterOuterAlt(localctx, 2) - self.state = 577 + self.state = 579 localctx.name = self.match(CoreDSL2Parser.IDENTIFIER) - self.state = 578 + self.state = 580 self.match(CoreDSL2Parser.T__49) - self.state = 579 + self.state = 581 self.expression(0) pass @@ -4055,25 +4055,25 @@ def struct_declaration(self): self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) - self.state = 582 + self.state = 584 localctx.specifier = self.struct_declaration_specifier() - self.state = 583 + self.state = 585 localctx._declarator = self.declarator() localctx.declarators.append(localctx._declarator) - self.state = 588 + self.state = 590 self._errHandler.sync(self) _la = self._input.LA(1) while _la==4: - self.state = 584 + self.state = 586 self.match(CoreDSL2Parser.T__3) - self.state = 585 + self.state = 587 localctx._declarator = self.declarator() localctx.declarators.append(localctx._declarator) - self.state = 590 + self.state = 592 self._errHandler.sync(self) _la = self._input.LA(1) - self.state = 591 + self.state = 593 self.match(CoreDSL2Parser.T__9) except RecognitionException as re: localctx.exception = re @@ -4127,17 +4127,17 @@ def struct_declaration_specifier(self): localctx = CoreDSL2Parser.Struct_declaration_specifierContext(self, self._ctx, self.state) self.enterRule(localctx, 56, self.RULE_struct_declaration_specifier) try: - self.state = 595 + self.state = 597 self._errHandler.sync(self) token = self._input.LA(1) if token in [38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 89, 90]: self.enterOuterAlt(localctx, 1) - self.state = 593 + self.state = 595 localctx.type_ = self.type_specifier() pass elif token in [85, 86]: self.enterOuterAlt(localctx, 2) - self.state = 594 + self.state = 596 localctx._type_qualifier = self.type_qualifier() localctx.qualifiers.append(localctx._type_qualifier) pass @@ -4226,41 +4226,41 @@ def declarator(self): self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) - self.state = 597 + self.state = 599 localctx.name = self.match(CoreDSL2Parser.IDENTIFIER) - self.state = 604 + self.state = 606 self._errHandler.sync(self) _la = self._input.LA(1) while _la==91: - self.state = 598 + self.state = 600 self.match(CoreDSL2Parser.LEFT_BR) - self.state = 599 + self.state = 601 localctx._expression = self.expression(0) localctx.size.append(localctx._expression) - self.state = 600 + self.state = 602 self.match(CoreDSL2Parser.RIGHT_BR) - self.state = 606 + self.state = 608 self._errHandler.sync(self) _la = self._input.LA(1) - self.state = 610 + self.state = 612 self._errHandler.sync(self) _la = self._input.LA(1) while _la==49: - self.state = 607 + self.state = 609 localctx._attribute = self.attribute() localctx.attributes.append(localctx._attribute) - self.state = 612 + self.state = 614 self._errHandler.sync(self) _la = self._input.LA(1) - self.state = 615 + self.state = 617 self._errHandler.sync(self) _la = self._input.LA(1) if _la==50: - self.state = 613 + self.state = 615 self.match(CoreDSL2Parser.T__49) - self.state = 614 + self.state = 616 localctx.init = self.initializer() @@ -4315,29 +4315,29 @@ def initializer(self): self.enterRule(localctx, 60, self.RULE_initializer) self._la = 0 # Token type try: - self.state = 625 + self.state = 627 self._errHandler.sync(self) token = self._input.LA(1) if token in [20, 34, 35, 52, 53, 54, 55, 56, 57, 58, 59, 93, 94, 95, 96, 97, 98, 99]: self.enterOuterAlt(localctx, 1) - self.state = 617 + self.state = 619 localctx.expr = self.expression(0) pass elif token in [5]: self.enterOuterAlt(localctx, 2) - self.state = 618 + self.state = 620 self.match(CoreDSL2Parser.T__4) - self.state = 619 - self.initializerList() self.state = 621 + self.initializerList() + self.state = 623 self._errHandler.sync(self) _la = self._input.LA(1) if _la==4: - self.state = 620 + self.state = 622 self.match(CoreDSL2Parser.T__3) - self.state = 623 + self.state = 625 self.match(CoreDSL2Parser.T__5) pass else: @@ -4399,42 +4399,42 @@ def initializerList(self): self.enterRule(localctx, 62, self.RULE_initializerList) try: self.enterOuterAlt(localctx, 1) - self.state = 629 + self.state = 631 self._errHandler.sync(self) la_ = self._interp.adaptivePredict(self._input,73,self._ctx) if la_ == 1: - self.state = 627 + self.state = 629 self.designated_initializer() pass elif la_ == 2: - self.state = 628 + self.state = 630 self.initializer() pass - self.state = 638 + self.state = 640 self._errHandler.sync(self) _alt = self._interp.adaptivePredict(self._input,75,self._ctx) while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER: if _alt==1: - self.state = 631 + self.state = 633 self.match(CoreDSL2Parser.T__3) - self.state = 634 + self.state = 636 self._errHandler.sync(self) la_ = self._interp.adaptivePredict(self._input,74,self._ctx) if la_ == 1: - self.state = 632 + self.state = 634 self.designated_initializer() pass elif la_ == 2: - self.state = 633 + self.state = 635 self.initializer() pass - self.state = 640 + self.state = 642 self._errHandler.sync(self) _alt = self._interp.adaptivePredict(self._input,75,self._ctx) @@ -4495,22 +4495,22 @@ def designated_initializer(self): self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) - self.state = 642 + self.state = 644 self._errHandler.sync(self) _la = self._input.LA(1) while True: - self.state = 641 + self.state = 643 localctx._designator = self.designator() localctx.designators.append(localctx._designator) - self.state = 644 + self.state = 646 self._errHandler.sync(self) _la = self._input.LA(1) if not (_la==52 or _la==91): break - self.state = 646 + self.state = 648 self.match(CoreDSL2Parser.T__49) - self.state = 647 + self.state = 649 localctx.init = self.initializer() except RecognitionException as re: localctx.exception = re @@ -4568,23 +4568,23 @@ def designator(self): localctx = CoreDSL2Parser.DesignatorContext(self, self._ctx, self.state) self.enterRule(localctx, 66, self.RULE_designator) try: - self.state = 655 + self.state = 657 self._errHandler.sync(self) token = self._input.LA(1) if token in [91]: self.enterOuterAlt(localctx, 1) - self.state = 649 + self.state = 651 self.match(CoreDSL2Parser.LEFT_BR) - self.state = 650 + self.state = 652 localctx.idx = self.expression(0) - self.state = 651 + self.state = 653 self.match(CoreDSL2Parser.RIGHT_BR) pass elif token in [52]: self.enterOuterAlt(localctx, 2) - self.state = 653 + self.state = 655 self.match(CoreDSL2Parser.T__51) - self.state = 654 + self.state = 656 localctx.prop = self.match(CoreDSL2Parser.IDENTIFIER) pass else: @@ -4986,7 +4986,7 @@ def expression(self, _p:int=0): self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) - self.state = 688 + self.state = 690 self._errHandler.sync(self) la_ = self._interp.adaptivePredict(self._input,81,self._ctx) if la_ == 1: @@ -4994,7 +4994,7 @@ def expression(self, _p:int=0): self._ctx = localctx _prevctx = localctx - self.state = 658 + self.state = 660 self.primary() pass @@ -5002,7 +5002,7 @@ def expression(self, _p:int=0): localctx = CoreDSL2Parser.Deref_expressionContext(self, localctx) self._ctx = localctx _prevctx = localctx - self.state = 659 + self.state = 661 localctx.bop = self._input.LT(1) _la = self._input.LA(1) if not(_la==52 or _la==53): @@ -5010,7 +5010,7 @@ def expression(self, _p:int=0): else: self._errHandler.reportMatch(self) self.consume() - self.state = 660 + self.state = 662 localctx.ref = self.match(CoreDSL2Parser.IDENTIFIER) pass @@ -5018,33 +5018,33 @@ def expression(self, _p:int=0): localctx = CoreDSL2Parser.Method_callContext(self, localctx) self._ctx = localctx _prevctx = localctx - self.state = 661 + self.state = 663 localctx.ref = self.match(CoreDSL2Parser.IDENTIFIER) - self.state = 662 + self.state = 664 self.match(CoreDSL2Parser.T__19) - self.state = 671 + self.state = 673 self._errHandler.sync(self) _la = self._input.LA(1) if (((_la) & ~0x3f) == 0 and ((1 << _la) & 1148417956520132608) != 0) or ((((_la - 93)) & ~0x3f) == 0 and ((1 << (_la - 93)) & 127) != 0): - self.state = 663 + self.state = 665 localctx._expression = self.expression(0) localctx.args.append(localctx._expression) - self.state = 668 + self.state = 670 self._errHandler.sync(self) _la = self._input.LA(1) while _la==4: - self.state = 664 + self.state = 666 self.match(CoreDSL2Parser.T__3) - self.state = 665 + self.state = 667 localctx._expression = self.expression(0) localctx.args.append(localctx._expression) - self.state = 670 + self.state = 672 self._errHandler.sync(self) _la = self._input.LA(1) - self.state = 673 + self.state = 675 self.match(CoreDSL2Parser.T__20) pass @@ -5052,7 +5052,7 @@ def expression(self, _p:int=0): localctx = CoreDSL2Parser.Preinc_expressionContext(self, localctx) self._ctx = localctx _prevctx = localctx - self.state = 674 + self.state = 676 localctx.op = self._input.LT(1) _la = self._input.LA(1) if not(_la==54 or _la==55): @@ -5060,7 +5060,7 @@ def expression(self, _p:int=0): else: self._errHandler.reportMatch(self) self.consume() - self.state = 675 + self.state = 677 localctx.right = self.expression(17) pass @@ -5068,7 +5068,7 @@ def expression(self, _p:int=0): localctx = CoreDSL2Parser.Prefix_expressionContext(self, localctx) self._ctx = localctx _prevctx = localctx - self.state = 676 + self.state = 678 localctx.prefix = self._input.LT(1) _la = self._input.LA(1) if not((((_la) & ~0x3f) == 0 and ((1 << _la) & 216172833653391360) != 0)): @@ -5076,7 +5076,7 @@ def expression(self, _p:int=0): else: self._errHandler.reportMatch(self) self.consume() - self.state = 677 + self.state = 679 localctx.right = self.expression(16) pass @@ -5084,7 +5084,7 @@ def expression(self, _p:int=0): localctx = CoreDSL2Parser.Prefix_expressionContext(self, localctx) self._ctx = localctx _prevctx = localctx - self.state = 678 + self.state = 680 localctx.prefix = self._input.LT(1) _la = self._input.LA(1) if not(_la==58 or _la==59): @@ -5092,7 +5092,7 @@ def expression(self, _p:int=0): else: self._errHandler.reportMatch(self) self.consume() - self.state = 679 + self.state = 681 localctx.right = self.expression(15) pass @@ -5100,31 +5100,31 @@ def expression(self, _p:int=0): localctx = CoreDSL2Parser.Cast_expressionContext(self, localctx) self._ctx = localctx _prevctx = localctx - self.state = 680 + self.state = 682 self.match(CoreDSL2Parser.T__19) - self.state = 683 + self.state = 685 self._errHandler.sync(self) la_ = self._interp.adaptivePredict(self._input,80,self._ctx) if la_ == 1: - self.state = 681 + self.state = 683 localctx.type_ = self.type_specifier() pass elif la_ == 2: - self.state = 682 + self.state = 684 localctx.sign = self.integer_signedness() pass - self.state = 685 + self.state = 687 self.match(CoreDSL2Parser.T__20) - self.state = 686 + self.state = 688 localctx.right = self.expression(14) pass self._ctx.stop = self._input.LT(-1) - self.state = 745 + self.state = 747 self._errHandler.sync(self) _alt = self._interp.adaptivePredict(self._input,84,self._ctx) while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER: @@ -5132,18 +5132,18 @@ def expression(self, _p:int=0): if self._parseListeners is not None: self.triggerExitRuleEvent() _prevctx = localctx - self.state = 743 + self.state = 745 self._errHandler.sync(self) la_ = self._interp.adaptivePredict(self._input,83,self._ctx) if la_ == 1: localctx = CoreDSL2Parser.Binary_expressionContext(self, CoreDSL2Parser.ExpressionContext(self, _parentctx, _parentState)) localctx.left = _prevctx self.pushNewRecursionContext(localctx, _startState, self.RULE_expression) - self.state = 690 + self.state = 692 if not self.precpred(self._ctx, 13): from antlr4.error.Errors import FailedPredicateException raise FailedPredicateException(self, "self.precpred(self._ctx, 13)") - self.state = 691 + self.state = 693 localctx.bop = self._input.LT(1) _la = self._input.LA(1) if not((((_la) & ~0x3f) == 0 and ((1 << _la) & 3458764531000410112) != 0)): @@ -5151,7 +5151,7 @@ def expression(self, _p:int=0): else: self._errHandler.reportMatch(self) self.consume() - self.state = 692 + self.state = 694 localctx.right = self.expression(14) pass @@ -5159,11 +5159,11 @@ def expression(self, _p:int=0): localctx = CoreDSL2Parser.Binary_expressionContext(self, CoreDSL2Parser.ExpressionContext(self, _parentctx, _parentState)) localctx.left = _prevctx self.pushNewRecursionContext(localctx, _startState, self.RULE_expression) - self.state = 693 + self.state = 695 if not self.precpred(self._ctx, 12): from antlr4.error.Errors import FailedPredicateException raise FailedPredicateException(self, "self.precpred(self._ctx, 12)") - self.state = 694 + self.state = 696 localctx.bop = self._input.LT(1) _la = self._input.LA(1) if not(_la==56 or _la==57): @@ -5171,7 +5171,7 @@ def expression(self, _p:int=0): else: self._errHandler.reportMatch(self) self.consume() - self.state = 695 + self.state = 697 localctx.right = self.expression(13) pass @@ -5179,11 +5179,11 @@ def expression(self, _p:int=0): localctx = CoreDSL2Parser.Binary_expressionContext(self, CoreDSL2Parser.ExpressionContext(self, _parentctx, _parentState)) localctx.left = _prevctx self.pushNewRecursionContext(localctx, _startState, self.RULE_expression) - self.state = 696 + self.state = 698 if not self.precpred(self._ctx, 11): from antlr4.error.Errors import FailedPredicateException raise FailedPredicateException(self, "self.precpred(self._ctx, 11)") - self.state = 697 + self.state = 699 localctx.bop = self._input.LT(1) _la = self._input.LA(1) if not(_la==62 or _la==63): @@ -5191,7 +5191,7 @@ def expression(self, _p:int=0): else: self._errHandler.reportMatch(self) self.consume() - self.state = 698 + self.state = 700 localctx.right = self.expression(12) pass @@ -5199,11 +5199,11 @@ def expression(self, _p:int=0): localctx = CoreDSL2Parser.Binary_expressionContext(self, CoreDSL2Parser.ExpressionContext(self, _parentctx, _parentState)) localctx.left = _prevctx self.pushNewRecursionContext(localctx, _startState, self.RULE_expression) - self.state = 699 + self.state = 701 if not self.precpred(self._ctx, 10): from antlr4.error.Errors import FailedPredicateException raise FailedPredicateException(self, "self.precpred(self._ctx, 10)") - self.state = 700 + self.state = 702 localctx.bop = self._input.LT(1) _la = self._input.LA(1) if not(((((_la - 36)) & ~0x3f) == 0 and ((1 << (_la - 36)) & 805306371) != 0)): @@ -5211,7 +5211,7 @@ def expression(self, _p:int=0): else: self._errHandler.reportMatch(self) self.consume() - self.state = 701 + self.state = 703 localctx.right = self.expression(11) pass @@ -5219,11 +5219,11 @@ def expression(self, _p:int=0): localctx = CoreDSL2Parser.Binary_expressionContext(self, CoreDSL2Parser.ExpressionContext(self, _parentctx, _parentState)) localctx.left = _prevctx self.pushNewRecursionContext(localctx, _startState, self.RULE_expression) - self.state = 702 + self.state = 704 if not self.precpred(self._ctx, 9): from antlr4.error.Errors import FailedPredicateException raise FailedPredicateException(self, "self.precpred(self._ctx, 9)") - self.state = 703 + self.state = 705 localctx.bop = self._input.LT(1) _la = self._input.LA(1) if not(_la==66 or _la==67): @@ -5231,7 +5231,7 @@ def expression(self, _p:int=0): else: self._errHandler.reportMatch(self) self.consume() - self.state = 704 + self.state = 706 localctx.right = self.expression(10) pass @@ -5239,13 +5239,13 @@ def expression(self, _p:int=0): localctx = CoreDSL2Parser.Binary_expressionContext(self, CoreDSL2Parser.ExpressionContext(self, _parentctx, _parentState)) localctx.left = _prevctx self.pushNewRecursionContext(localctx, _startState, self.RULE_expression) - self.state = 705 + self.state = 707 if not self.precpred(self._ctx, 8): from antlr4.error.Errors import FailedPredicateException raise FailedPredicateException(self, "self.precpred(self._ctx, 8)") - self.state = 706 + self.state = 708 localctx.bop = self.match(CoreDSL2Parser.T__34) - self.state = 707 + self.state = 709 localctx.right = self.expression(9) pass @@ -5253,13 +5253,13 @@ def expression(self, _p:int=0): localctx = CoreDSL2Parser.Binary_expressionContext(self, CoreDSL2Parser.ExpressionContext(self, _parentctx, _parentState)) localctx.left = _prevctx self.pushNewRecursionContext(localctx, _startState, self.RULE_expression) - self.state = 708 + self.state = 710 if not self.precpred(self._ctx, 7): from antlr4.error.Errors import FailedPredicateException raise FailedPredicateException(self, "self.precpred(self._ctx, 7)") - self.state = 709 + self.state = 711 localctx.bop = self.match(CoreDSL2Parser.T__67) - self.state = 710 + self.state = 712 localctx.right = self.expression(8) pass @@ -5267,13 +5267,13 @@ def expression(self, _p:int=0): localctx = CoreDSL2Parser.Binary_expressionContext(self, CoreDSL2Parser.ExpressionContext(self, _parentctx, _parentState)) localctx.left = _prevctx self.pushNewRecursionContext(localctx, _startState, self.RULE_expression) - self.state = 711 + self.state = 713 if not self.precpred(self._ctx, 6): from antlr4.error.Errors import FailedPredicateException raise FailedPredicateException(self, "self.precpred(self._ctx, 6)") - self.state = 712 + self.state = 714 localctx.bop = self.match(CoreDSL2Parser.T__68) - self.state = 713 + self.state = 715 localctx.right = self.expression(7) pass @@ -5281,13 +5281,13 @@ def expression(self, _p:int=0): localctx = CoreDSL2Parser.Binary_expressionContext(self, CoreDSL2Parser.ExpressionContext(self, _parentctx, _parentState)) localctx.left = _prevctx self.pushNewRecursionContext(localctx, _startState, self.RULE_expression) - self.state = 714 + self.state = 716 if not self.precpred(self._ctx, 5): from antlr4.error.Errors import FailedPredicateException raise FailedPredicateException(self, "self.precpred(self._ctx, 5)") - self.state = 715 + self.state = 717 localctx.bop = self.match(CoreDSL2Parser.T__69) - self.state = 716 + self.state = 718 localctx.right = self.expression(6) pass @@ -5295,13 +5295,13 @@ def expression(self, _p:int=0): localctx = CoreDSL2Parser.Binary_expressionContext(self, CoreDSL2Parser.ExpressionContext(self, _parentctx, _parentState)) localctx.left = _prevctx self.pushNewRecursionContext(localctx, _startState, self.RULE_expression) - self.state = 717 + self.state = 719 if not self.precpred(self._ctx, 4): from antlr4.error.Errors import FailedPredicateException raise FailedPredicateException(self, "self.precpred(self._ctx, 4)") - self.state = 718 + self.state = 720 localctx.bop = self.match(CoreDSL2Parser.T__70) - self.state = 719 + self.state = 721 localctx.right = self.expression(5) pass @@ -5309,13 +5309,13 @@ def expression(self, _p:int=0): localctx = CoreDSL2Parser.Concat_expressionContext(self, CoreDSL2Parser.ExpressionContext(self, _parentctx, _parentState)) localctx.left = _prevctx self.pushNewRecursionContext(localctx, _startState, self.RULE_expression) - self.state = 720 + self.state = 722 if not self.precpred(self._ctx, 3): from antlr4.error.Errors import FailedPredicateException raise FailedPredicateException(self, "self.precpred(self._ctx, 3)") - self.state = 721 + self.state = 723 localctx.bop = self.match(CoreDSL2Parser.T__15) - self.state = 722 + self.state = 724 localctx.right = self.expression(4) pass @@ -5323,17 +5323,17 @@ def expression(self, _p:int=0): localctx = CoreDSL2Parser.Conditional_expressionContext(self, CoreDSL2Parser.ExpressionContext(self, _parentctx, _parentState)) localctx.cond = _prevctx self.pushNewRecursionContext(localctx, _startState, self.RULE_expression) - self.state = 723 + self.state = 725 if not self.precpred(self._ctx, 2): from antlr4.error.Errors import FailedPredicateException raise FailedPredicateException(self, "self.precpred(self._ctx, 2)") - self.state = 724 + self.state = 726 localctx.bop = self.match(CoreDSL2Parser.T__71) - self.state = 725 + self.state = 727 localctx.then_expr = self.expression(0) - self.state = 726 + self.state = 728 self.match(CoreDSL2Parser.T__14) - self.state = 727 + self.state = 729 localctx.else_expr = self.expression(2) pass @@ -5341,11 +5341,11 @@ def expression(self, _p:int=0): localctx = CoreDSL2Parser.Assignment_expressionContext(self, CoreDSL2Parser.ExpressionContext(self, _parentctx, _parentState)) localctx.left = _prevctx self.pushNewRecursionContext(localctx, _startState, self.RULE_expression) - self.state = 729 + self.state = 731 if not self.precpred(self._ctx, 1): from antlr4.error.Errors import FailedPredicateException raise FailedPredicateException(self, "self.precpred(self._ctx, 1)") - self.state = 730 + self.state = 732 localctx.bop = self._input.LT(1) _la = self._input.LA(1) if not(((((_la - 50)) & ~0x3f) == 0 and ((1 << (_la - 50)) & 17171480577) != 0)): @@ -5353,7 +5353,7 @@ def expression(self, _p:int=0): else: self._errHandler.reportMatch(self) self.consume() - self.state = 731 + self.state = 733 localctx.right = self.expression(1) pass @@ -5361,25 +5361,25 @@ def expression(self, _p:int=0): localctx = CoreDSL2Parser.Slice_expressionContext(self, CoreDSL2Parser.ExpressionContext(self, _parentctx, _parentState)) localctx.expr = _prevctx self.pushNewRecursionContext(localctx, _startState, self.RULE_expression) - self.state = 732 + self.state = 734 if not self.precpred(self._ctx, 20): from antlr4.error.Errors import FailedPredicateException raise FailedPredicateException(self, "self.precpred(self._ctx, 20)") - self.state = 733 + self.state = 735 localctx.bop = self.match(CoreDSL2Parser.LEFT_BR) - self.state = 734 + self.state = 736 localctx.left = self.expression(0) - self.state = 737 + self.state = 739 self._errHandler.sync(self) _la = self._input.LA(1) if _la==15: - self.state = 735 + self.state = 737 self.match(CoreDSL2Parser.T__14) - self.state = 736 + self.state = 738 localctx.right = self.expression(0) - self.state = 739 + self.state = 741 self.match(CoreDSL2Parser.RIGHT_BR) pass @@ -5387,11 +5387,11 @@ def expression(self, _p:int=0): localctx = CoreDSL2Parser.Postinc_expressionContext(self, CoreDSL2Parser.ExpressionContext(self, _parentctx, _parentState)) localctx.left = _prevctx self.pushNewRecursionContext(localctx, _startState, self.RULE_expression) - self.state = 741 + self.state = 743 if not self.precpred(self._ctx, 18): from antlr4.error.Errors import FailedPredicateException raise FailedPredicateException(self, "self.precpred(self._ctx, 18)") - self.state = 742 + self.state = 744 localctx.op = self._input.LT(1) _la = self._input.LA(1) if not(_la==54 or _la==55): @@ -5402,7 +5402,7 @@ def expression(self, _p:int=0): pass - self.state = 747 + self.state = 749 self._errHandler.sync(self) _alt = self._interp.adaptivePredict(self._input,84,self._ctx) @@ -5545,52 +5545,54 @@ def primary(self): localctx = CoreDSL2Parser.PrimaryContext(self, self._ctx, self.state) self.enterRule(localctx, 70, self.RULE_primary) try: - self.state = 759 + self.state = 761 self._errHandler.sync(self) - token = self._input.LA(1) - if token in [96]: + la_ = self._interp.adaptivePredict(self._input,86,self._ctx) + if la_ == 1: localctx = CoreDSL2Parser.Reference_expressionContext(self, localctx) self.enterOuterAlt(localctx, 1) - self.state = 748 + self.state = 750 localctx.ref = self.match(CoreDSL2Parser.IDENTIFIER) pass - elif token in [93, 94, 95, 97]: + + elif la_ == 2: localctx = CoreDSL2Parser.Constant_expressionContext(self, localctx) self.enterOuterAlt(localctx, 2) - self.state = 749 + self.state = 751 localctx.const_expr = self.constant() pass - elif token in [98, 99]: + + elif la_ == 3: localctx = CoreDSL2Parser.Literal_expressionContext(self, localctx) self.enterOuterAlt(localctx, 3) - self.state = 751 + self.state = 753 self._errHandler.sync(self) _alt = 1 while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER: if _alt == 1: - self.state = 750 + self.state = 752 localctx._string_literal = self.string_literal() localctx.literal.append(localctx._string_literal) else: raise NoViableAltException(self) - self.state = 753 + self.state = 755 self._errHandler.sync(self) _alt = self._interp.adaptivePredict(self._input,85,self._ctx) pass - elif token in [20]: + + elif la_ == 4: localctx = CoreDSL2Parser.Parens_expressionContext(self, localctx) self.enterOuterAlt(localctx, 4) - self.state = 755 + self.state = 757 self.match(CoreDSL2Parser.T__19) - self.state = 756 + self.state = 758 localctx.expr = self.expression(0) - self.state = 757 + self.state = 759 self.match(CoreDSL2Parser.T__20) pass - else: - raise NoViableAltException(self) + except RecognitionException as re: localctx.exception = re @@ -5641,7 +5643,7 @@ def string_literal(self): self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) - self.state = 761 + self.state = 763 _la = self._input.LA(1) if not(_la==98 or _la==99): self._errHandler.recoverInline(self) @@ -5676,6 +5678,10 @@ def character_constant(self): return self.getTypedRuleContext(CoreDSL2Parser.Character_constantContext,0) + def string_constant(self): + return self.getTypedRuleContext(CoreDSL2Parser.String_constantContext,0) + + def bool_constant(self): return self.getTypedRuleContext(CoreDSL2Parser.Bool_constantContext,0) @@ -5705,27 +5711,32 @@ def constant(self): localctx = CoreDSL2Parser.ConstantContext(self, self._ctx, self.state) self.enterRule(localctx, 74, self.RULE_constant) try: - self.state = 767 + self.state = 770 self._errHandler.sync(self) token = self._input.LA(1) if token in [95]: self.enterOuterAlt(localctx, 1) - self.state = 763 + self.state = 765 self.integer_constant() pass elif token in [94]: self.enterOuterAlt(localctx, 2) - self.state = 764 + self.state = 766 self.floating_constant() pass elif token in [97]: self.enterOuterAlt(localctx, 3) - self.state = 765 + self.state = 767 self.character_constant() pass - elif token in [93]: + elif token in [99]: self.enterOuterAlt(localctx, 4) - self.state = 766 + self.state = 768 + self.string_constant() + pass + elif token in [93]: + self.enterOuterAlt(localctx, 5) + self.state = 769 self.bool_constant() pass else: @@ -5777,7 +5788,7 @@ def integer_constant(self): self.enterRule(localctx, 76, self.RULE_integer_constant) try: self.enterOuterAlt(localctx, 1) - self.state = 769 + self.state = 772 localctx.value = self.match(CoreDSL2Parser.INTEGER) except RecognitionException as re: localctx.exception = re @@ -5825,7 +5836,7 @@ def floating_constant(self): self.enterRule(localctx, 78, self.RULE_floating_constant) try: self.enterOuterAlt(localctx, 1) - self.state = 771 + self.state = 774 localctx.value = self.match(CoreDSL2Parser.FLOAT) except RecognitionException as re: localctx.exception = re @@ -5873,7 +5884,7 @@ def bool_constant(self): self.enterRule(localctx, 80, self.RULE_bool_constant) try: self.enterOuterAlt(localctx, 1) - self.state = 773 + self.state = 776 localctx.value = self.match(CoreDSL2Parser.BOOLEAN) except RecognitionException as re: localctx.exception = re @@ -5921,7 +5932,7 @@ def character_constant(self): self.enterRule(localctx, 82, self.RULE_character_constant) try: self.enterOuterAlt(localctx, 1) - self.state = 775 + self.state = 778 localctx.value = self.match(CoreDSL2Parser.CHARCONST) except RecognitionException as re: localctx.exception = re @@ -5932,6 +5943,54 @@ def character_constant(self): return localctx + class String_constantContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + self.value = None # Token + + def STRING(self): + return self.getToken(CoreDSL2Parser.STRING, 0) + + def getRuleIndex(self): + return CoreDSL2Parser.RULE_string_constant + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterString_constant" ): + listener.enterString_constant(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitString_constant" ): + listener.exitString_constant(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitString_constant" ): + return visitor.visitString_constant(self) + else: + return visitor.visitChildren(self) + + + + + def string_constant(self): + + localctx = CoreDSL2Parser.String_constantContext(self, self._ctx, self.state) + self.enterRule(localctx, 84, self.RULE_string_constant) + try: + self.enterOuterAlt(localctx, 1) + self.state = 780 + localctx.value = self.match(CoreDSL2Parser.STRING) + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + class Double_left_bracketContext(ParserRuleContext): __slots__ = 'parser' @@ -5968,12 +6027,12 @@ def accept(self, visitor:ParseTreeVisitor): def double_left_bracket(self): localctx = CoreDSL2Parser.Double_left_bracketContext(self, self._ctx, self.state) - self.enterRule(localctx, 84, self.RULE_double_left_bracket) + self.enterRule(localctx, 86, self.RULE_double_left_bracket) try: self.enterOuterAlt(localctx, 1) - self.state = 777 + self.state = 782 self.match(CoreDSL2Parser.LEFT_BR) - self.state = 778 + self.state = 783 self.match(CoreDSL2Parser.LEFT_BR) except RecognitionException as re: localctx.exception = re @@ -6020,12 +6079,12 @@ def accept(self, visitor:ParseTreeVisitor): def double_right_bracket(self): localctx = CoreDSL2Parser.Double_right_bracketContext(self, self._ctx, self.state) - self.enterRule(localctx, 86, self.RULE_double_right_bracket) + self.enterRule(localctx, 88, self.RULE_double_right_bracket) try: self.enterOuterAlt(localctx, 1) - self.state = 780 + self.state = 785 self.match(CoreDSL2Parser.RIGHT_BR) - self.state = 781 + self.state = 786 self.match(CoreDSL2Parser.RIGHT_BR) except RecognitionException as re: localctx.exception = re @@ -6067,11 +6126,11 @@ def accept(self, visitor:ParseTreeVisitor): def data_types(self): localctx = CoreDSL2Parser.Data_typesContext(self, self._ctx, self.state) - self.enterRule(localctx, 88, self.RULE_data_types) + self.enterRule(localctx, 90, self.RULE_data_types) self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) - self.state = 783 + self.state = 788 _la = self._input.LA(1) if not(((((_la - 38)) & ~0x3f) == 0 and ((1 << (_la - 38)) & 70368744179707) != 0)): self._errHandler.recoverInline(self) @@ -6118,11 +6177,11 @@ def accept(self, visitor:ParseTreeVisitor): def type_qualifier(self): localctx = CoreDSL2Parser.Type_qualifierContext(self, self._ctx, self.state) - self.enterRule(localctx, 90, self.RULE_type_qualifier) + self.enterRule(localctx, 92, self.RULE_type_qualifier) self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) - self.state = 785 + self.state = 790 _la = self._input.LA(1) if not(_la==85 or _la==86): self._errHandler.recoverInline(self) @@ -6169,11 +6228,11 @@ def accept(self, visitor:ParseTreeVisitor): def storage_class_specifier(self): localctx = CoreDSL2Parser.Storage_class_specifierContext(self, self._ctx, self.state) - self.enterRule(localctx, 92, self.RULE_storage_class_specifier) + self.enterRule(localctx, 94, self.RULE_storage_class_specifier) self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) - self.state = 787 + self.state = 792 _la = self._input.LA(1) if not(_la==19 or _la==87 or _la==88): self._errHandler.recoverInline(self) @@ -6220,11 +6279,11 @@ def accept(self, visitor:ParseTreeVisitor): def struct_or_union(self): localctx = CoreDSL2Parser.Struct_or_unionContext(self, self._ctx, self.state) - self.enterRule(localctx, 94, self.RULE_struct_or_union) + self.enterRule(localctx, 96, self.RULE_struct_or_union) self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) - self.state = 789 + self.state = 794 _la = self._input.LA(1) if not(_la==89 or _la==90): self._errHandler.recoverInline(self) diff --git a/m2isar/frontends/coredsl2/parser_gen/CoreDSL2Visitor.py b/m2isar/frontends/coredsl2/parser_gen/CoreDSL2Visitor.py index 9ad2478d..9702326c 100644 --- a/m2isar/frontends/coredsl2/parser_gen/CoreDSL2Visitor.py +++ b/m2isar/frontends/coredsl2/parser_gen/CoreDSL2Visitor.py @@ -404,6 +404,11 @@ def visitCharacter_constant(self, ctx:CoreDSL2Parser.Character_constantContext): return self.visitChildren(ctx) + # Visit a parse tree produced by CoreDSL2Parser#string_constant. + def visitString_constant(self, ctx:CoreDSL2Parser.String_constantContext): + return self.visitChildren(ctx) + + # Visit a parse tree produced by CoreDSL2Parser#double_left_bracket. def visitDouble_left_bracket(self, ctx:CoreDSL2Parser.Double_left_bracketContext): return self.visitChildren(ctx) From adeb9e83229c20b0b790940e0b887bf5b8ded3e1 Mon Sep 17 00:00:00 2001 From: Philipp van Kempen Date: Sat, 8 Mar 2025 11:33:34 +0100 Subject: [PATCH 7/8] regenerate coredsl2_set parser --- m2isar/frontends/coredsl2_set/antlr.sh | 2 ++ .../coredsl2_set/parser_gen/CoreDSL2Lexer.py | 2 +- .../parser_gen/CoreDSL2Listener.py | 2 +- .../coredsl2_set/parser_gen/CoreDSL2Parser.py | 24 +++++++++---------- .../parser_gen/CoreDSL2Visitor.py | 2 +- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/m2isar/frontends/coredsl2_set/antlr.sh b/m2isar/frontends/coredsl2_set/antlr.sh index 18d3f2ba..2227f1cd 100755 --- a/m2isar/frontends/coredsl2_set/antlr.sh +++ b/m2isar/frontends/coredsl2_set/antlr.sh @@ -9,3 +9,5 @@ # Technical University of Munich java -jar antlr-4.13.1-complete.jar -o parser_gen -listener -visitor -Dlanguage=Python3 ../coredsl2/CoreDSL2.g4 +mv coredsl2/* parser_gen # workaround for bug? +rmdir coredsl2 diff --git a/m2isar/frontends/coredsl2_set/parser_gen/CoreDSL2Lexer.py b/m2isar/frontends/coredsl2_set/parser_gen/CoreDSL2Lexer.py index 934187ef..932901cd 100644 --- a/m2isar/frontends/coredsl2_set/parser_gen/CoreDSL2Lexer.py +++ b/m2isar/frontends/coredsl2_set/parser_gen/CoreDSL2Lexer.py @@ -1,4 +1,4 @@ -# Generated from CoreDSL2.g4 by ANTLR 4.13.1 +# Generated from ../coredsl2/CoreDSL2.g4 by ANTLR 4.13.1 from antlr4 import * from io import StringIO import sys diff --git a/m2isar/frontends/coredsl2_set/parser_gen/CoreDSL2Listener.py b/m2isar/frontends/coredsl2_set/parser_gen/CoreDSL2Listener.py index f8a03bdd..a6811a6f 100644 --- a/m2isar/frontends/coredsl2_set/parser_gen/CoreDSL2Listener.py +++ b/m2isar/frontends/coredsl2_set/parser_gen/CoreDSL2Listener.py @@ -1,4 +1,4 @@ -# Generated from CoreDSL2.g4 by ANTLR 4.13.1 +# Generated from ../coredsl2/CoreDSL2.g4 by ANTLR 4.13.1 from antlr4 import * if "." in __name__: from .CoreDSL2Parser import CoreDSL2Parser diff --git a/m2isar/frontends/coredsl2_set/parser_gen/CoreDSL2Parser.py b/m2isar/frontends/coredsl2_set/parser_gen/CoreDSL2Parser.py index 22021ef8..1c04f497 100644 --- a/m2isar/frontends/coredsl2_set/parser_gen/CoreDSL2Parser.py +++ b/m2isar/frontends/coredsl2_set/parser_gen/CoreDSL2Parser.py @@ -1,4 +1,4 @@ -# Generated from CoreDSL2.g4 by ANTLR 4.13.1 +# Generated from ../coredsl2/CoreDSL2.g4 by ANTLR 4.13.1 # encoding: utf-8 from antlr4 import * from io import StringIO @@ -19,8 +19,8 @@ def serializedATN(): 39,2,40,7,40,2,41,7,41,2,42,7,42,2,43,7,43,2,44,7,44,2,45,7,45,2, 46,7,46,2,47,7,47,2,48,7,48,1,0,5,0,100,8,0,10,0,12,0,103,9,0,1, 0,4,0,106,8,0,11,0,12,0,107,1,1,1,1,1,1,1,2,1,2,1,2,1,2,1,2,1,2, - 5,2,119,8,2,10,2,12,2,122,9,2,3,2,124,8,2,1,2,1,2,4,2,128,8,2,11, - 2,12,2,129,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,5,2,140,8,2,10,2,12,2, + 5,2,119,8,2,10,2,12,2,122,9,2,3,2,124,8,2,1,2,1,2,5,2,128,8,2,10, + 2,12,2,131,9,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,5,2,140,8,2,10,2,12,2, 143,9,2,3,2,145,8,2,1,2,1,2,5,2,149,8,2,10,2,12,2,152,9,2,1,2,3, 2,155,8,2,1,3,1,3,1,3,1,3,1,3,1,3,4,3,163,8,3,11,3,12,3,164,1,3, 1,3,1,3,1,3,1,3,5,3,172,8,3,10,3,12,3,175,9,3,1,3,1,3,1,3,5,3,180, @@ -101,10 +101,10 @@ def serializedATN(): 1,0,0,0,112,113,5,2,0,0,113,123,5,96,0,0,114,115,5,3,0,0,115,120, 5,96,0,0,116,117,5,4,0,0,117,119,5,96,0,0,118,116,1,0,0,0,119,122, 1,0,0,0,120,118,1,0,0,0,120,121,1,0,0,0,121,124,1,0,0,0,122,120, - 1,0,0,0,123,114,1,0,0,0,123,124,1,0,0,0,124,125,1,0,0,0,125,127, - 5,5,0,0,126,128,3,6,3,0,127,126,1,0,0,0,128,129,1,0,0,0,129,127, - 1,0,0,0,129,130,1,0,0,0,130,131,1,0,0,0,131,132,5,6,0,0,132,155, - 1,0,0,0,133,134,5,7,0,0,134,144,5,96,0,0,135,136,5,8,0,0,136,141, + 1,0,0,0,123,114,1,0,0,0,123,124,1,0,0,0,124,125,1,0,0,0,125,129, + 5,5,0,0,126,128,3,6,3,0,127,126,1,0,0,0,128,131,1,0,0,0,129,127, + 1,0,0,0,129,130,1,0,0,0,130,132,1,0,0,0,131,129,1,0,0,0,132,155, + 5,6,0,0,133,134,5,7,0,0,134,144,5,96,0,0,135,136,5,8,0,0,136,141, 5,96,0,0,137,138,5,4,0,0,138,140,5,96,0,0,139,137,1,0,0,0,140,143, 1,0,0,0,141,139,1,0,0,0,141,142,1,0,0,0,142,145,1,0,0,0,143,141, 1,0,0,0,144,135,1,0,0,0,144,145,1,0,0,0,145,146,1,0,0,0,146,150, @@ -818,20 +818,18 @@ def isa(self): self.state = 125 self.match(CoreDSL2Parser.T__4) - self.state = 127 + self.state = 129 self._errHandler.sync(self) _la = self._input.LA(1) - while True: + while (((_la) & ~0x3f) == 0 and ((1 << _la) & 14848) != 0): self.state = 126 localctx._section = self.section() localctx.sections.append(localctx._section) - self.state = 129 + self.state = 131 self._errHandler.sync(self) _la = self._input.LA(1) - if not ((((_la) & ~0x3f) == 0 and ((1 << _la) & 14848) != 0)): - break - self.state = 131 + self.state = 132 self.match(CoreDSL2Parser.T__5) pass elif token in [7]: diff --git a/m2isar/frontends/coredsl2_set/parser_gen/CoreDSL2Visitor.py b/m2isar/frontends/coredsl2_set/parser_gen/CoreDSL2Visitor.py index 9702326c..40a2df9b 100644 --- a/m2isar/frontends/coredsl2_set/parser_gen/CoreDSL2Visitor.py +++ b/m2isar/frontends/coredsl2_set/parser_gen/CoreDSL2Visitor.py @@ -1,4 +1,4 @@ -# Generated from CoreDSL2.g4 by ANTLR 4.13.1 +# Generated from ../coredsl2/CoreDSL2.g4 by ANTLR 4.13.1 from antlr4 import * if "." in __name__: from .CoreDSL2Parser import CoreDSL2Parser From b6ff486231b7ceebe5248b99046c3f377ba377bb Mon Sep 17 00:00:00 2001 From: Philipp van Kempen Date: Sat, 8 Mar 2025 11:36:07 +0100 Subject: [PATCH 8/8] use same parser_gen for coredsl2 and coredsl2_set frontend --- m2isar/frontends/coredsl2_set/antlr.sh | 13 - .../architecture_model_builder.py | 2 +- .../coredsl2_set/behavior_model_builder.py | 2 +- m2isar/frontends/coredsl2_set/importer.py | 2 +- m2isar/frontends/coredsl2_set/load_order.py | 2 +- .../coredsl2_set/parser_gen/.gitignore | 12 - .../coredsl2_set/parser_gen/CoreDSL2Lexer.py | 510 -- .../parser_gen/CoreDSL2Listener.py | 786 -- .../coredsl2_set/parser_gen/CoreDSL2Parser.py | 6376 ----------------- .../parser_gen/CoreDSL2Visitor.py | 443 -- .../coredsl2_set/parser_gen/__init__.py | 16 - m2isar/frontends/coredsl2_set/utils.py | 2 +- 12 files changed, 5 insertions(+), 8161 deletions(-) delete mode 100755 m2isar/frontends/coredsl2_set/antlr.sh delete mode 100644 m2isar/frontends/coredsl2_set/parser_gen/.gitignore delete mode 100644 m2isar/frontends/coredsl2_set/parser_gen/CoreDSL2Lexer.py delete mode 100644 m2isar/frontends/coredsl2_set/parser_gen/CoreDSL2Listener.py delete mode 100644 m2isar/frontends/coredsl2_set/parser_gen/CoreDSL2Parser.py delete mode 100644 m2isar/frontends/coredsl2_set/parser_gen/CoreDSL2Visitor.py delete mode 100644 m2isar/frontends/coredsl2_set/parser_gen/__init__.py diff --git a/m2isar/frontends/coredsl2_set/antlr.sh b/m2isar/frontends/coredsl2_set/antlr.sh deleted file mode 100755 index 2227f1cd..00000000 --- a/m2isar/frontends/coredsl2_set/antlr.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash - -# SPDX-License-Identifier: Apache-2.0 -# -# This file is part of the M2-ISA-R project: https://github.com/tum-ei-eda/M2-ISA-R -# -# Copyright (C) 2022 -# Chair of Electrical Design Automation -# Technical University of Munich - -java -jar antlr-4.13.1-complete.jar -o parser_gen -listener -visitor -Dlanguage=Python3 ../coredsl2/CoreDSL2.g4 -mv coredsl2/* parser_gen # workaround for bug? -rmdir coredsl2 diff --git a/m2isar/frontends/coredsl2_set/architecture_model_builder.py b/m2isar/frontends/coredsl2_set/architecture_model_builder.py index e651300a..9c905281 100644 --- a/m2isar/frontends/coredsl2_set/architecture_model_builder.py +++ b/m2isar/frontends/coredsl2_set/architecture_model_builder.py @@ -12,7 +12,7 @@ from m2isar import M2DuplicateError, M2NameError, M2TypeError, M2ValueError, flatten from m2isar.metamodel import arch, behav, intrinsics -from .parser_gen import CoreDSL2Parser, CoreDSL2Visitor +from ..coredsl2.parser_gen import CoreDSL2Parser, CoreDSL2Visitor from .utils import RADIX, SHORTHANDS, SIGNEDNESS logger = logging.getLogger("arch_builder") diff --git a/m2isar/frontends/coredsl2_set/behavior_model_builder.py b/m2isar/frontends/coredsl2_set/behavior_model_builder.py index 12fb60a7..63c29e7a 100644 --- a/m2isar/frontends/coredsl2_set/behavior_model_builder.py +++ b/m2isar/frontends/coredsl2_set/behavior_model_builder.py @@ -11,7 +11,7 @@ from m2isar import M2NameError, M2SyntaxError, M2TypeError, flatten from m2isar.metamodel import arch, behav, intrinsics from m2isar.metamodel.utils import StaticType -from .parser_gen import CoreDSL2Parser, CoreDSL2Visitor +from ..coredsl2.parser_gen import CoreDSL2Parser, CoreDSL2Visitor from .utils import BOOLCONST, RADIX, SHORTHANDS, SIGNEDNESS # import seal5.model as seal5_model diff --git a/m2isar/frontends/coredsl2_set/importer.py b/m2isar/frontends/coredsl2_set/importer.py index 7bbad2e2..c5d8bee2 100644 --- a/m2isar/frontends/coredsl2_set/importer.py +++ b/m2isar/frontends/coredsl2_set/importer.py @@ -11,7 +11,7 @@ import logging import pathlib -from .parser_gen import CoreDSL2Listener, CoreDSL2Parser, CoreDSL2Visitor +from ..coredsl2.parser_gen import CoreDSL2Listener, CoreDSL2Parser, CoreDSL2Visitor from .utils import make_parser diff --git a/m2isar/frontends/coredsl2_set/load_order.py b/m2isar/frontends/coredsl2_set/load_order.py index fbbd2bd2..d02c81ad 100644 --- a/m2isar/frontends/coredsl2_set/load_order.py +++ b/m2isar/frontends/coredsl2_set/load_order.py @@ -9,7 +9,7 @@ from antlr4 import ParserRuleContext from m2isar import M2DuplicateError -from .parser_gen import CoreDSL2Parser, CoreDSL2Visitor +from ..coredsl2.parser_gen import CoreDSL2Parser, CoreDSL2Visitor class CoreContainerContext(ParserRuleContext): diff --git a/m2isar/frontends/coredsl2_set/parser_gen/.gitignore b/m2isar/frontends/coredsl2_set/parser_gen/.gitignore deleted file mode 100644 index 6e009160..00000000 --- a/m2isar/frontends/coredsl2_set/parser_gen/.gitignore +++ /dev/null @@ -1,12 +0,0 @@ -# SPDX-License-Identifier: Apache-2.0 -# -# This file is part of the M2-ISA-R project: https://github.com/tum-ei-eda/M2-ISA-R -# -# Copyright (C) 2022 -# Chair of Electrical Design Automation -# Technical University of Munich - -*.interp -*.tokens -!.gitignore -!__init__.py \ No newline at end of file diff --git a/m2isar/frontends/coredsl2_set/parser_gen/CoreDSL2Lexer.py b/m2isar/frontends/coredsl2_set/parser_gen/CoreDSL2Lexer.py deleted file mode 100644 index 932901cd..00000000 --- a/m2isar/frontends/coredsl2_set/parser_gen/CoreDSL2Lexer.py +++ /dev/null @@ -1,510 +0,0 @@ -# Generated from ../coredsl2/CoreDSL2.g4 by ANTLR 4.13.1 -from antlr4 import * -from io import StringIO -import sys -if sys.version_info[1] > 5: - from typing import TextIO -else: - from typing.io import TextIO - - -def serializedATN(): - return [ - 4,0,102,900,6,-1,2,0,7,0,2,1,7,1,2,2,7,2,2,3,7,3,2,4,7,4,2,5,7,5, - 2,6,7,6,2,7,7,7,2,8,7,8,2,9,7,9,2,10,7,10,2,11,7,11,2,12,7,12,2, - 13,7,13,2,14,7,14,2,15,7,15,2,16,7,16,2,17,7,17,2,18,7,18,2,19,7, - 19,2,20,7,20,2,21,7,21,2,22,7,22,2,23,7,23,2,24,7,24,2,25,7,25,2, - 26,7,26,2,27,7,27,2,28,7,28,2,29,7,29,2,30,7,30,2,31,7,31,2,32,7, - 32,2,33,7,33,2,34,7,34,2,35,7,35,2,36,7,36,2,37,7,37,2,38,7,38,2, - 39,7,39,2,40,7,40,2,41,7,41,2,42,7,42,2,43,7,43,2,44,7,44,2,45,7, - 45,2,46,7,46,2,47,7,47,2,48,7,48,2,49,7,49,2,50,7,50,2,51,7,51,2, - 52,7,52,2,53,7,53,2,54,7,54,2,55,7,55,2,56,7,56,2,57,7,57,2,58,7, - 58,2,59,7,59,2,60,7,60,2,61,7,61,2,62,7,62,2,63,7,63,2,64,7,64,2, - 65,7,65,2,66,7,66,2,67,7,67,2,68,7,68,2,69,7,69,2,70,7,70,2,71,7, - 71,2,72,7,72,2,73,7,73,2,74,7,74,2,75,7,75,2,76,7,76,2,77,7,77,2, - 78,7,78,2,79,7,79,2,80,7,80,2,81,7,81,2,82,7,82,2,83,7,83,2,84,7, - 84,2,85,7,85,2,86,7,86,2,87,7,87,2,88,7,88,2,89,7,89,2,90,7,90,2, - 91,7,91,2,92,7,92,2,93,7,93,2,94,7,94,2,95,7,95,2,96,7,96,2,97,7, - 97,2,98,7,98,2,99,7,99,2,100,7,100,2,101,7,101,2,102,7,102,2,103, - 7,103,2,104,7,104,2,105,7,105,2,106,7,106,1,0,1,0,1,0,1,0,1,0,1, - 0,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, - 1,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,3,1,3,1,4,1,4,1,5,1,5,1,6,1, - 6,1,6,1,6,1,6,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,8,1,8,1,8,1, - 8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1, - 8,1,9,1,9,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,11, - 1,11,1,11,1,11,1,11,1,11,1,11,1,11,1,11,1,11,1,11,1,11,1,11,1,12, - 1,12,1,12,1,12,1,12,1,12,1,12,1,13,1,13,1,13,1,13,1,13,1,13,1,13, - 1,13,1,13,1,14,1,14,1,15,1,15,1,15,1,16,1,16,1,16,1,16,1,16,1,16, - 1,16,1,16,1,16,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,18, - 1,18,1,18,1,18,1,18,1,18,1,18,1,19,1,19,1,20,1,20,1,21,1,21,1,21, - 1,22,1,22,1,22,1,22,1,22,1,23,1,23,1,23,1,23,1,24,1,24,1,24,1,24, - 1,24,1,24,1,25,1,25,1,25,1,26,1,26,1,26,1,26,1,26,1,26,1,26,1,27, - 1,27,1,27,1,27,1,27,1,27,1,27,1,28,1,28,1,28,1,28,1,28,1,28,1,29, - 1,29,1,29,1,29,1,29,1,29,1,29,1,29,1,29,1,30,1,30,1,30,1,30,1,30, - 1,30,1,31,1,31,1,31,1,31,1,31,1,32,1,32,1,32,1,32,1,32,1,32,1,32, - 1,32,1,33,1,33,1,34,1,34,1,35,1,35,1,36,1,36,1,37,1,37,1,37,1,37, - 1,37,1,38,1,38,1,38,1,38,1,38,1,39,1,39,1,39,1,39,1,39,1,40,1,40, - 1,40,1,40,1,40,1,40,1,40,1,40,1,40,1,41,1,41,1,41,1,41,1,41,1,41, - 1,41,1,42,1,42,1,42,1,42,1,42,1,43,1,43,1,43,1,43,1,43,1,43,1,44, - 1,44,1,44,1,44,1,45,1,45,1,45,1,45,1,45,1,46,1,46,1,46,1,46,1,46, - 1,46,1,47,1,47,1,47,1,47,1,47,1,47,1,47,1,48,1,48,1,48,1,49,1,49, - 1,50,1,50,1,50,1,51,1,51,1,52,1,52,1,52,1,53,1,53,1,53,1,54,1,54, - 1,54,1,55,1,55,1,56,1,56,1,57,1,57,1,58,1,58,1,59,1,59,1,60,1,60, - 1,61,1,61,1,61,1,62,1,62,1,62,1,63,1,63,1,63,1,64,1,64,1,64,1,65, - 1,65,1,65,1,66,1,66,1,66,1,67,1,67,1,68,1,68,1,69,1,69,1,69,1,70, - 1,70,1,70,1,71,1,71,1,72,1,72,1,72,1,73,1,73,1,73,1,74,1,74,1,74, - 1,75,1,75,1,75,1,76,1,76,1,76,1,77,1,77,1,77,1,78,1,78,1,78,1,79, - 1,79,1,79,1,79,1,80,1,80,1,80,1,80,1,80,1,81,1,81,1,81,1,81,1,82, - 1,82,1,82,1,83,1,83,1,83,1,83,1,83,1,83,1,84,1,84,1,84,1,84,1,84, - 1,84,1,85,1,85,1,85,1,85,1,85,1,85,1,85,1,85,1,85,1,86,1,86,1,86, - 1,86,1,86,1,86,1,86,1,87,1,87,1,87,1,87,1,87,1,87,1,87,1,87,1,87, - 1,88,1,88,1,88,1,88,1,88,1,88,1,88,1,89,1,89,1,89,1,89,1,89,1,89, - 1,90,1,90,1,91,1,91,1,92,1,92,1,92,1,92,1,92,1,92,1,92,1,92,1,92, - 3,92,663,8,92,1,93,4,93,666,8,93,11,93,12,93,667,1,93,1,93,5,93, - 672,8,93,10,93,12,93,675,9,93,1,93,1,93,3,93,679,8,93,1,93,4,93, - 682,8,93,11,93,12,93,683,3,93,686,8,93,1,93,3,93,689,8,93,1,94,1, - 94,1,94,1,94,1,94,3,94,696,8,94,1,94,3,94,699,8,94,1,94,1,94,3,94, - 703,8,94,3,94,705,8,94,1,95,1,95,1,95,1,95,3,95,711,8,95,1,95,1, - 95,3,95,715,8,95,1,95,5,95,718,8,95,10,95,12,95,721,9,95,1,96,1, - 96,3,96,725,8,96,1,96,1,96,3,96,729,8,96,1,96,5,96,732,8,96,10,96, - 12,96,735,9,96,1,97,1,97,1,97,3,97,740,8,97,1,97,5,97,743,8,97,10, - 97,12,97,746,9,97,3,97,748,8,97,1,98,1,98,1,98,1,98,3,98,754,8,98, - 1,98,1,98,3,98,758,8,98,1,98,5,98,761,8,98,10,98,12,98,764,9,98, - 1,99,4,99,767,8,99,11,99,12,99,768,1,99,1,99,3,99,773,8,99,1,99, - 1,99,4,99,777,8,99,11,99,12,99,778,1,99,1,99,4,99,783,8,99,11,99, - 12,99,784,1,99,1,99,4,99,789,8,99,11,99,12,99,790,1,99,1,99,4,99, - 795,8,99,11,99,12,99,796,3,99,799,8,99,1,100,3,100,802,8,100,1,100, - 1,100,5,100,806,8,100,10,100,12,100,809,9,100,1,101,3,101,812,8, - 101,1,101,1,101,1,101,1,101,5,101,818,8,101,10,101,12,101,821,9, - 101,1,101,1,101,1,102,1,102,1,102,3,102,828,8,102,1,102,1,102,1, - 102,1,102,5,102,834,8,102,10,102,12,102,837,9,102,1,102,1,102,1, - 103,1,103,1,103,1,103,5,103,845,8,103,10,103,12,103,848,9,103,1, - 103,1,103,1,103,1,103,1,103,5,103,855,8,103,10,103,12,103,858,9, - 103,1,103,3,103,861,8,103,1,104,1,104,1,104,1,104,5,104,867,8,104, - 10,104,12,104,870,9,104,1,104,1,104,1,104,1,104,1,104,1,105,1,105, - 1,105,1,105,5,105,881,8,105,10,105,12,105,884,9,105,1,105,3,105, - 887,8,105,1,105,3,105,890,8,105,1,105,1,105,1,106,4,106,895,8,106, - 11,106,12,106,896,1,106,1,106,1,868,0,107,1,1,3,2,5,3,7,4,9,5,11, - 6,13,7,15,8,17,9,19,10,21,11,23,12,25,13,27,14,29,15,31,16,33,17, - 35,18,37,19,39,20,41,21,43,22,45,23,47,24,49,25,51,26,53,27,55,28, - 57,29,59,30,61,31,63,32,65,33,67,34,69,35,71,36,73,37,75,38,77,39, - 79,40,81,41,83,42,85,43,87,44,89,45,91,46,93,47,95,48,97,49,99,50, - 101,51,103,52,105,53,107,54,109,55,111,56,113,57,115,58,117,59,119, - 60,121,61,123,62,125,63,127,64,129,65,131,66,133,67,135,68,137,69, - 139,70,141,71,143,72,145,73,147,74,149,75,151,76,153,77,155,78,157, - 79,159,80,161,81,163,82,165,83,167,84,169,85,171,86,173,87,175,88, - 177,89,179,90,181,91,183,92,185,93,187,94,189,95,191,0,193,0,195, - 0,197,0,199,0,201,96,203,97,205,98,207,99,209,100,211,101,213,102, - 1,0,13,2,0,69,69,101,101,2,0,43,43,45,45,4,0,70,70,76,76,102,102, - 108,108,2,0,85,85,117,117,2,0,76,76,108,108,3,0,48,57,65,70,97,102, - 3,0,65,90,95,95,97,122,4,0,48,57,65,90,95,95,97,122,3,0,76,76,85, - 85,117,117,2,0,39,39,92,92,2,0,34,34,92,92,2,0,10,10,13,13,3,0,9, - 10,13,13,32,32,947,0,1,1,0,0,0,0,3,1,0,0,0,0,5,1,0,0,0,0,7,1,0,0, - 0,0,9,1,0,0,0,0,11,1,0,0,0,0,13,1,0,0,0,0,15,1,0,0,0,0,17,1,0,0, - 0,0,19,1,0,0,0,0,21,1,0,0,0,0,23,1,0,0,0,0,25,1,0,0,0,0,27,1,0,0, - 0,0,29,1,0,0,0,0,31,1,0,0,0,0,33,1,0,0,0,0,35,1,0,0,0,0,37,1,0,0, - 0,0,39,1,0,0,0,0,41,1,0,0,0,0,43,1,0,0,0,0,45,1,0,0,0,0,47,1,0,0, - 0,0,49,1,0,0,0,0,51,1,0,0,0,0,53,1,0,0,0,0,55,1,0,0,0,0,57,1,0,0, - 0,0,59,1,0,0,0,0,61,1,0,0,0,0,63,1,0,0,0,0,65,1,0,0,0,0,67,1,0,0, - 0,0,69,1,0,0,0,0,71,1,0,0,0,0,73,1,0,0,0,0,75,1,0,0,0,0,77,1,0,0, - 0,0,79,1,0,0,0,0,81,1,0,0,0,0,83,1,0,0,0,0,85,1,0,0,0,0,87,1,0,0, - 0,0,89,1,0,0,0,0,91,1,0,0,0,0,93,1,0,0,0,0,95,1,0,0,0,0,97,1,0,0, - 0,0,99,1,0,0,0,0,101,1,0,0,0,0,103,1,0,0,0,0,105,1,0,0,0,0,107,1, - 0,0,0,0,109,1,0,0,0,0,111,1,0,0,0,0,113,1,0,0,0,0,115,1,0,0,0,0, - 117,1,0,0,0,0,119,1,0,0,0,0,121,1,0,0,0,0,123,1,0,0,0,0,125,1,0, - 0,0,0,127,1,0,0,0,0,129,1,0,0,0,0,131,1,0,0,0,0,133,1,0,0,0,0,135, - 1,0,0,0,0,137,1,0,0,0,0,139,1,0,0,0,0,141,1,0,0,0,0,143,1,0,0,0, - 0,145,1,0,0,0,0,147,1,0,0,0,0,149,1,0,0,0,0,151,1,0,0,0,0,153,1, - 0,0,0,0,155,1,0,0,0,0,157,1,0,0,0,0,159,1,0,0,0,0,161,1,0,0,0,0, - 163,1,0,0,0,0,165,1,0,0,0,0,167,1,0,0,0,0,169,1,0,0,0,0,171,1,0, - 0,0,0,173,1,0,0,0,0,175,1,0,0,0,0,177,1,0,0,0,0,179,1,0,0,0,0,181, - 1,0,0,0,0,183,1,0,0,0,0,185,1,0,0,0,0,187,1,0,0,0,0,189,1,0,0,0, - 0,201,1,0,0,0,0,203,1,0,0,0,0,205,1,0,0,0,0,207,1,0,0,0,0,209,1, - 0,0,0,0,211,1,0,0,0,0,213,1,0,0,0,1,215,1,0,0,0,3,222,1,0,0,0,5, - 237,1,0,0,0,7,245,1,0,0,0,9,247,1,0,0,0,11,249,1,0,0,0,13,251,1, - 0,0,0,15,256,1,0,0,0,17,265,1,0,0,0,19,285,1,0,0,0,21,287,1,0,0, - 0,23,297,1,0,0,0,25,310,1,0,0,0,27,317,1,0,0,0,29,326,1,0,0,0,31, - 328,1,0,0,0,33,331,1,0,0,0,35,340,1,0,0,0,37,349,1,0,0,0,39,356, - 1,0,0,0,41,358,1,0,0,0,43,360,1,0,0,0,45,363,1,0,0,0,47,368,1,0, - 0,0,49,372,1,0,0,0,51,378,1,0,0,0,53,381,1,0,0,0,55,388,1,0,0,0, - 57,395,1,0,0,0,59,401,1,0,0,0,61,410,1,0,0,0,63,416,1,0,0,0,65,421, - 1,0,0,0,67,429,1,0,0,0,69,431,1,0,0,0,71,433,1,0,0,0,73,435,1,0, - 0,0,75,437,1,0,0,0,77,442,1,0,0,0,79,447,1,0,0,0,81,452,1,0,0,0, - 83,461,1,0,0,0,85,468,1,0,0,0,87,473,1,0,0,0,89,479,1,0,0,0,91,483, - 1,0,0,0,93,488,1,0,0,0,95,494,1,0,0,0,97,501,1,0,0,0,99,504,1,0, - 0,0,101,506,1,0,0,0,103,509,1,0,0,0,105,511,1,0,0,0,107,514,1,0, - 0,0,109,517,1,0,0,0,111,520,1,0,0,0,113,522,1,0,0,0,115,524,1,0, - 0,0,117,526,1,0,0,0,119,528,1,0,0,0,121,530,1,0,0,0,123,532,1,0, - 0,0,125,535,1,0,0,0,127,538,1,0,0,0,129,541,1,0,0,0,131,544,1,0, - 0,0,133,547,1,0,0,0,135,550,1,0,0,0,137,552,1,0,0,0,139,554,1,0, - 0,0,141,557,1,0,0,0,143,560,1,0,0,0,145,562,1,0,0,0,147,565,1,0, - 0,0,149,568,1,0,0,0,151,571,1,0,0,0,153,574,1,0,0,0,155,577,1,0, - 0,0,157,580,1,0,0,0,159,583,1,0,0,0,161,587,1,0,0,0,163,592,1,0, - 0,0,165,596,1,0,0,0,167,599,1,0,0,0,169,605,1,0,0,0,171,611,1,0, - 0,0,173,620,1,0,0,0,175,627,1,0,0,0,177,636,1,0,0,0,179,643,1,0, - 0,0,181,649,1,0,0,0,183,651,1,0,0,0,185,662,1,0,0,0,187,665,1,0, - 0,0,189,695,1,0,0,0,191,710,1,0,0,0,193,722,1,0,0,0,195,747,1,0, - 0,0,197,753,1,0,0,0,199,766,1,0,0,0,201,801,1,0,0,0,203,811,1,0, - 0,0,205,827,1,0,0,0,207,860,1,0,0,0,209,862,1,0,0,0,211,876,1,0, - 0,0,213,894,1,0,0,0,215,216,5,105,0,0,216,217,5,109,0,0,217,218, - 5,112,0,0,218,219,5,111,0,0,219,220,5,114,0,0,220,221,5,116,0,0, - 221,2,1,0,0,0,222,223,5,73,0,0,223,224,5,110,0,0,224,225,5,115,0, - 0,225,226,5,116,0,0,226,227,5,114,0,0,227,228,5,117,0,0,228,229, - 5,99,0,0,229,230,5,116,0,0,230,231,5,105,0,0,231,232,5,111,0,0,232, - 233,5,110,0,0,233,234,5,83,0,0,234,235,5,101,0,0,235,236,5,116,0, - 0,236,4,1,0,0,0,237,238,5,101,0,0,238,239,5,120,0,0,239,240,5,116, - 0,0,240,241,5,101,0,0,241,242,5,110,0,0,242,243,5,100,0,0,243,244, - 5,115,0,0,244,6,1,0,0,0,245,246,5,44,0,0,246,8,1,0,0,0,247,248,5, - 123,0,0,248,10,1,0,0,0,249,250,5,125,0,0,250,12,1,0,0,0,251,252, - 5,67,0,0,252,253,5,111,0,0,253,254,5,114,0,0,254,255,5,101,0,0,255, - 14,1,0,0,0,256,257,5,112,0,0,257,258,5,114,0,0,258,259,5,111,0,0, - 259,260,5,118,0,0,260,261,5,105,0,0,261,262,5,100,0,0,262,263,5, - 101,0,0,263,264,5,115,0,0,264,16,1,0,0,0,265,266,5,97,0,0,266,267, - 5,114,0,0,267,268,5,99,0,0,268,269,5,104,0,0,269,270,5,105,0,0,270, - 271,5,116,0,0,271,272,5,101,0,0,272,273,5,99,0,0,273,274,5,116,0, - 0,274,275,5,117,0,0,275,276,5,114,0,0,276,277,5,97,0,0,277,278,5, - 108,0,0,278,279,5,95,0,0,279,280,5,115,0,0,280,281,5,116,0,0,281, - 282,5,97,0,0,282,283,5,116,0,0,283,284,5,101,0,0,284,18,1,0,0,0, - 285,286,5,59,0,0,286,20,1,0,0,0,287,288,5,102,0,0,288,289,5,117, - 0,0,289,290,5,110,0,0,290,291,5,99,0,0,291,292,5,116,0,0,292,293, - 5,105,0,0,293,294,5,111,0,0,294,295,5,110,0,0,295,296,5,115,0,0, - 296,22,1,0,0,0,297,298,5,105,0,0,298,299,5,110,0,0,299,300,5,115, - 0,0,300,301,5,116,0,0,301,302,5,114,0,0,302,303,5,117,0,0,303,304, - 5,99,0,0,304,305,5,116,0,0,305,306,5,105,0,0,306,307,5,111,0,0,307, - 308,5,110,0,0,308,309,5,115,0,0,309,24,1,0,0,0,310,311,5,97,0,0, - 311,312,5,108,0,0,312,313,5,119,0,0,313,314,5,97,0,0,314,315,5,121, - 0,0,315,316,5,115,0,0,316,26,1,0,0,0,317,318,5,101,0,0,318,319,5, - 110,0,0,319,320,5,99,0,0,320,321,5,111,0,0,321,322,5,100,0,0,322, - 323,5,105,0,0,323,324,5,110,0,0,324,325,5,103,0,0,325,28,1,0,0,0, - 326,327,5,58,0,0,327,30,1,0,0,0,328,329,5,58,0,0,329,330,5,58,0, - 0,330,32,1,0,0,0,331,332,5,97,0,0,332,333,5,115,0,0,333,334,5,115, - 0,0,334,335,5,101,0,0,335,336,5,109,0,0,336,337,5,98,0,0,337,338, - 5,108,0,0,338,339,5,121,0,0,339,34,1,0,0,0,340,341,5,98,0,0,341, - 342,5,101,0,0,342,343,5,104,0,0,343,344,5,97,0,0,344,345,5,118,0, - 0,345,346,5,105,0,0,346,347,5,111,0,0,347,348,5,114,0,0,348,36,1, - 0,0,0,349,350,5,101,0,0,350,351,5,120,0,0,351,352,5,116,0,0,352, - 353,5,101,0,0,353,354,5,114,0,0,354,355,5,110,0,0,355,38,1,0,0,0, - 356,357,5,40,0,0,357,40,1,0,0,0,358,359,5,41,0,0,359,42,1,0,0,0, - 360,361,5,105,0,0,361,362,5,102,0,0,362,44,1,0,0,0,363,364,5,101, - 0,0,364,365,5,108,0,0,365,366,5,115,0,0,366,367,5,101,0,0,367,46, - 1,0,0,0,368,369,5,102,0,0,369,370,5,111,0,0,370,371,5,114,0,0,371, - 48,1,0,0,0,372,373,5,119,0,0,373,374,5,104,0,0,374,375,5,105,0,0, - 375,376,5,108,0,0,376,377,5,101,0,0,377,50,1,0,0,0,378,379,5,100, - 0,0,379,380,5,111,0,0,380,52,1,0,0,0,381,382,5,115,0,0,382,383,5, - 119,0,0,383,384,5,105,0,0,384,385,5,116,0,0,385,386,5,99,0,0,386, - 387,5,104,0,0,387,54,1,0,0,0,388,389,5,114,0,0,389,390,5,101,0,0, - 390,391,5,116,0,0,391,392,5,117,0,0,392,393,5,114,0,0,393,394,5, - 110,0,0,394,56,1,0,0,0,395,396,5,98,0,0,396,397,5,114,0,0,397,398, - 5,101,0,0,398,399,5,97,0,0,399,400,5,107,0,0,400,58,1,0,0,0,401, - 402,5,99,0,0,402,403,5,111,0,0,403,404,5,110,0,0,404,405,5,116,0, - 0,405,406,5,105,0,0,406,407,5,110,0,0,407,408,5,117,0,0,408,409, - 5,101,0,0,409,60,1,0,0,0,410,411,5,115,0,0,411,412,5,112,0,0,412, - 413,5,97,0,0,413,414,5,119,0,0,414,415,5,110,0,0,415,62,1,0,0,0, - 416,417,5,99,0,0,417,418,5,97,0,0,418,419,5,115,0,0,419,420,5,101, - 0,0,420,64,1,0,0,0,421,422,5,100,0,0,422,423,5,101,0,0,423,424,5, - 102,0,0,424,425,5,97,0,0,425,426,5,117,0,0,426,427,5,108,0,0,427, - 428,5,116,0,0,428,66,1,0,0,0,429,430,5,42,0,0,430,68,1,0,0,0,431, - 432,5,38,0,0,432,70,1,0,0,0,433,434,5,60,0,0,434,72,1,0,0,0,435, - 436,5,62,0,0,436,74,1,0,0,0,437,438,5,98,0,0,438,439,5,111,0,0,439, - 440,5,111,0,0,440,441,5,108,0,0,441,76,1,0,0,0,442,443,5,118,0,0, - 443,444,5,111,0,0,444,445,5,105,0,0,445,446,5,100,0,0,446,78,1,0, - 0,0,447,448,5,101,0,0,448,449,5,110,0,0,449,450,5,117,0,0,450,451, - 5,109,0,0,451,80,1,0,0,0,452,453,5,117,0,0,453,454,5,110,0,0,454, - 455,5,115,0,0,455,456,5,105,0,0,456,457,5,103,0,0,457,458,5,110, - 0,0,458,459,5,101,0,0,459,460,5,100,0,0,460,82,1,0,0,0,461,462,5, - 115,0,0,462,463,5,105,0,0,463,464,5,103,0,0,464,465,5,110,0,0,465, - 466,5,101,0,0,466,467,5,100,0,0,467,84,1,0,0,0,468,469,5,99,0,0, - 469,470,5,104,0,0,470,471,5,97,0,0,471,472,5,114,0,0,472,86,1,0, - 0,0,473,474,5,115,0,0,474,475,5,104,0,0,475,476,5,111,0,0,476,477, - 5,114,0,0,477,478,5,116,0,0,478,88,1,0,0,0,479,480,5,105,0,0,480, - 481,5,110,0,0,481,482,5,116,0,0,482,90,1,0,0,0,483,484,5,108,0,0, - 484,485,5,111,0,0,485,486,5,110,0,0,486,487,5,103,0,0,487,92,1,0, - 0,0,488,489,5,102,0,0,489,490,5,108,0,0,490,491,5,111,0,0,491,492, - 5,97,0,0,492,493,5,116,0,0,493,94,1,0,0,0,494,495,5,100,0,0,495, - 496,5,111,0,0,496,497,5,117,0,0,497,498,5,98,0,0,498,499,5,108,0, - 0,499,500,5,101,0,0,500,96,1,0,0,0,501,502,5,91,0,0,502,503,5,91, - 0,0,503,98,1,0,0,0,504,505,5,61,0,0,505,100,1,0,0,0,506,507,5,93, - 0,0,507,508,5,93,0,0,508,102,1,0,0,0,509,510,5,46,0,0,510,104,1, - 0,0,0,511,512,5,45,0,0,512,513,5,62,0,0,513,106,1,0,0,0,514,515, - 5,43,0,0,515,516,5,43,0,0,516,108,1,0,0,0,517,518,5,45,0,0,518,519, - 5,45,0,0,519,110,1,0,0,0,520,521,5,43,0,0,521,112,1,0,0,0,522,523, - 5,45,0,0,523,114,1,0,0,0,524,525,5,126,0,0,525,116,1,0,0,0,526,527, - 5,33,0,0,527,118,1,0,0,0,528,529,5,47,0,0,529,120,1,0,0,0,530,531, - 5,37,0,0,531,122,1,0,0,0,532,533,5,60,0,0,533,534,5,60,0,0,534,124, - 1,0,0,0,535,536,5,62,0,0,536,537,5,62,0,0,537,126,1,0,0,0,538,539, - 5,60,0,0,539,540,5,61,0,0,540,128,1,0,0,0,541,542,5,62,0,0,542,543, - 5,61,0,0,543,130,1,0,0,0,544,545,5,61,0,0,545,546,5,61,0,0,546,132, - 1,0,0,0,547,548,5,33,0,0,548,549,5,61,0,0,549,134,1,0,0,0,550,551, - 5,94,0,0,551,136,1,0,0,0,552,553,5,124,0,0,553,138,1,0,0,0,554,555, - 5,38,0,0,555,556,5,38,0,0,556,140,1,0,0,0,557,558,5,124,0,0,558, - 559,5,124,0,0,559,142,1,0,0,0,560,561,5,63,0,0,561,144,1,0,0,0,562, - 563,5,43,0,0,563,564,5,61,0,0,564,146,1,0,0,0,565,566,5,45,0,0,566, - 567,5,61,0,0,567,148,1,0,0,0,568,569,5,42,0,0,569,570,5,61,0,0,570, - 150,1,0,0,0,571,572,5,47,0,0,572,573,5,61,0,0,573,152,1,0,0,0,574, - 575,5,38,0,0,575,576,5,61,0,0,576,154,1,0,0,0,577,578,5,124,0,0, - 578,579,5,61,0,0,579,156,1,0,0,0,580,581,5,94,0,0,581,582,5,61,0, - 0,582,158,1,0,0,0,583,584,5,62,0,0,584,585,5,62,0,0,585,586,5,61, - 0,0,586,160,1,0,0,0,587,588,5,62,0,0,588,589,5,62,0,0,589,590,5, - 62,0,0,590,591,5,61,0,0,591,162,1,0,0,0,592,593,5,60,0,0,593,594, - 5,60,0,0,594,595,5,61,0,0,595,164,1,0,0,0,596,597,5,37,0,0,597,598, - 5,61,0,0,598,166,1,0,0,0,599,600,5,97,0,0,600,601,5,108,0,0,601, - 602,5,105,0,0,602,603,5,97,0,0,603,604,5,115,0,0,604,168,1,0,0,0, - 605,606,5,99,0,0,606,607,5,111,0,0,607,608,5,110,0,0,608,609,5,115, - 0,0,609,610,5,116,0,0,610,170,1,0,0,0,611,612,5,118,0,0,612,613, - 5,111,0,0,613,614,5,108,0,0,614,615,5,97,0,0,615,616,5,116,0,0,616, - 617,5,105,0,0,617,618,5,108,0,0,618,619,5,101,0,0,619,172,1,0,0, - 0,620,621,5,115,0,0,621,622,5,116,0,0,622,623,5,97,0,0,623,624,5, - 116,0,0,624,625,5,105,0,0,625,626,5,99,0,0,626,174,1,0,0,0,627,628, - 5,114,0,0,628,629,5,101,0,0,629,630,5,103,0,0,630,631,5,105,0,0, - 631,632,5,115,0,0,632,633,5,116,0,0,633,634,5,101,0,0,634,635,5, - 114,0,0,635,176,1,0,0,0,636,637,5,115,0,0,637,638,5,116,0,0,638, - 639,5,114,0,0,639,640,5,117,0,0,640,641,5,99,0,0,641,642,5,116,0, - 0,642,178,1,0,0,0,643,644,5,117,0,0,644,645,5,110,0,0,645,646,5, - 105,0,0,646,647,5,111,0,0,647,648,5,110,0,0,648,180,1,0,0,0,649, - 650,5,91,0,0,650,182,1,0,0,0,651,652,5,93,0,0,652,184,1,0,0,0,653, - 654,5,116,0,0,654,655,5,114,0,0,655,656,5,117,0,0,656,663,5,101, - 0,0,657,658,5,102,0,0,658,659,5,97,0,0,659,660,5,108,0,0,660,661, - 5,115,0,0,661,663,5,101,0,0,662,653,1,0,0,0,662,657,1,0,0,0,663, - 186,1,0,0,0,664,666,2,48,57,0,665,664,1,0,0,0,666,667,1,0,0,0,667, - 665,1,0,0,0,667,668,1,0,0,0,668,669,1,0,0,0,669,673,5,46,0,0,670, - 672,2,48,57,0,671,670,1,0,0,0,672,675,1,0,0,0,673,671,1,0,0,0,673, - 674,1,0,0,0,674,685,1,0,0,0,675,673,1,0,0,0,676,678,7,0,0,0,677, - 679,7,1,0,0,678,677,1,0,0,0,678,679,1,0,0,0,679,681,1,0,0,0,680, - 682,2,48,57,0,681,680,1,0,0,0,682,683,1,0,0,0,683,681,1,0,0,0,683, - 684,1,0,0,0,684,686,1,0,0,0,685,676,1,0,0,0,685,686,1,0,0,0,686, - 688,1,0,0,0,687,689,7,2,0,0,688,687,1,0,0,0,688,689,1,0,0,0,689, - 188,1,0,0,0,690,696,3,191,95,0,691,696,3,197,98,0,692,696,3,193, - 96,0,693,696,3,195,97,0,694,696,3,199,99,0,695,690,1,0,0,0,695,691, - 1,0,0,0,695,692,1,0,0,0,695,693,1,0,0,0,695,694,1,0,0,0,696,698, - 1,0,0,0,697,699,7,3,0,0,698,697,1,0,0,0,698,699,1,0,0,0,699,704, - 1,0,0,0,700,702,7,4,0,0,701,703,7,4,0,0,702,701,1,0,0,0,702,703, - 1,0,0,0,703,705,1,0,0,0,704,700,1,0,0,0,704,705,1,0,0,0,705,190, - 1,0,0,0,706,707,5,48,0,0,707,711,5,98,0,0,708,709,5,48,0,0,709,711, - 5,66,0,0,710,706,1,0,0,0,710,708,1,0,0,0,711,712,1,0,0,0,712,719, - 2,48,49,0,713,715,5,95,0,0,714,713,1,0,0,0,714,715,1,0,0,0,715,716, - 1,0,0,0,716,718,2,48,49,0,717,714,1,0,0,0,718,721,1,0,0,0,719,717, - 1,0,0,0,719,720,1,0,0,0,720,192,1,0,0,0,721,719,1,0,0,0,722,724, - 5,48,0,0,723,725,5,95,0,0,724,723,1,0,0,0,724,725,1,0,0,0,725,726, - 1,0,0,0,726,733,2,48,55,0,727,729,5,95,0,0,728,727,1,0,0,0,728,729, - 1,0,0,0,729,730,1,0,0,0,730,732,2,48,55,0,731,728,1,0,0,0,732,735, - 1,0,0,0,733,731,1,0,0,0,733,734,1,0,0,0,734,194,1,0,0,0,735,733, - 1,0,0,0,736,748,5,48,0,0,737,744,2,49,57,0,738,740,5,95,0,0,739, - 738,1,0,0,0,739,740,1,0,0,0,740,741,1,0,0,0,741,743,2,48,57,0,742, - 739,1,0,0,0,743,746,1,0,0,0,744,742,1,0,0,0,744,745,1,0,0,0,745, - 748,1,0,0,0,746,744,1,0,0,0,747,736,1,0,0,0,747,737,1,0,0,0,748, - 196,1,0,0,0,749,750,5,48,0,0,750,754,5,120,0,0,751,752,5,48,0,0, - 752,754,5,88,0,0,753,749,1,0,0,0,753,751,1,0,0,0,754,755,1,0,0,0, - 755,762,7,5,0,0,756,758,5,95,0,0,757,756,1,0,0,0,757,758,1,0,0,0, - 758,759,1,0,0,0,759,761,7,5,0,0,760,757,1,0,0,0,761,764,1,0,0,0, - 762,760,1,0,0,0,762,763,1,0,0,0,763,198,1,0,0,0,764,762,1,0,0,0, - 765,767,2,48,57,0,766,765,1,0,0,0,767,768,1,0,0,0,768,766,1,0,0, - 0,768,769,1,0,0,0,769,770,1,0,0,0,770,772,5,39,0,0,771,773,5,115, - 0,0,772,771,1,0,0,0,772,773,1,0,0,0,773,798,1,0,0,0,774,776,5,98, - 0,0,775,777,2,48,49,0,776,775,1,0,0,0,777,778,1,0,0,0,778,776,1, - 0,0,0,778,779,1,0,0,0,779,799,1,0,0,0,780,782,5,111,0,0,781,783, - 2,48,55,0,782,781,1,0,0,0,783,784,1,0,0,0,784,782,1,0,0,0,784,785, - 1,0,0,0,785,799,1,0,0,0,786,788,5,100,0,0,787,789,2,48,57,0,788, - 787,1,0,0,0,789,790,1,0,0,0,790,788,1,0,0,0,790,791,1,0,0,0,791, - 799,1,0,0,0,792,794,5,104,0,0,793,795,7,5,0,0,794,793,1,0,0,0,795, - 796,1,0,0,0,796,794,1,0,0,0,796,797,1,0,0,0,797,799,1,0,0,0,798, - 774,1,0,0,0,798,780,1,0,0,0,798,786,1,0,0,0,798,792,1,0,0,0,799, - 200,1,0,0,0,800,802,5,94,0,0,801,800,1,0,0,0,801,802,1,0,0,0,802, - 803,1,0,0,0,803,807,7,6,0,0,804,806,7,7,0,0,805,804,1,0,0,0,806, - 809,1,0,0,0,807,805,1,0,0,0,807,808,1,0,0,0,808,202,1,0,0,0,809, - 807,1,0,0,0,810,812,7,8,0,0,811,810,1,0,0,0,811,812,1,0,0,0,812, - 813,1,0,0,0,813,819,5,39,0,0,814,815,5,92,0,0,815,818,9,0,0,0,816, - 818,8,9,0,0,817,814,1,0,0,0,817,816,1,0,0,0,818,821,1,0,0,0,819, - 817,1,0,0,0,819,820,1,0,0,0,820,822,1,0,0,0,821,819,1,0,0,0,822, - 823,5,39,0,0,823,204,1,0,0,0,824,825,5,117,0,0,825,828,5,56,0,0, - 826,828,7,8,0,0,827,824,1,0,0,0,827,826,1,0,0,0,828,829,1,0,0,0, - 829,835,5,34,0,0,830,831,5,92,0,0,831,834,9,0,0,0,832,834,8,10,0, - 0,833,830,1,0,0,0,833,832,1,0,0,0,834,837,1,0,0,0,835,833,1,0,0, - 0,835,836,1,0,0,0,836,838,1,0,0,0,837,835,1,0,0,0,838,839,5,34,0, - 0,839,206,1,0,0,0,840,846,5,34,0,0,841,842,5,92,0,0,842,845,9,0, - 0,0,843,845,8,10,0,0,844,841,1,0,0,0,844,843,1,0,0,0,845,848,1,0, - 0,0,846,844,1,0,0,0,846,847,1,0,0,0,847,849,1,0,0,0,848,846,1,0, - 0,0,849,861,5,34,0,0,850,856,5,39,0,0,851,852,5,92,0,0,852,855,9, - 0,0,0,853,855,8,9,0,0,854,851,1,0,0,0,854,853,1,0,0,0,855,858,1, - 0,0,0,856,854,1,0,0,0,856,857,1,0,0,0,857,859,1,0,0,0,858,856,1, - 0,0,0,859,861,5,39,0,0,860,840,1,0,0,0,860,850,1,0,0,0,861,208,1, - 0,0,0,862,863,5,47,0,0,863,864,5,42,0,0,864,868,1,0,0,0,865,867, - 9,0,0,0,866,865,1,0,0,0,867,870,1,0,0,0,868,869,1,0,0,0,868,866, - 1,0,0,0,869,871,1,0,0,0,870,868,1,0,0,0,871,872,5,42,0,0,872,873, - 5,47,0,0,873,874,1,0,0,0,874,875,6,104,0,0,875,210,1,0,0,0,876,877, - 5,47,0,0,877,878,5,47,0,0,878,882,1,0,0,0,879,881,8,11,0,0,880,879, - 1,0,0,0,881,884,1,0,0,0,882,880,1,0,0,0,882,883,1,0,0,0,883,889, - 1,0,0,0,884,882,1,0,0,0,885,887,5,13,0,0,886,885,1,0,0,0,886,887, - 1,0,0,0,887,888,1,0,0,0,888,890,5,10,0,0,889,886,1,0,0,0,889,890, - 1,0,0,0,890,891,1,0,0,0,891,892,6,105,0,0,892,212,1,0,0,0,893,895, - 7,12,0,0,894,893,1,0,0,0,895,896,1,0,0,0,896,894,1,0,0,0,896,897, - 1,0,0,0,897,898,1,0,0,0,898,899,6,106,0,0,899,214,1,0,0,0,49,0,662, - 667,673,678,683,685,688,695,698,702,704,710,714,719,724,728,733, - 739,744,747,753,757,762,768,772,778,784,790,796,798,801,807,811, - 817,819,827,833,835,844,846,854,856,860,868,882,886,889,896,1,6, - 0,0 - ] - -class CoreDSL2Lexer(Lexer): - - atn = ATNDeserializer().deserialize(serializedATN()) - - decisionsToDFA = [ DFA(ds, i) for i, ds in enumerate(atn.decisionToState) ] - - T__0 = 1 - T__1 = 2 - T__2 = 3 - T__3 = 4 - T__4 = 5 - T__5 = 6 - T__6 = 7 - T__7 = 8 - T__8 = 9 - T__9 = 10 - T__10 = 11 - T__11 = 12 - T__12 = 13 - T__13 = 14 - T__14 = 15 - T__15 = 16 - T__16 = 17 - T__17 = 18 - T__18 = 19 - T__19 = 20 - T__20 = 21 - T__21 = 22 - T__22 = 23 - T__23 = 24 - T__24 = 25 - T__25 = 26 - T__26 = 27 - T__27 = 28 - T__28 = 29 - T__29 = 30 - T__30 = 31 - T__31 = 32 - T__32 = 33 - T__33 = 34 - T__34 = 35 - T__35 = 36 - T__36 = 37 - T__37 = 38 - T__38 = 39 - T__39 = 40 - T__40 = 41 - T__41 = 42 - T__42 = 43 - T__43 = 44 - T__44 = 45 - T__45 = 46 - T__46 = 47 - T__47 = 48 - T__48 = 49 - T__49 = 50 - T__50 = 51 - T__51 = 52 - T__52 = 53 - T__53 = 54 - T__54 = 55 - T__55 = 56 - T__56 = 57 - T__57 = 58 - T__58 = 59 - T__59 = 60 - T__60 = 61 - T__61 = 62 - T__62 = 63 - T__63 = 64 - T__64 = 65 - T__65 = 66 - T__66 = 67 - T__67 = 68 - T__68 = 69 - T__69 = 70 - T__70 = 71 - T__71 = 72 - T__72 = 73 - T__73 = 74 - T__74 = 75 - T__75 = 76 - T__76 = 77 - T__77 = 78 - T__78 = 79 - T__79 = 80 - T__80 = 81 - T__81 = 82 - T__82 = 83 - T__83 = 84 - T__84 = 85 - T__85 = 86 - T__86 = 87 - T__87 = 88 - T__88 = 89 - T__89 = 90 - LEFT_BR = 91 - RIGHT_BR = 92 - BOOLEAN = 93 - FLOAT = 94 - INTEGER = 95 - IDENTIFIER = 96 - CHARCONST = 97 - ENCSTRINGCONST = 98 - STRING = 99 - ML_COMMENT = 100 - SL_COMMENT = 101 - WS = 102 - - channelNames = [ u"DEFAULT_TOKEN_CHANNEL", u"HIDDEN" ] - - modeNames = [ "DEFAULT_MODE" ] - - literalNames = [ "", - "'import'", "'InstructionSet'", "'extends'", "','", "'{'", "'}'", - "'Core'", "'provides'", "'architectural_state'", "';'", "'functions'", - "'instructions'", "'always'", "'encoding'", "':'", "'::'", "'assembly'", - "'behavior'", "'extern'", "'('", "')'", "'if'", "'else'", "'for'", - "'while'", "'do'", "'switch'", "'return'", "'break'", "'continue'", - "'spawn'", "'case'", "'default'", "'*'", "'&'", "'<'", "'>'", - "'bool'", "'void'", "'enum'", "'unsigned'", "'signed'", "'char'", - "'short'", "'int'", "'long'", "'float'", "'double'", "'[['", - "'='", "']]'", "'.'", "'->'", "'++'", "'--'", "'+'", "'-'", - "'~'", "'!'", "'/'", "'%'", "'<<'", "'>>'", "'<='", "'>='", - "'=='", "'!='", "'^'", "'|'", "'&&'", "'||'", "'?'", "'+='", - "'-='", "'*='", "'/='", "'&='", "'|='", "'^='", "'>>='", "'>>>='", - "'<<='", "'%='", "'alias'", "'const'", "'volatile'", "'static'", - "'register'", "'struct'", "'union'", "'['", "']'" ] - - symbolicNames = [ "", - "LEFT_BR", "RIGHT_BR", "BOOLEAN", "FLOAT", "INTEGER", "IDENTIFIER", - "CHARCONST", "ENCSTRINGCONST", "STRING", "ML_COMMENT", "SL_COMMENT", - "WS" ] - - ruleNames = [ "T__0", "T__1", "T__2", "T__3", "T__4", "T__5", "T__6", - "T__7", "T__8", "T__9", "T__10", "T__11", "T__12", "T__13", - "T__14", "T__15", "T__16", "T__17", "T__18", "T__19", - "T__20", "T__21", "T__22", "T__23", "T__24", "T__25", - "T__26", "T__27", "T__28", "T__29", "T__30", "T__31", - "T__32", "T__33", "T__34", "T__35", "T__36", "T__37", - "T__38", "T__39", "T__40", "T__41", "T__42", "T__43", - "T__44", "T__45", "T__46", "T__47", "T__48", "T__49", - "T__50", "T__51", "T__52", "T__53", "T__54", "T__55", - "T__56", "T__57", "T__58", "T__59", "T__60", "T__61", - "T__62", "T__63", "T__64", "T__65", "T__66", "T__67", - "T__68", "T__69", "T__70", "T__71", "T__72", "T__73", - "T__74", "T__75", "T__76", "T__77", "T__78", "T__79", - "T__80", "T__81", "T__82", "T__83", "T__84", "T__85", - "T__86", "T__87", "T__88", "T__89", "LEFT_BR", "RIGHT_BR", - "BOOLEAN", "FLOAT", "INTEGER", "BINARYINT", "OCTALINT", - "DECIMALINT", "HEXADECIMALINT", "VLOGINT", "IDENTIFIER", - "CHARCONST", "ENCSTRINGCONST", "STRING", "ML_COMMENT", - "SL_COMMENT", "WS" ] - - grammarFileName = "CoreDSL2.g4" - - def __init__(self, input=None, output:TextIO = sys.stdout): - super().__init__(input, output) - self.checkVersion("4.13.1") - self._interp = LexerATNSimulator(self, self.atn, self.decisionsToDFA, PredictionContextCache()) - self._actions = None - self._predicates = None - - diff --git a/m2isar/frontends/coredsl2_set/parser_gen/CoreDSL2Listener.py b/m2isar/frontends/coredsl2_set/parser_gen/CoreDSL2Listener.py deleted file mode 100644 index a6811a6f..00000000 --- a/m2isar/frontends/coredsl2_set/parser_gen/CoreDSL2Listener.py +++ /dev/null @@ -1,786 +0,0 @@ -# Generated from ../coredsl2/CoreDSL2.g4 by ANTLR 4.13.1 -from antlr4 import * -if "." in __name__: - from .CoreDSL2Parser import CoreDSL2Parser -else: - from CoreDSL2Parser import CoreDSL2Parser - -# This class defines a complete listener for a parse tree produced by CoreDSL2Parser. -class CoreDSL2Listener(ParseTreeListener): - - # Enter a parse tree produced by CoreDSL2Parser#description_content. - def enterDescription_content(self, ctx:CoreDSL2Parser.Description_contentContext): - pass - - # Exit a parse tree produced by CoreDSL2Parser#description_content. - def exitDescription_content(self, ctx:CoreDSL2Parser.Description_contentContext): - pass - - - # Enter a parse tree produced by CoreDSL2Parser#import_file. - def enterImport_file(self, ctx:CoreDSL2Parser.Import_fileContext): - pass - - # Exit a parse tree produced by CoreDSL2Parser#import_file. - def exitImport_file(self, ctx:CoreDSL2Parser.Import_fileContext): - pass - - - # Enter a parse tree produced by CoreDSL2Parser#instruction_set. - def enterInstruction_set(self, ctx:CoreDSL2Parser.Instruction_setContext): - pass - - # Exit a parse tree produced by CoreDSL2Parser#instruction_set. - def exitInstruction_set(self, ctx:CoreDSL2Parser.Instruction_setContext): - pass - - - # Enter a parse tree produced by CoreDSL2Parser#core_def. - def enterCore_def(self, ctx:CoreDSL2Parser.Core_defContext): - pass - - # Exit a parse tree produced by CoreDSL2Parser#core_def. - def exitCore_def(self, ctx:CoreDSL2Parser.Core_defContext): - pass - - - # Enter a parse tree produced by CoreDSL2Parser#section_arch_state. - def enterSection_arch_state(self, ctx:CoreDSL2Parser.Section_arch_stateContext): - pass - - # Exit a parse tree produced by CoreDSL2Parser#section_arch_state. - def exitSection_arch_state(self, ctx:CoreDSL2Parser.Section_arch_stateContext): - pass - - - # Enter a parse tree produced by CoreDSL2Parser#section_functions. - def enterSection_functions(self, ctx:CoreDSL2Parser.Section_functionsContext): - pass - - # Exit a parse tree produced by CoreDSL2Parser#section_functions. - def exitSection_functions(self, ctx:CoreDSL2Parser.Section_functionsContext): - pass - - - # Enter a parse tree produced by CoreDSL2Parser#section_instructions. - def enterSection_instructions(self, ctx:CoreDSL2Parser.Section_instructionsContext): - pass - - # Exit a parse tree produced by CoreDSL2Parser#section_instructions. - def exitSection_instructions(self, ctx:CoreDSL2Parser.Section_instructionsContext): - pass - - - # Enter a parse tree produced by CoreDSL2Parser#section_always. - def enterSection_always(self, ctx:CoreDSL2Parser.Section_alwaysContext): - pass - - # Exit a parse tree produced by CoreDSL2Parser#section_always. - def exitSection_always(self, ctx:CoreDSL2Parser.Section_alwaysContext): - pass - - - # Enter a parse tree produced by CoreDSL2Parser#always_block. - def enterAlways_block(self, ctx:CoreDSL2Parser.Always_blockContext): - pass - - # Exit a parse tree produced by CoreDSL2Parser#always_block. - def exitAlways_block(self, ctx:CoreDSL2Parser.Always_blockContext): - pass - - - # Enter a parse tree produced by CoreDSL2Parser#instruction. - def enterInstruction(self, ctx:CoreDSL2Parser.InstructionContext): - pass - - # Exit a parse tree produced by CoreDSL2Parser#instruction. - def exitInstruction(self, ctx:CoreDSL2Parser.InstructionContext): - pass - - - # Enter a parse tree produced by CoreDSL2Parser#rule_encoding. - def enterRule_encoding(self, ctx:CoreDSL2Parser.Rule_encodingContext): - pass - - # Exit a parse tree produced by CoreDSL2Parser#rule_encoding. - def exitRule_encoding(self, ctx:CoreDSL2Parser.Rule_encodingContext): - pass - - - # Enter a parse tree produced by CoreDSL2Parser#bit_value. - def enterBit_value(self, ctx:CoreDSL2Parser.Bit_valueContext): - pass - - # Exit a parse tree produced by CoreDSL2Parser#bit_value. - def exitBit_value(self, ctx:CoreDSL2Parser.Bit_valueContext): - pass - - - # Enter a parse tree produced by CoreDSL2Parser#bit_field. - def enterBit_field(self, ctx:CoreDSL2Parser.Bit_fieldContext): - pass - - # Exit a parse tree produced by CoreDSL2Parser#bit_field. - def exitBit_field(self, ctx:CoreDSL2Parser.Bit_fieldContext): - pass - - - # Enter a parse tree produced by CoreDSL2Parser#function_definition. - def enterFunction_definition(self, ctx:CoreDSL2Parser.Function_definitionContext): - pass - - # Exit a parse tree produced by CoreDSL2Parser#function_definition. - def exitFunction_definition(self, ctx:CoreDSL2Parser.Function_definitionContext): - pass - - - # Enter a parse tree produced by CoreDSL2Parser#parameter_list. - def enterParameter_list(self, ctx:CoreDSL2Parser.Parameter_listContext): - pass - - # Exit a parse tree produced by CoreDSL2Parser#parameter_list. - def exitParameter_list(self, ctx:CoreDSL2Parser.Parameter_listContext): - pass - - - # Enter a parse tree produced by CoreDSL2Parser#parameter_declaration. - def enterParameter_declaration(self, ctx:CoreDSL2Parser.Parameter_declarationContext): - pass - - # Exit a parse tree produced by CoreDSL2Parser#parameter_declaration. - def exitParameter_declaration(self, ctx:CoreDSL2Parser.Parameter_declarationContext): - pass - - - # Enter a parse tree produced by CoreDSL2Parser#block_statement. - def enterBlock_statement(self, ctx:CoreDSL2Parser.Block_statementContext): - pass - - # Exit a parse tree produced by CoreDSL2Parser#block_statement. - def exitBlock_statement(self, ctx:CoreDSL2Parser.Block_statementContext): - pass - - - # Enter a parse tree produced by CoreDSL2Parser#procedure_call. - def enterProcedure_call(self, ctx:CoreDSL2Parser.Procedure_callContext): - pass - - # Exit a parse tree produced by CoreDSL2Parser#procedure_call. - def exitProcedure_call(self, ctx:CoreDSL2Parser.Procedure_callContext): - pass - - - # Enter a parse tree produced by CoreDSL2Parser#if_statement. - def enterIf_statement(self, ctx:CoreDSL2Parser.If_statementContext): - pass - - # Exit a parse tree produced by CoreDSL2Parser#if_statement. - def exitIf_statement(self, ctx:CoreDSL2Parser.If_statementContext): - pass - - - # Enter a parse tree produced by CoreDSL2Parser#for_statement. - def enterFor_statement(self, ctx:CoreDSL2Parser.For_statementContext): - pass - - # Exit a parse tree produced by CoreDSL2Parser#for_statement. - def exitFor_statement(self, ctx:CoreDSL2Parser.For_statementContext): - pass - - - # Enter a parse tree produced by CoreDSL2Parser#while_statement. - def enterWhile_statement(self, ctx:CoreDSL2Parser.While_statementContext): - pass - - # Exit a parse tree produced by CoreDSL2Parser#while_statement. - def exitWhile_statement(self, ctx:CoreDSL2Parser.While_statementContext): - pass - - - # Enter a parse tree produced by CoreDSL2Parser#do_statement. - def enterDo_statement(self, ctx:CoreDSL2Parser.Do_statementContext): - pass - - # Exit a parse tree produced by CoreDSL2Parser#do_statement. - def exitDo_statement(self, ctx:CoreDSL2Parser.Do_statementContext): - pass - - - # Enter a parse tree produced by CoreDSL2Parser#switch_statement. - def enterSwitch_statement(self, ctx:CoreDSL2Parser.Switch_statementContext): - pass - - # Exit a parse tree produced by CoreDSL2Parser#switch_statement. - def exitSwitch_statement(self, ctx:CoreDSL2Parser.Switch_statementContext): - pass - - - # Enter a parse tree produced by CoreDSL2Parser#return_statement. - def enterReturn_statement(self, ctx:CoreDSL2Parser.Return_statementContext): - pass - - # Exit a parse tree produced by CoreDSL2Parser#return_statement. - def exitReturn_statement(self, ctx:CoreDSL2Parser.Return_statementContext): - pass - - - # Enter a parse tree produced by CoreDSL2Parser#break_statement. - def enterBreak_statement(self, ctx:CoreDSL2Parser.Break_statementContext): - pass - - # Exit a parse tree produced by CoreDSL2Parser#break_statement. - def exitBreak_statement(self, ctx:CoreDSL2Parser.Break_statementContext): - pass - - - # Enter a parse tree produced by CoreDSL2Parser#continue_statement. - def enterContinue_statement(self, ctx:CoreDSL2Parser.Continue_statementContext): - pass - - # Exit a parse tree produced by CoreDSL2Parser#continue_statement. - def exitContinue_statement(self, ctx:CoreDSL2Parser.Continue_statementContext): - pass - - - # Enter a parse tree produced by CoreDSL2Parser#spawn_statement. - def enterSpawn_statement(self, ctx:CoreDSL2Parser.Spawn_statementContext): - pass - - # Exit a parse tree produced by CoreDSL2Parser#spawn_statement. - def exitSpawn_statement(self, ctx:CoreDSL2Parser.Spawn_statementContext): - pass - - - # Enter a parse tree produced by CoreDSL2Parser#expression_statement. - def enterExpression_statement(self, ctx:CoreDSL2Parser.Expression_statementContext): - pass - - # Exit a parse tree produced by CoreDSL2Parser#expression_statement. - def exitExpression_statement(self, ctx:CoreDSL2Parser.Expression_statementContext): - pass - - - # Enter a parse tree produced by CoreDSL2Parser#switch_block_statement_group. - def enterSwitch_block_statement_group(self, ctx:CoreDSL2Parser.Switch_block_statement_groupContext): - pass - - # Exit a parse tree produced by CoreDSL2Parser#switch_block_statement_group. - def exitSwitch_block_statement_group(self, ctx:CoreDSL2Parser.Switch_block_statement_groupContext): - pass - - - # Enter a parse tree produced by CoreDSL2Parser#switch_label. - def enterSwitch_label(self, ctx:CoreDSL2Parser.Switch_labelContext): - pass - - # Exit a parse tree produced by CoreDSL2Parser#switch_label. - def exitSwitch_label(self, ctx:CoreDSL2Parser.Switch_labelContext): - pass - - - # Enter a parse tree produced by CoreDSL2Parser#block. - def enterBlock(self, ctx:CoreDSL2Parser.BlockContext): - pass - - # Exit a parse tree produced by CoreDSL2Parser#block. - def exitBlock(self, ctx:CoreDSL2Parser.BlockContext): - pass - - - # Enter a parse tree produced by CoreDSL2Parser#block_item. - def enterBlock_item(self, ctx:CoreDSL2Parser.Block_itemContext): - pass - - # Exit a parse tree produced by CoreDSL2Parser#block_item. - def exitBlock_item(self, ctx:CoreDSL2Parser.Block_itemContext): - pass - - - # Enter a parse tree produced by CoreDSL2Parser#for_condition. - def enterFor_condition(self, ctx:CoreDSL2Parser.For_conditionContext): - pass - - # Exit a parse tree produced by CoreDSL2Parser#for_condition. - def exitFor_condition(self, ctx:CoreDSL2Parser.For_conditionContext): - pass - - - # Enter a parse tree produced by CoreDSL2Parser#declaration. - def enterDeclaration(self, ctx:CoreDSL2Parser.DeclarationContext): - pass - - # Exit a parse tree produced by CoreDSL2Parser#declaration. - def exitDeclaration(self, ctx:CoreDSL2Parser.DeclarationContext): - pass - - - # Enter a parse tree produced by CoreDSL2Parser#type_specifier. - def enterType_specifier(self, ctx:CoreDSL2Parser.Type_specifierContext): - pass - - # Exit a parse tree produced by CoreDSL2Parser#type_specifier. - def exitType_specifier(self, ctx:CoreDSL2Parser.Type_specifierContext): - pass - - - # Enter a parse tree produced by CoreDSL2Parser#integer_type. - def enterInteger_type(self, ctx:CoreDSL2Parser.Integer_typeContext): - pass - - # Exit a parse tree produced by CoreDSL2Parser#integer_type. - def exitInteger_type(self, ctx:CoreDSL2Parser.Integer_typeContext): - pass - - - # Enter a parse tree produced by CoreDSL2Parser#float_type. - def enterFloat_type(self, ctx:CoreDSL2Parser.Float_typeContext): - pass - - # Exit a parse tree produced by CoreDSL2Parser#float_type. - def exitFloat_type(self, ctx:CoreDSL2Parser.Float_typeContext): - pass - - - # Enter a parse tree produced by CoreDSL2Parser#bool_type. - def enterBool_type(self, ctx:CoreDSL2Parser.Bool_typeContext): - pass - - # Exit a parse tree produced by CoreDSL2Parser#bool_type. - def exitBool_type(self, ctx:CoreDSL2Parser.Bool_typeContext): - pass - - - # Enter a parse tree produced by CoreDSL2Parser#void_type. - def enterVoid_type(self, ctx:CoreDSL2Parser.Void_typeContext): - pass - - # Exit a parse tree produced by CoreDSL2Parser#void_type. - def exitVoid_type(self, ctx:CoreDSL2Parser.Void_typeContext): - pass - - - # Enter a parse tree produced by CoreDSL2Parser#composite_declaration. - def enterComposite_declaration(self, ctx:CoreDSL2Parser.Composite_declarationContext): - pass - - # Exit a parse tree produced by CoreDSL2Parser#composite_declaration. - def exitComposite_declaration(self, ctx:CoreDSL2Parser.Composite_declarationContext): - pass - - - # Enter a parse tree produced by CoreDSL2Parser#composite_reference. - def enterComposite_reference(self, ctx:CoreDSL2Parser.Composite_referenceContext): - pass - - # Exit a parse tree produced by CoreDSL2Parser#composite_reference. - def exitComposite_reference(self, ctx:CoreDSL2Parser.Composite_referenceContext): - pass - - - # Enter a parse tree produced by CoreDSL2Parser#enum_declaration. - def enterEnum_declaration(self, ctx:CoreDSL2Parser.Enum_declarationContext): - pass - - # Exit a parse tree produced by CoreDSL2Parser#enum_declaration. - def exitEnum_declaration(self, ctx:CoreDSL2Parser.Enum_declarationContext): - pass - - - # Enter a parse tree produced by CoreDSL2Parser#enum_reference. - def enterEnum_reference(self, ctx:CoreDSL2Parser.Enum_referenceContext): - pass - - # Exit a parse tree produced by CoreDSL2Parser#enum_reference. - def exitEnum_reference(self, ctx:CoreDSL2Parser.Enum_referenceContext): - pass - - - # Enter a parse tree produced by CoreDSL2Parser#integer_signedness. - def enterInteger_signedness(self, ctx:CoreDSL2Parser.Integer_signednessContext): - pass - - # Exit a parse tree produced by CoreDSL2Parser#integer_signedness. - def exitInteger_signedness(self, ctx:CoreDSL2Parser.Integer_signednessContext): - pass - - - # Enter a parse tree produced by CoreDSL2Parser#integer_shorthand. - def enterInteger_shorthand(self, ctx:CoreDSL2Parser.Integer_shorthandContext): - pass - - # Exit a parse tree produced by CoreDSL2Parser#integer_shorthand. - def exitInteger_shorthand(self, ctx:CoreDSL2Parser.Integer_shorthandContext): - pass - - - # Enter a parse tree produced by CoreDSL2Parser#float_shorthand. - def enterFloat_shorthand(self, ctx:CoreDSL2Parser.Float_shorthandContext): - pass - - # Exit a parse tree produced by CoreDSL2Parser#float_shorthand. - def exitFloat_shorthand(self, ctx:CoreDSL2Parser.Float_shorthandContext): - pass - - - # Enter a parse tree produced by CoreDSL2Parser#attribute. - def enterAttribute(self, ctx:CoreDSL2Parser.AttributeContext): - pass - - # Exit a parse tree produced by CoreDSL2Parser#attribute. - def exitAttribute(self, ctx:CoreDSL2Parser.AttributeContext): - pass - - - # Enter a parse tree produced by CoreDSL2Parser#bit_size_specifier. - def enterBit_size_specifier(self, ctx:CoreDSL2Parser.Bit_size_specifierContext): - pass - - # Exit a parse tree produced by CoreDSL2Parser#bit_size_specifier. - def exitBit_size_specifier(self, ctx:CoreDSL2Parser.Bit_size_specifierContext): - pass - - - # Enter a parse tree produced by CoreDSL2Parser#enumerator_list. - def enterEnumerator_list(self, ctx:CoreDSL2Parser.Enumerator_listContext): - pass - - # Exit a parse tree produced by CoreDSL2Parser#enumerator_list. - def exitEnumerator_list(self, ctx:CoreDSL2Parser.Enumerator_listContext): - pass - - - # Enter a parse tree produced by CoreDSL2Parser#enumerator. - def enterEnumerator(self, ctx:CoreDSL2Parser.EnumeratorContext): - pass - - # Exit a parse tree produced by CoreDSL2Parser#enumerator. - def exitEnumerator(self, ctx:CoreDSL2Parser.EnumeratorContext): - pass - - - # Enter a parse tree produced by CoreDSL2Parser#struct_declaration. - def enterStruct_declaration(self, ctx:CoreDSL2Parser.Struct_declarationContext): - pass - - # Exit a parse tree produced by CoreDSL2Parser#struct_declaration. - def exitStruct_declaration(self, ctx:CoreDSL2Parser.Struct_declarationContext): - pass - - - # Enter a parse tree produced by CoreDSL2Parser#struct_declaration_specifier. - def enterStruct_declaration_specifier(self, ctx:CoreDSL2Parser.Struct_declaration_specifierContext): - pass - - # Exit a parse tree produced by CoreDSL2Parser#struct_declaration_specifier. - def exitStruct_declaration_specifier(self, ctx:CoreDSL2Parser.Struct_declaration_specifierContext): - pass - - - # Enter a parse tree produced by CoreDSL2Parser#declarator. - def enterDeclarator(self, ctx:CoreDSL2Parser.DeclaratorContext): - pass - - # Exit a parse tree produced by CoreDSL2Parser#declarator. - def exitDeclarator(self, ctx:CoreDSL2Parser.DeclaratorContext): - pass - - - # Enter a parse tree produced by CoreDSL2Parser#initializer. - def enterInitializer(self, ctx:CoreDSL2Parser.InitializerContext): - pass - - # Exit a parse tree produced by CoreDSL2Parser#initializer. - def exitInitializer(self, ctx:CoreDSL2Parser.InitializerContext): - pass - - - # Enter a parse tree produced by CoreDSL2Parser#initializerList. - def enterInitializerList(self, ctx:CoreDSL2Parser.InitializerListContext): - pass - - # Exit a parse tree produced by CoreDSL2Parser#initializerList. - def exitInitializerList(self, ctx:CoreDSL2Parser.InitializerListContext): - pass - - - # Enter a parse tree produced by CoreDSL2Parser#designated_initializer. - def enterDesignated_initializer(self, ctx:CoreDSL2Parser.Designated_initializerContext): - pass - - # Exit a parse tree produced by CoreDSL2Parser#designated_initializer. - def exitDesignated_initializer(self, ctx:CoreDSL2Parser.Designated_initializerContext): - pass - - - # Enter a parse tree produced by CoreDSL2Parser#designator. - def enterDesignator(self, ctx:CoreDSL2Parser.DesignatorContext): - pass - - # Exit a parse tree produced by CoreDSL2Parser#designator. - def exitDesignator(self, ctx:CoreDSL2Parser.DesignatorContext): - pass - - - # Enter a parse tree produced by CoreDSL2Parser#cast_expression. - def enterCast_expression(self, ctx:CoreDSL2Parser.Cast_expressionContext): - pass - - # Exit a parse tree produced by CoreDSL2Parser#cast_expression. - def exitCast_expression(self, ctx:CoreDSL2Parser.Cast_expressionContext): - pass - - - # Enter a parse tree produced by CoreDSL2Parser#binary_expression. - def enterBinary_expression(self, ctx:CoreDSL2Parser.Binary_expressionContext): - pass - - # Exit a parse tree produced by CoreDSL2Parser#binary_expression. - def exitBinary_expression(self, ctx:CoreDSL2Parser.Binary_expressionContext): - pass - - - # Enter a parse tree produced by CoreDSL2Parser#preinc_expression. - def enterPreinc_expression(self, ctx:CoreDSL2Parser.Preinc_expressionContext): - pass - - # Exit a parse tree produced by CoreDSL2Parser#preinc_expression. - def exitPreinc_expression(self, ctx:CoreDSL2Parser.Preinc_expressionContext): - pass - - - # Enter a parse tree produced by CoreDSL2Parser#conditional_expression. - def enterConditional_expression(self, ctx:CoreDSL2Parser.Conditional_expressionContext): - pass - - # Exit a parse tree produced by CoreDSL2Parser#conditional_expression. - def exitConditional_expression(self, ctx:CoreDSL2Parser.Conditional_expressionContext): - pass - - - # Enter a parse tree produced by CoreDSL2Parser#deref_expression. - def enterDeref_expression(self, ctx:CoreDSL2Parser.Deref_expressionContext): - pass - - # Exit a parse tree produced by CoreDSL2Parser#deref_expression. - def exitDeref_expression(self, ctx:CoreDSL2Parser.Deref_expressionContext): - pass - - - # Enter a parse tree produced by CoreDSL2Parser#prefix_expression. - def enterPrefix_expression(self, ctx:CoreDSL2Parser.Prefix_expressionContext): - pass - - # Exit a parse tree produced by CoreDSL2Parser#prefix_expression. - def exitPrefix_expression(self, ctx:CoreDSL2Parser.Prefix_expressionContext): - pass - - - # Enter a parse tree produced by CoreDSL2Parser#postinc_expression. - def enterPostinc_expression(self, ctx:CoreDSL2Parser.Postinc_expressionContext): - pass - - # Exit a parse tree produced by CoreDSL2Parser#postinc_expression. - def exitPostinc_expression(self, ctx:CoreDSL2Parser.Postinc_expressionContext): - pass - - - # Enter a parse tree produced by CoreDSL2Parser#concat_expression. - def enterConcat_expression(self, ctx:CoreDSL2Parser.Concat_expressionContext): - pass - - # Exit a parse tree produced by CoreDSL2Parser#concat_expression. - def exitConcat_expression(self, ctx:CoreDSL2Parser.Concat_expressionContext): - pass - - - # Enter a parse tree produced by CoreDSL2Parser#assignment_expression. - def enterAssignment_expression(self, ctx:CoreDSL2Parser.Assignment_expressionContext): - pass - - # Exit a parse tree produced by CoreDSL2Parser#assignment_expression. - def exitAssignment_expression(self, ctx:CoreDSL2Parser.Assignment_expressionContext): - pass - - - # Enter a parse tree produced by CoreDSL2Parser#method_call. - def enterMethod_call(self, ctx:CoreDSL2Parser.Method_callContext): - pass - - # Exit a parse tree produced by CoreDSL2Parser#method_call. - def exitMethod_call(self, ctx:CoreDSL2Parser.Method_callContext): - pass - - - # Enter a parse tree produced by CoreDSL2Parser#primary_expression. - def enterPrimary_expression(self, ctx:CoreDSL2Parser.Primary_expressionContext): - pass - - # Exit a parse tree produced by CoreDSL2Parser#primary_expression. - def exitPrimary_expression(self, ctx:CoreDSL2Parser.Primary_expressionContext): - pass - - - # Enter a parse tree produced by CoreDSL2Parser#slice_expression. - def enterSlice_expression(self, ctx:CoreDSL2Parser.Slice_expressionContext): - pass - - # Exit a parse tree produced by CoreDSL2Parser#slice_expression. - def exitSlice_expression(self, ctx:CoreDSL2Parser.Slice_expressionContext): - pass - - - # Enter a parse tree produced by CoreDSL2Parser#reference_expression. - def enterReference_expression(self, ctx:CoreDSL2Parser.Reference_expressionContext): - pass - - # Exit a parse tree produced by CoreDSL2Parser#reference_expression. - def exitReference_expression(self, ctx:CoreDSL2Parser.Reference_expressionContext): - pass - - - # Enter a parse tree produced by CoreDSL2Parser#constant_expression. - def enterConstant_expression(self, ctx:CoreDSL2Parser.Constant_expressionContext): - pass - - # Exit a parse tree produced by CoreDSL2Parser#constant_expression. - def exitConstant_expression(self, ctx:CoreDSL2Parser.Constant_expressionContext): - pass - - - # Enter a parse tree produced by CoreDSL2Parser#literal_expression. - def enterLiteral_expression(self, ctx:CoreDSL2Parser.Literal_expressionContext): - pass - - # Exit a parse tree produced by CoreDSL2Parser#literal_expression. - def exitLiteral_expression(self, ctx:CoreDSL2Parser.Literal_expressionContext): - pass - - - # Enter a parse tree produced by CoreDSL2Parser#parens_expression. - def enterParens_expression(self, ctx:CoreDSL2Parser.Parens_expressionContext): - pass - - # Exit a parse tree produced by CoreDSL2Parser#parens_expression. - def exitParens_expression(self, ctx:CoreDSL2Parser.Parens_expressionContext): - pass - - - # Enter a parse tree produced by CoreDSL2Parser#string_literal. - def enterString_literal(self, ctx:CoreDSL2Parser.String_literalContext): - pass - - # Exit a parse tree produced by CoreDSL2Parser#string_literal. - def exitString_literal(self, ctx:CoreDSL2Parser.String_literalContext): - pass - - - # Enter a parse tree produced by CoreDSL2Parser#constant. - def enterConstant(self, ctx:CoreDSL2Parser.ConstantContext): - pass - - # Exit a parse tree produced by CoreDSL2Parser#constant. - def exitConstant(self, ctx:CoreDSL2Parser.ConstantContext): - pass - - - # Enter a parse tree produced by CoreDSL2Parser#integer_constant. - def enterInteger_constant(self, ctx:CoreDSL2Parser.Integer_constantContext): - pass - - # Exit a parse tree produced by CoreDSL2Parser#integer_constant. - def exitInteger_constant(self, ctx:CoreDSL2Parser.Integer_constantContext): - pass - - - # Enter a parse tree produced by CoreDSL2Parser#floating_constant. - def enterFloating_constant(self, ctx:CoreDSL2Parser.Floating_constantContext): - pass - - # Exit a parse tree produced by CoreDSL2Parser#floating_constant. - def exitFloating_constant(self, ctx:CoreDSL2Parser.Floating_constantContext): - pass - - - # Enter a parse tree produced by CoreDSL2Parser#bool_constant. - def enterBool_constant(self, ctx:CoreDSL2Parser.Bool_constantContext): - pass - - # Exit a parse tree produced by CoreDSL2Parser#bool_constant. - def exitBool_constant(self, ctx:CoreDSL2Parser.Bool_constantContext): - pass - - - # Enter a parse tree produced by CoreDSL2Parser#character_constant. - def enterCharacter_constant(self, ctx:CoreDSL2Parser.Character_constantContext): - pass - - # Exit a parse tree produced by CoreDSL2Parser#character_constant. - def exitCharacter_constant(self, ctx:CoreDSL2Parser.Character_constantContext): - pass - - - # Enter a parse tree produced by CoreDSL2Parser#string_constant. - def enterString_constant(self, ctx:CoreDSL2Parser.String_constantContext): - pass - - # Exit a parse tree produced by CoreDSL2Parser#string_constant. - def exitString_constant(self, ctx:CoreDSL2Parser.String_constantContext): - pass - - - # Enter a parse tree produced by CoreDSL2Parser#double_left_bracket. - def enterDouble_left_bracket(self, ctx:CoreDSL2Parser.Double_left_bracketContext): - pass - - # Exit a parse tree produced by CoreDSL2Parser#double_left_bracket. - def exitDouble_left_bracket(self, ctx:CoreDSL2Parser.Double_left_bracketContext): - pass - - - # Enter a parse tree produced by CoreDSL2Parser#double_right_bracket. - def enterDouble_right_bracket(self, ctx:CoreDSL2Parser.Double_right_bracketContext): - pass - - # Exit a parse tree produced by CoreDSL2Parser#double_right_bracket. - def exitDouble_right_bracket(self, ctx:CoreDSL2Parser.Double_right_bracketContext): - pass - - - # Enter a parse tree produced by CoreDSL2Parser#data_types. - def enterData_types(self, ctx:CoreDSL2Parser.Data_typesContext): - pass - - # Exit a parse tree produced by CoreDSL2Parser#data_types. - def exitData_types(self, ctx:CoreDSL2Parser.Data_typesContext): - pass - - - # Enter a parse tree produced by CoreDSL2Parser#type_qualifier. - def enterType_qualifier(self, ctx:CoreDSL2Parser.Type_qualifierContext): - pass - - # Exit a parse tree produced by CoreDSL2Parser#type_qualifier. - def exitType_qualifier(self, ctx:CoreDSL2Parser.Type_qualifierContext): - pass - - - # Enter a parse tree produced by CoreDSL2Parser#storage_class_specifier. - def enterStorage_class_specifier(self, ctx:CoreDSL2Parser.Storage_class_specifierContext): - pass - - # Exit a parse tree produced by CoreDSL2Parser#storage_class_specifier. - def exitStorage_class_specifier(self, ctx:CoreDSL2Parser.Storage_class_specifierContext): - pass - - - # Enter a parse tree produced by CoreDSL2Parser#struct_or_union. - def enterStruct_or_union(self, ctx:CoreDSL2Parser.Struct_or_unionContext): - pass - - # Exit a parse tree produced by CoreDSL2Parser#struct_or_union. - def exitStruct_or_union(self, ctx:CoreDSL2Parser.Struct_or_unionContext): - pass - - - -del CoreDSL2Parser \ No newline at end of file diff --git a/m2isar/frontends/coredsl2_set/parser_gen/CoreDSL2Parser.py b/m2isar/frontends/coredsl2_set/parser_gen/CoreDSL2Parser.py deleted file mode 100644 index 1c04f497..00000000 --- a/m2isar/frontends/coredsl2_set/parser_gen/CoreDSL2Parser.py +++ /dev/null @@ -1,6376 +0,0 @@ -# Generated from ../coredsl2/CoreDSL2.g4 by ANTLR 4.13.1 -# encoding: utf-8 -from antlr4 import * -from io import StringIO -import sys -if sys.version_info[1] > 5: - from typing import TextIO -else: - from typing.io import TextIO - -def serializedATN(): - return [ - 4,1,102,797,2,0,7,0,2,1,7,1,2,2,7,2,2,3,7,3,2,4,7,4,2,5,7,5,2,6, - 7,6,2,7,7,7,2,8,7,8,2,9,7,9,2,10,7,10,2,11,7,11,2,12,7,12,2,13,7, - 13,2,14,7,14,2,15,7,15,2,16,7,16,2,17,7,17,2,18,7,18,2,19,7,19,2, - 20,7,20,2,21,7,21,2,22,7,22,2,23,7,23,2,24,7,24,2,25,7,25,2,26,7, - 26,2,27,7,27,2,28,7,28,2,29,7,29,2,30,7,30,2,31,7,31,2,32,7,32,2, - 33,7,33,2,34,7,34,2,35,7,35,2,36,7,36,2,37,7,37,2,38,7,38,2,39,7, - 39,2,40,7,40,2,41,7,41,2,42,7,42,2,43,7,43,2,44,7,44,2,45,7,45,2, - 46,7,46,2,47,7,47,2,48,7,48,1,0,5,0,100,8,0,10,0,12,0,103,9,0,1, - 0,4,0,106,8,0,11,0,12,0,107,1,1,1,1,1,1,1,2,1,2,1,2,1,2,1,2,1,2, - 5,2,119,8,2,10,2,12,2,122,9,2,3,2,124,8,2,1,2,1,2,5,2,128,8,2,10, - 2,12,2,131,9,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,5,2,140,8,2,10,2,12,2, - 143,9,2,3,2,145,8,2,1,2,1,2,5,2,149,8,2,10,2,12,2,152,9,2,1,2,3, - 2,155,8,2,1,3,1,3,1,3,1,3,1,3,1,3,4,3,163,8,3,11,3,12,3,164,1,3, - 1,3,1,3,1,3,1,3,5,3,172,8,3,10,3,12,3,175,9,3,1,3,1,3,1,3,5,3,180, - 8,3,10,3,12,3,183,9,3,1,3,1,3,5,3,187,8,3,10,3,12,3,190,9,3,1,3, - 1,3,1,3,5,3,195,8,3,10,3,12,3,198,9,3,1,3,1,3,4,3,202,8,3,11,3,12, - 3,203,1,3,1,3,3,3,208,8,3,1,4,1,4,5,4,212,8,4,10,4,12,4,215,9,4, - 1,4,1,4,1,5,1,5,5,5,221,8,5,10,5,12,5,224,9,5,1,5,1,5,1,5,1,5,1, - 5,1,5,5,5,232,8,5,10,5,12,5,235,9,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5, - 1,5,1,5,3,5,246,8,5,1,5,3,5,249,8,5,1,5,1,5,1,5,1,5,1,5,1,6,1,6, - 1,6,5,6,259,8,6,10,6,12,6,262,9,6,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1, - 7,3,7,272,8,7,1,8,1,8,1,8,1,8,1,8,3,8,279,8,8,1,8,1,8,5,8,283,8, - 8,10,8,12,8,286,9,8,1,8,1,8,1,8,1,8,1,8,1,8,3,8,294,8,8,1,8,1,8, - 5,8,298,8,8,10,8,12,8,301,9,8,1,8,1,8,3,8,305,8,8,3,8,307,8,8,1, - 9,1,9,1,9,5,9,312,8,9,10,9,12,9,315,9,9,1,10,1,10,3,10,319,8,10, - 1,11,1,11,1,11,1,11,1,11,1,11,5,11,327,8,11,10,11,12,11,330,9,11, - 3,11,332,8,11,1,11,1,11,1,11,1,11,1,11,1,11,1,11,1,11,1,11,1,11, - 1,11,1,11,1,11,1,11,5,11,348,8,11,10,11,12,11,351,9,11,1,11,1,11, - 3,11,355,8,11,1,11,1,11,1,11,1,11,1,11,1,11,1,11,1,11,1,11,1,11, - 1,11,1,11,1,11,1,11,1,11,1,11,1,11,1,11,1,11,1,11,1,11,1,11,1,11, - 1,11,1,11,1,11,5,11,383,8,11,10,11,12,11,386,9,11,1,11,5,11,389, - 8,11,10,11,12,11,392,9,11,1,11,1,11,1,11,1,11,3,11,398,8,11,1,11, - 1,11,1,11,1,11,1,11,1,11,1,11,1,11,1,11,1,11,3,11,410,8,11,1,12, - 4,12,413,8,12,11,12,12,12,414,1,12,4,12,418,8,12,11,12,12,12,419, - 1,13,1,13,1,13,1,13,1,13,1,13,3,13,428,8,13,1,14,1,14,5,14,432,8, - 14,10,14,12,14,435,9,14,1,14,1,14,1,15,1,15,3,15,441,8,15,1,16,1, - 16,3,16,445,8,16,1,16,3,16,448,8,16,1,16,3,16,451,8,16,1,16,1,16, - 1,16,1,16,5,16,457,8,16,10,16,12,16,460,9,16,3,16,462,8,16,1,17, - 1,17,1,17,5,17,467,8,17,10,17,12,17,470,9,17,1,17,1,17,1,17,1,17, - 5,17,476,8,17,10,17,12,17,479,9,17,3,17,481,8,17,1,17,1,17,1,18, - 1,18,1,18,3,18,488,8,18,1,19,1,19,1,19,1,19,1,19,1,19,3,19,496,8, - 19,1,19,1,19,1,19,1,19,1,19,1,19,3,19,504,8,19,1,19,1,19,5,19,508, - 8,19,10,19,12,19,511,9,19,1,19,1,19,1,19,1,19,1,19,1,19,1,19,3,19, - 520,8,19,1,19,1,19,1,19,3,19,525,8,19,1,19,1,19,1,19,1,19,3,19,531, - 8,19,1,20,1,20,1,21,1,21,1,22,1,22,1,23,1,23,1,23,1,23,1,23,1,23, - 1,23,1,23,5,23,547,8,23,10,23,12,23,550,9,23,1,23,1,23,3,23,554, - 8,23,1,23,1,23,1,24,1,24,1,24,1,24,1,24,1,24,1,24,1,24,1,24,3,24, - 567,8,24,1,24,1,24,1,25,1,25,1,25,5,25,574,8,25,10,25,12,25,577, - 9,25,1,26,1,26,1,26,1,26,3,26,583,8,26,1,27,1,27,1,27,1,27,5,27, - 589,8,27,10,27,12,27,592,9,27,1,27,1,27,1,28,1,28,3,28,598,8,28, - 1,29,1,29,1,29,1,29,1,29,5,29,605,8,29,10,29,12,29,608,9,29,1,29, - 5,29,611,8,29,10,29,12,29,614,9,29,1,29,1,29,3,29,618,8,29,1,30, - 1,30,1,30,1,30,3,30,624,8,30,1,30,1,30,3,30,628,8,30,1,31,1,31,3, - 31,632,8,31,1,31,1,31,1,31,3,31,637,8,31,5,31,639,8,31,10,31,12, - 31,642,9,31,1,32,4,32,645,8,32,11,32,12,32,646,1,32,1,32,1,32,1, - 33,1,33,1,33,1,33,1,33,1,33,3,33,658,8,33,1,34,1,34,1,34,1,34,1, - 34,1,34,1,34,1,34,1,34,5,34,669,8,34,10,34,12,34,672,9,34,3,34,674, - 8,34,1,34,1,34,1,34,1,34,1,34,1,34,1,34,1,34,1,34,1,34,3,34,686, - 8,34,1,34,1,34,1,34,3,34,691,8,34,1,34,1,34,1,34,1,34,1,34,1,34, - 1,34,1,34,1,34,1,34,1,34,1,34,1,34,1,34,1,34,1,34,1,34,1,34,1,34, - 1,34,1,34,1,34,1,34,1,34,1,34,1,34,1,34,1,34,1,34,1,34,1,34,1,34, - 1,34,1,34,1,34,1,34,1,34,1,34,1,34,1,34,1,34,1,34,1,34,1,34,1,34, - 1,34,1,34,3,34,740,8,34,1,34,1,34,1,34,1,34,5,34,746,8,34,10,34, - 12,34,749,9,34,1,35,1,35,1,35,4,35,754,8,35,11,35,12,35,755,1,35, - 1,35,1,35,1,35,3,35,762,8,35,1,36,1,36,1,37,1,37,1,37,1,37,1,37, - 3,37,771,8,37,1,38,1,38,1,39,1,39,1,40,1,40,1,41,1,41,1,42,1,42, - 1,43,1,43,1,43,1,44,1,44,1,44,1,45,1,45,1,46,1,46,1,47,1,47,1,48, - 1,48,1,48,0,1,68,49,0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32, - 34,36,38,40,42,44,46,48,50,52,54,56,58,60,62,64,66,68,70,72,74,76, - 78,80,82,84,86,88,90,92,94,96,0,18,1,0,41,42,1,0,43,46,1,0,47,48, - 1,0,52,53,1,0,54,55,2,0,34,35,56,57,1,0,58,59,2,0,34,34,60,61,1, - 0,56,57,1,0,62,63,2,0,36,37,64,65,1,0,66,67,2,0,50,50,73,83,1,0, - 98,99,3,0,38,39,41,48,84,84,1,0,85,86,2,0,19,19,87,88,1,0,89,90, - 880,0,101,1,0,0,0,2,109,1,0,0,0,4,154,1,0,0,0,6,207,1,0,0,0,8,209, - 1,0,0,0,10,218,1,0,0,0,12,255,1,0,0,0,14,271,1,0,0,0,16,306,1,0, - 0,0,18,308,1,0,0,0,20,316,1,0,0,0,22,409,1,0,0,0,24,412,1,0,0,0, - 26,427,1,0,0,0,28,429,1,0,0,0,30,440,1,0,0,0,32,447,1,0,0,0,34,468, - 1,0,0,0,36,484,1,0,0,0,38,530,1,0,0,0,40,532,1,0,0,0,42,534,1,0, - 0,0,44,536,1,0,0,0,46,538,1,0,0,0,48,557,1,0,0,0,50,570,1,0,0,0, - 52,582,1,0,0,0,54,584,1,0,0,0,56,597,1,0,0,0,58,599,1,0,0,0,60,627, - 1,0,0,0,62,631,1,0,0,0,64,644,1,0,0,0,66,657,1,0,0,0,68,690,1,0, - 0,0,70,761,1,0,0,0,72,763,1,0,0,0,74,770,1,0,0,0,76,772,1,0,0,0, - 78,774,1,0,0,0,80,776,1,0,0,0,82,778,1,0,0,0,84,780,1,0,0,0,86,782, - 1,0,0,0,88,785,1,0,0,0,90,788,1,0,0,0,92,790,1,0,0,0,94,792,1,0, - 0,0,96,794,1,0,0,0,98,100,3,2,1,0,99,98,1,0,0,0,100,103,1,0,0,0, - 101,99,1,0,0,0,101,102,1,0,0,0,102,105,1,0,0,0,103,101,1,0,0,0,104, - 106,3,4,2,0,105,104,1,0,0,0,106,107,1,0,0,0,107,105,1,0,0,0,107, - 108,1,0,0,0,108,1,1,0,0,0,109,110,5,1,0,0,110,111,5,99,0,0,111,3, - 1,0,0,0,112,113,5,2,0,0,113,123,5,96,0,0,114,115,5,3,0,0,115,120, - 5,96,0,0,116,117,5,4,0,0,117,119,5,96,0,0,118,116,1,0,0,0,119,122, - 1,0,0,0,120,118,1,0,0,0,120,121,1,0,0,0,121,124,1,0,0,0,122,120, - 1,0,0,0,123,114,1,0,0,0,123,124,1,0,0,0,124,125,1,0,0,0,125,129, - 5,5,0,0,126,128,3,6,3,0,127,126,1,0,0,0,128,131,1,0,0,0,129,127, - 1,0,0,0,129,130,1,0,0,0,130,132,1,0,0,0,131,129,1,0,0,0,132,155, - 5,6,0,0,133,134,5,7,0,0,134,144,5,96,0,0,135,136,5,8,0,0,136,141, - 5,96,0,0,137,138,5,4,0,0,138,140,5,96,0,0,139,137,1,0,0,0,140,143, - 1,0,0,0,141,139,1,0,0,0,141,142,1,0,0,0,142,145,1,0,0,0,143,141, - 1,0,0,0,144,135,1,0,0,0,144,145,1,0,0,0,145,146,1,0,0,0,146,150, - 5,5,0,0,147,149,3,6,3,0,148,147,1,0,0,0,149,152,1,0,0,0,150,148, - 1,0,0,0,150,151,1,0,0,0,151,153,1,0,0,0,152,150,1,0,0,0,153,155, - 5,6,0,0,154,112,1,0,0,0,154,133,1,0,0,0,155,5,1,0,0,0,156,157,5, - 9,0,0,157,162,5,5,0,0,158,163,3,34,17,0,159,160,3,68,34,0,160,161, - 5,10,0,0,161,163,1,0,0,0,162,158,1,0,0,0,162,159,1,0,0,0,163,164, - 1,0,0,0,164,162,1,0,0,0,164,165,1,0,0,0,165,166,1,0,0,0,166,167, - 5,6,0,0,167,208,1,0,0,0,168,169,5,11,0,0,169,173,5,5,0,0,170,172, - 3,16,8,0,171,170,1,0,0,0,172,175,1,0,0,0,173,171,1,0,0,0,173,174, - 1,0,0,0,174,176,1,0,0,0,175,173,1,0,0,0,176,208,5,6,0,0,177,181, - 5,12,0,0,178,180,3,46,23,0,179,178,1,0,0,0,180,183,1,0,0,0,181,179, - 1,0,0,0,181,182,1,0,0,0,182,184,1,0,0,0,183,181,1,0,0,0,184,188, - 5,5,0,0,185,187,3,10,5,0,186,185,1,0,0,0,187,190,1,0,0,0,188,186, - 1,0,0,0,188,189,1,0,0,0,189,191,1,0,0,0,190,188,1,0,0,0,191,208, - 5,6,0,0,192,196,5,13,0,0,193,195,3,46,23,0,194,193,1,0,0,0,195,198, - 1,0,0,0,196,194,1,0,0,0,196,197,1,0,0,0,197,199,1,0,0,0,198,196, - 1,0,0,0,199,201,5,5,0,0,200,202,3,8,4,0,201,200,1,0,0,0,202,203, - 1,0,0,0,203,201,1,0,0,0,203,204,1,0,0,0,204,205,1,0,0,0,205,206, - 5,6,0,0,206,208,1,0,0,0,207,156,1,0,0,0,207,168,1,0,0,0,207,177, - 1,0,0,0,207,192,1,0,0,0,208,7,1,0,0,0,209,213,5,96,0,0,210,212,3, - 46,23,0,211,210,1,0,0,0,212,215,1,0,0,0,213,211,1,0,0,0,213,214, - 1,0,0,0,214,216,1,0,0,0,215,213,1,0,0,0,216,217,3,28,14,0,217,9, - 1,0,0,0,218,222,5,96,0,0,219,221,3,46,23,0,220,219,1,0,0,0,221,224, - 1,0,0,0,222,220,1,0,0,0,222,223,1,0,0,0,223,225,1,0,0,0,224,222, - 1,0,0,0,225,226,5,5,0,0,226,227,5,14,0,0,227,228,5,15,0,0,228,233, - 3,14,7,0,229,230,5,16,0,0,230,232,3,14,7,0,231,229,1,0,0,0,232,235, - 1,0,0,0,233,231,1,0,0,0,233,234,1,0,0,0,234,236,1,0,0,0,235,233, - 1,0,0,0,236,248,5,10,0,0,237,238,5,17,0,0,238,245,5,15,0,0,239,246, - 5,99,0,0,240,241,5,5,0,0,241,242,5,99,0,0,242,243,5,4,0,0,243,244, - 5,99,0,0,244,246,5,6,0,0,245,239,1,0,0,0,245,240,1,0,0,0,246,247, - 1,0,0,0,247,249,5,10,0,0,248,237,1,0,0,0,248,249,1,0,0,0,249,250, - 1,0,0,0,250,251,5,18,0,0,251,252,5,15,0,0,252,253,3,22,11,0,253, - 254,5,6,0,0,254,11,1,0,0,0,255,260,3,14,7,0,256,257,5,16,0,0,257, - 259,3,14,7,0,258,256,1,0,0,0,259,262,1,0,0,0,260,258,1,0,0,0,260, - 261,1,0,0,0,261,13,1,0,0,0,262,260,1,0,0,0,263,272,3,76,38,0,264, - 265,5,96,0,0,265,266,5,91,0,0,266,267,3,76,38,0,267,268,5,15,0,0, - 268,269,3,76,38,0,269,270,5,92,0,0,270,272,1,0,0,0,271,263,1,0,0, - 0,271,264,1,0,0,0,272,15,1,0,0,0,273,274,5,19,0,0,274,275,3,36,18, - 0,275,276,5,96,0,0,276,278,5,20,0,0,277,279,3,18,9,0,278,277,1,0, - 0,0,278,279,1,0,0,0,279,280,1,0,0,0,280,284,5,21,0,0,281,283,3,46, - 23,0,282,281,1,0,0,0,283,286,1,0,0,0,284,282,1,0,0,0,284,285,1,0, - 0,0,285,287,1,0,0,0,286,284,1,0,0,0,287,288,5,10,0,0,288,307,1,0, - 0,0,289,290,3,36,18,0,290,291,5,96,0,0,291,293,5,20,0,0,292,294, - 3,18,9,0,293,292,1,0,0,0,293,294,1,0,0,0,294,295,1,0,0,0,295,299, - 5,21,0,0,296,298,3,46,23,0,297,296,1,0,0,0,298,301,1,0,0,0,299,297, - 1,0,0,0,299,300,1,0,0,0,300,304,1,0,0,0,301,299,1,0,0,0,302,305, - 3,28,14,0,303,305,5,10,0,0,304,302,1,0,0,0,304,303,1,0,0,0,305,307, - 1,0,0,0,306,273,1,0,0,0,306,289,1,0,0,0,307,17,1,0,0,0,308,313,3, - 20,10,0,309,310,5,4,0,0,310,312,3,20,10,0,311,309,1,0,0,0,312,315, - 1,0,0,0,313,311,1,0,0,0,313,314,1,0,0,0,314,19,1,0,0,0,315,313,1, - 0,0,0,316,318,3,36,18,0,317,319,3,58,29,0,318,317,1,0,0,0,318,319, - 1,0,0,0,319,21,1,0,0,0,320,410,3,28,14,0,321,322,5,96,0,0,322,331, - 5,20,0,0,323,328,3,68,34,0,324,325,5,4,0,0,325,327,3,68,34,0,326, - 324,1,0,0,0,327,330,1,0,0,0,328,326,1,0,0,0,328,329,1,0,0,0,329, - 332,1,0,0,0,330,328,1,0,0,0,331,323,1,0,0,0,331,332,1,0,0,0,332, - 333,1,0,0,0,333,334,5,21,0,0,334,410,5,10,0,0,335,336,5,22,0,0,336, - 337,5,20,0,0,337,338,3,68,34,0,338,339,5,21,0,0,339,349,3,22,11, - 0,340,341,5,23,0,0,341,342,5,22,0,0,342,343,5,20,0,0,343,344,3,68, - 34,0,344,345,5,21,0,0,345,346,3,22,11,0,346,348,1,0,0,0,347,340, - 1,0,0,0,348,351,1,0,0,0,349,347,1,0,0,0,349,350,1,0,0,0,350,354, - 1,0,0,0,351,349,1,0,0,0,352,353,5,23,0,0,353,355,3,22,11,0,354,352, - 1,0,0,0,354,355,1,0,0,0,355,410,1,0,0,0,356,357,5,24,0,0,357,358, - 5,20,0,0,358,359,3,32,16,0,359,360,5,21,0,0,360,361,3,22,11,0,361, - 410,1,0,0,0,362,363,5,25,0,0,363,364,5,20,0,0,364,365,3,68,34,0, - 365,366,5,21,0,0,366,367,3,22,11,0,367,410,1,0,0,0,368,369,5,26, - 0,0,369,370,3,22,11,0,370,371,5,25,0,0,371,372,5,20,0,0,372,373, - 3,68,34,0,373,374,5,21,0,0,374,375,5,10,0,0,375,410,1,0,0,0,376, - 377,5,27,0,0,377,378,5,20,0,0,378,379,3,68,34,0,379,380,5,21,0,0, - 380,384,5,5,0,0,381,383,3,24,12,0,382,381,1,0,0,0,383,386,1,0,0, - 0,384,382,1,0,0,0,384,385,1,0,0,0,385,390,1,0,0,0,386,384,1,0,0, - 0,387,389,3,26,13,0,388,387,1,0,0,0,389,392,1,0,0,0,390,388,1,0, - 0,0,390,391,1,0,0,0,391,393,1,0,0,0,392,390,1,0,0,0,393,394,5,6, - 0,0,394,410,1,0,0,0,395,397,5,28,0,0,396,398,3,68,34,0,397,396,1, - 0,0,0,397,398,1,0,0,0,398,399,1,0,0,0,399,410,5,10,0,0,400,401,5, - 29,0,0,401,410,5,10,0,0,402,403,5,30,0,0,403,410,5,10,0,0,404,405, - 5,31,0,0,405,410,3,22,11,0,406,407,3,68,34,0,407,408,5,10,0,0,408, - 410,1,0,0,0,409,320,1,0,0,0,409,321,1,0,0,0,409,335,1,0,0,0,409, - 356,1,0,0,0,409,362,1,0,0,0,409,368,1,0,0,0,409,376,1,0,0,0,409, - 395,1,0,0,0,409,400,1,0,0,0,409,402,1,0,0,0,409,404,1,0,0,0,409, - 406,1,0,0,0,410,23,1,0,0,0,411,413,3,26,13,0,412,411,1,0,0,0,413, - 414,1,0,0,0,414,412,1,0,0,0,414,415,1,0,0,0,415,417,1,0,0,0,416, - 418,3,22,11,0,417,416,1,0,0,0,418,419,1,0,0,0,419,417,1,0,0,0,419, - 420,1,0,0,0,420,25,1,0,0,0,421,422,5,32,0,0,422,423,3,68,34,0,423, - 424,5,15,0,0,424,428,1,0,0,0,425,426,5,33,0,0,426,428,5,15,0,0,427, - 421,1,0,0,0,427,425,1,0,0,0,428,27,1,0,0,0,429,433,5,5,0,0,430,432, - 3,30,15,0,431,430,1,0,0,0,432,435,1,0,0,0,433,431,1,0,0,0,433,434, - 1,0,0,0,434,436,1,0,0,0,435,433,1,0,0,0,436,437,5,6,0,0,437,29,1, - 0,0,0,438,441,3,22,11,0,439,441,3,34,17,0,440,438,1,0,0,0,440,439, - 1,0,0,0,441,31,1,0,0,0,442,448,3,34,17,0,443,445,3,68,34,0,444,443, - 1,0,0,0,444,445,1,0,0,0,445,446,1,0,0,0,446,448,5,10,0,0,447,442, - 1,0,0,0,447,444,1,0,0,0,448,450,1,0,0,0,449,451,3,68,34,0,450,449, - 1,0,0,0,450,451,1,0,0,0,451,452,1,0,0,0,452,461,5,10,0,0,453,458, - 3,68,34,0,454,455,5,4,0,0,455,457,3,68,34,0,456,454,1,0,0,0,457, - 460,1,0,0,0,458,456,1,0,0,0,458,459,1,0,0,0,459,462,1,0,0,0,460, - 458,1,0,0,0,461,453,1,0,0,0,461,462,1,0,0,0,462,33,1,0,0,0,463,467, - 3,94,47,0,464,467,3,92,46,0,465,467,3,46,23,0,466,463,1,0,0,0,466, - 464,1,0,0,0,466,465,1,0,0,0,467,470,1,0,0,0,468,466,1,0,0,0,468, - 469,1,0,0,0,469,471,1,0,0,0,470,468,1,0,0,0,471,480,3,36,18,0,472, - 477,3,58,29,0,473,474,5,4,0,0,474,476,3,58,29,0,475,473,1,0,0,0, - 476,479,1,0,0,0,477,475,1,0,0,0,477,478,1,0,0,0,478,481,1,0,0,0, - 479,477,1,0,0,0,480,472,1,0,0,0,480,481,1,0,0,0,481,482,1,0,0,0, - 482,483,5,10,0,0,483,35,1,0,0,0,484,487,3,38,19,0,485,488,5,34,0, - 0,486,488,5,35,0,0,487,485,1,0,0,0,487,486,1,0,0,0,487,488,1,0,0, - 0,488,37,1,0,0,0,489,495,3,40,20,0,490,496,3,42,21,0,491,492,5,36, - 0,0,492,493,3,70,35,0,493,494,5,37,0,0,494,496,1,0,0,0,495,490,1, - 0,0,0,495,491,1,0,0,0,496,531,1,0,0,0,497,531,3,42,21,0,498,531, - 3,44,22,0,499,531,5,38,0,0,500,531,5,39,0,0,501,503,3,96,48,0,502, - 504,5,96,0,0,503,502,1,0,0,0,503,504,1,0,0,0,504,505,1,0,0,0,505, - 509,5,5,0,0,506,508,3,54,27,0,507,506,1,0,0,0,508,511,1,0,0,0,509, - 507,1,0,0,0,509,510,1,0,0,0,510,512,1,0,0,0,511,509,1,0,0,0,512, - 513,5,6,0,0,513,531,1,0,0,0,514,515,3,96,48,0,515,516,5,96,0,0,516, - 531,1,0,0,0,517,519,5,40,0,0,518,520,5,96,0,0,519,518,1,0,0,0,519, - 520,1,0,0,0,520,521,1,0,0,0,521,522,5,5,0,0,522,524,3,50,25,0,523, - 525,5,4,0,0,524,523,1,0,0,0,524,525,1,0,0,0,525,526,1,0,0,0,526, - 527,5,6,0,0,527,531,1,0,0,0,528,529,5,40,0,0,529,531,5,96,0,0,530, - 489,1,0,0,0,530,497,1,0,0,0,530,498,1,0,0,0,530,499,1,0,0,0,530, - 500,1,0,0,0,530,501,1,0,0,0,530,514,1,0,0,0,530,517,1,0,0,0,530, - 528,1,0,0,0,531,39,1,0,0,0,532,533,7,0,0,0,533,41,1,0,0,0,534,535, - 7,1,0,0,535,43,1,0,0,0,536,537,7,2,0,0,537,45,1,0,0,0,538,539,5, - 49,0,0,539,553,5,96,0,0,540,541,5,50,0,0,541,554,3,68,34,0,542,543, - 5,20,0,0,543,548,3,68,34,0,544,545,5,4,0,0,545,547,3,68,34,0,546, - 544,1,0,0,0,547,550,1,0,0,0,548,546,1,0,0,0,548,549,1,0,0,0,549, - 551,1,0,0,0,550,548,1,0,0,0,551,552,5,21,0,0,552,554,1,0,0,0,553, - 540,1,0,0,0,553,542,1,0,0,0,553,554,1,0,0,0,554,555,1,0,0,0,555, - 556,5,51,0,0,556,47,1,0,0,0,557,558,5,36,0,0,558,566,3,70,35,0,559, - 560,5,4,0,0,560,561,3,70,35,0,561,562,5,4,0,0,562,563,3,70,35,0, - 563,564,5,4,0,0,564,565,3,70,35,0,565,567,1,0,0,0,566,559,1,0,0, - 0,566,567,1,0,0,0,567,568,1,0,0,0,568,569,5,37,0,0,569,49,1,0,0, - 0,570,575,3,52,26,0,571,572,5,4,0,0,572,574,3,52,26,0,573,571,1, - 0,0,0,574,577,1,0,0,0,575,573,1,0,0,0,575,576,1,0,0,0,576,51,1,0, - 0,0,577,575,1,0,0,0,578,583,5,96,0,0,579,580,5,96,0,0,580,581,5, - 50,0,0,581,583,3,68,34,0,582,578,1,0,0,0,582,579,1,0,0,0,583,53, - 1,0,0,0,584,585,3,56,28,0,585,590,3,58,29,0,586,587,5,4,0,0,587, - 589,3,58,29,0,588,586,1,0,0,0,589,592,1,0,0,0,590,588,1,0,0,0,590, - 591,1,0,0,0,591,593,1,0,0,0,592,590,1,0,0,0,593,594,5,10,0,0,594, - 55,1,0,0,0,595,598,3,36,18,0,596,598,3,92,46,0,597,595,1,0,0,0,597, - 596,1,0,0,0,598,57,1,0,0,0,599,606,5,96,0,0,600,601,5,91,0,0,601, - 602,3,68,34,0,602,603,5,92,0,0,603,605,1,0,0,0,604,600,1,0,0,0,605, - 608,1,0,0,0,606,604,1,0,0,0,606,607,1,0,0,0,607,612,1,0,0,0,608, - 606,1,0,0,0,609,611,3,46,23,0,610,609,1,0,0,0,611,614,1,0,0,0,612, - 610,1,0,0,0,612,613,1,0,0,0,613,617,1,0,0,0,614,612,1,0,0,0,615, - 616,5,50,0,0,616,618,3,60,30,0,617,615,1,0,0,0,617,618,1,0,0,0,618, - 59,1,0,0,0,619,628,3,68,34,0,620,621,5,5,0,0,621,623,3,62,31,0,622, - 624,5,4,0,0,623,622,1,0,0,0,623,624,1,0,0,0,624,625,1,0,0,0,625, - 626,5,6,0,0,626,628,1,0,0,0,627,619,1,0,0,0,627,620,1,0,0,0,628, - 61,1,0,0,0,629,632,3,64,32,0,630,632,3,60,30,0,631,629,1,0,0,0,631, - 630,1,0,0,0,632,640,1,0,0,0,633,636,5,4,0,0,634,637,3,64,32,0,635, - 637,3,60,30,0,636,634,1,0,0,0,636,635,1,0,0,0,637,639,1,0,0,0,638, - 633,1,0,0,0,639,642,1,0,0,0,640,638,1,0,0,0,640,641,1,0,0,0,641, - 63,1,0,0,0,642,640,1,0,0,0,643,645,3,66,33,0,644,643,1,0,0,0,645, - 646,1,0,0,0,646,644,1,0,0,0,646,647,1,0,0,0,647,648,1,0,0,0,648, - 649,5,50,0,0,649,650,3,60,30,0,650,65,1,0,0,0,651,652,5,91,0,0,652, - 653,3,68,34,0,653,654,5,92,0,0,654,658,1,0,0,0,655,656,5,52,0,0, - 656,658,5,96,0,0,657,651,1,0,0,0,657,655,1,0,0,0,658,67,1,0,0,0, - 659,660,6,34,-1,0,660,691,3,70,35,0,661,662,7,3,0,0,662,691,5,96, - 0,0,663,664,5,96,0,0,664,673,5,20,0,0,665,670,3,68,34,0,666,667, - 5,4,0,0,667,669,3,68,34,0,668,666,1,0,0,0,669,672,1,0,0,0,670,668, - 1,0,0,0,670,671,1,0,0,0,671,674,1,0,0,0,672,670,1,0,0,0,673,665, - 1,0,0,0,673,674,1,0,0,0,674,675,1,0,0,0,675,691,5,21,0,0,676,677, - 7,4,0,0,677,691,3,68,34,17,678,679,7,5,0,0,679,691,3,68,34,16,680, - 681,7,6,0,0,681,691,3,68,34,15,682,685,5,20,0,0,683,686,3,36,18, - 0,684,686,3,40,20,0,685,683,1,0,0,0,685,684,1,0,0,0,686,687,1,0, - 0,0,687,688,5,21,0,0,688,689,3,68,34,14,689,691,1,0,0,0,690,659, - 1,0,0,0,690,661,1,0,0,0,690,663,1,0,0,0,690,676,1,0,0,0,690,678, - 1,0,0,0,690,680,1,0,0,0,690,682,1,0,0,0,691,747,1,0,0,0,692,693, - 10,13,0,0,693,694,7,7,0,0,694,746,3,68,34,14,695,696,10,12,0,0,696, - 697,7,8,0,0,697,746,3,68,34,13,698,699,10,11,0,0,699,700,7,9,0,0, - 700,746,3,68,34,12,701,702,10,10,0,0,702,703,7,10,0,0,703,746,3, - 68,34,11,704,705,10,9,0,0,705,706,7,11,0,0,706,746,3,68,34,10,707, - 708,10,8,0,0,708,709,5,35,0,0,709,746,3,68,34,9,710,711,10,7,0,0, - 711,712,5,68,0,0,712,746,3,68,34,8,713,714,10,6,0,0,714,715,5,69, - 0,0,715,746,3,68,34,7,716,717,10,5,0,0,717,718,5,70,0,0,718,746, - 3,68,34,6,719,720,10,4,0,0,720,721,5,71,0,0,721,746,3,68,34,5,722, - 723,10,3,0,0,723,724,5,16,0,0,724,746,3,68,34,4,725,726,10,2,0,0, - 726,727,5,72,0,0,727,728,3,68,34,0,728,729,5,15,0,0,729,730,3,68, - 34,2,730,746,1,0,0,0,731,732,10,1,0,0,732,733,7,12,0,0,733,746,3, - 68,34,1,734,735,10,20,0,0,735,736,5,91,0,0,736,739,3,68,34,0,737, - 738,5,15,0,0,738,740,3,68,34,0,739,737,1,0,0,0,739,740,1,0,0,0,740, - 741,1,0,0,0,741,742,5,92,0,0,742,746,1,0,0,0,743,744,10,18,0,0,744, - 746,7,4,0,0,745,692,1,0,0,0,745,695,1,0,0,0,745,698,1,0,0,0,745, - 701,1,0,0,0,745,704,1,0,0,0,745,707,1,0,0,0,745,710,1,0,0,0,745, - 713,1,0,0,0,745,716,1,0,0,0,745,719,1,0,0,0,745,722,1,0,0,0,745, - 725,1,0,0,0,745,731,1,0,0,0,745,734,1,0,0,0,745,743,1,0,0,0,746, - 749,1,0,0,0,747,745,1,0,0,0,747,748,1,0,0,0,748,69,1,0,0,0,749,747, - 1,0,0,0,750,762,5,96,0,0,751,762,3,74,37,0,752,754,3,72,36,0,753, - 752,1,0,0,0,754,755,1,0,0,0,755,753,1,0,0,0,755,756,1,0,0,0,756, - 762,1,0,0,0,757,758,5,20,0,0,758,759,3,68,34,0,759,760,5,21,0,0, - 760,762,1,0,0,0,761,750,1,0,0,0,761,751,1,0,0,0,761,753,1,0,0,0, - 761,757,1,0,0,0,762,71,1,0,0,0,763,764,7,13,0,0,764,73,1,0,0,0,765, - 771,3,76,38,0,766,771,3,78,39,0,767,771,3,82,41,0,768,771,3,84,42, - 0,769,771,3,80,40,0,770,765,1,0,0,0,770,766,1,0,0,0,770,767,1,0, - 0,0,770,768,1,0,0,0,770,769,1,0,0,0,771,75,1,0,0,0,772,773,5,95, - 0,0,773,77,1,0,0,0,774,775,5,94,0,0,775,79,1,0,0,0,776,777,5,93, - 0,0,777,81,1,0,0,0,778,779,5,97,0,0,779,83,1,0,0,0,780,781,5,99, - 0,0,781,85,1,0,0,0,782,783,5,91,0,0,783,784,5,91,0,0,784,87,1,0, - 0,0,785,786,5,92,0,0,786,787,5,92,0,0,787,89,1,0,0,0,788,789,7,14, - 0,0,789,91,1,0,0,0,790,791,7,15,0,0,791,93,1,0,0,0,792,793,7,16, - 0,0,793,95,1,0,0,0,794,795,7,17,0,0,795,97,1,0,0,0,88,101,107,120, - 123,129,141,144,150,154,162,164,173,181,188,196,203,207,213,222, - 233,245,248,260,271,278,284,293,299,304,306,313,318,328,331,349, - 354,384,390,397,409,414,419,427,433,440,444,447,450,458,461,466, - 468,477,480,487,495,503,509,519,524,530,548,553,566,575,582,590, - 597,606,612,617,623,627,631,636,640,646,657,670,673,685,690,739, - 745,747,755,761,770 - ] - -class CoreDSL2Parser ( Parser ): - - grammarFileName = "CoreDSL2.g4" - - atn = ATNDeserializer().deserialize(serializedATN()) - - decisionsToDFA = [ DFA(ds, i) for i, ds in enumerate(atn.decisionToState) ] - - sharedContextCache = PredictionContextCache() - - literalNames = [ "", "'import'", "'InstructionSet'", "'extends'", - "','", "'{'", "'}'", "'Core'", "'provides'", "'architectural_state'", - "';'", "'functions'", "'instructions'", "'always'", - "'encoding'", "':'", "'::'", "'assembly'", "'behavior'", - "'extern'", "'('", "')'", "'if'", "'else'", "'for'", - "'while'", "'do'", "'switch'", "'return'", "'break'", - "'continue'", "'spawn'", "'case'", "'default'", "'*'", - "'&'", "'<'", "'>'", "'bool'", "'void'", "'enum'", - "'unsigned'", "'signed'", "'char'", "'short'", "'int'", - "'long'", "'float'", "'double'", "'[['", "'='", "']]'", - "'.'", "'->'", "'++'", "'--'", "'+'", "'-'", "'~'", - "'!'", "'/'", "'%'", "'<<'", "'>>'", "'<='", "'>='", - "'=='", "'!='", "'^'", "'|'", "'&&'", "'||'", "'?'", - "'+='", "'-='", "'*='", "'/='", "'&='", "'|='", "'^='", - "'>>='", "'>>>='", "'<<='", "'%='", "'alias'", "'const'", - "'volatile'", "'static'", "'register'", "'struct'", - "'union'", "'['", "']'" ] - - symbolicNames = [ "", "", "", "", - "", "", "", "", - "", "", "", "", - "", "", "", "", - "", "", "", "", - "", "", "", "", - "", "", "", "", - "", "", "", "", - "", "", "", "", - "", "", "", "", - "", "", "", "", - "", "", "", "", - "", "", "", "", - "", "", "", "", - "", "", "", "", - "", "", "", "", - "", "", "", "", - "", "", "", "", - "", "", "", "", - "", "", "", "", - "", "", "", "", - "", "", "", "", - "", "", "", "LEFT_BR", - "RIGHT_BR", "BOOLEAN", "FLOAT", "INTEGER", "IDENTIFIER", - "CHARCONST", "ENCSTRINGCONST", "STRING", "ML_COMMENT", - "SL_COMMENT", "WS" ] - - RULE_description_content = 0 - RULE_import_file = 1 - RULE_isa = 2 - RULE_section = 3 - RULE_always_block = 4 - RULE_instruction = 5 - RULE_rule_encoding = 6 - RULE_encoding_entry = 7 - RULE_function_definition = 8 - RULE_parameter_list = 9 - RULE_parameter_declaration = 10 - RULE_statement = 11 - RULE_switch_block_statement_group = 12 - RULE_switch_label = 13 - RULE_block = 14 - RULE_block_item = 15 - RULE_for_condition = 16 - RULE_declaration = 17 - RULE_type_specifier = 18 - RULE_value_type_specifier = 19 - RULE_integer_signedness = 20 - RULE_integer_shorthand = 21 - RULE_float_shorthand = 22 - RULE_attribute = 23 - RULE_bit_size_specifier = 24 - RULE_enumerator_list = 25 - RULE_enumerator = 26 - RULE_struct_declaration = 27 - RULE_struct_declaration_specifier = 28 - RULE_declarator = 29 - RULE_initializer = 30 - RULE_initializerList = 31 - RULE_designated_initializer = 32 - RULE_designator = 33 - RULE_expression = 34 - RULE_primary = 35 - RULE_string_literal = 36 - RULE_constant = 37 - RULE_integer_constant = 38 - RULE_floating_constant = 39 - RULE_bool_constant = 40 - RULE_character_constant = 41 - RULE_string_constant = 42 - RULE_double_left_bracket = 43 - RULE_double_right_bracket = 44 - RULE_data_types = 45 - RULE_type_qualifier = 46 - RULE_storage_class_specifier = 47 - RULE_struct_or_union = 48 - - ruleNames = [ "description_content", "import_file", "isa", "section", - "always_block", "instruction", "rule_encoding", "encoding_entry", - "function_definition", "parameter_list", "parameter_declaration", - "statement", "switch_block_statement_group", "switch_label", - "block", "block_item", "for_condition", "declaration", - "type_specifier", "value_type_specifier", "integer_signedness", - "integer_shorthand", "float_shorthand", "attribute", - "bit_size_specifier", "enumerator_list", "enumerator", - "struct_declaration", "struct_declaration_specifier", - "declarator", "initializer", "initializerList", "designated_initializer", - "designator", "expression", "primary", "string_literal", - "constant", "integer_constant", "floating_constant", - "bool_constant", "character_constant", "string_constant", - "double_left_bracket", "double_right_bracket", "data_types", - "type_qualifier", "storage_class_specifier", "struct_or_union" ] - - EOF = Token.EOF - T__0=1 - T__1=2 - T__2=3 - T__3=4 - T__4=5 - T__5=6 - T__6=7 - T__7=8 - T__8=9 - T__9=10 - T__10=11 - T__11=12 - T__12=13 - T__13=14 - T__14=15 - T__15=16 - T__16=17 - T__17=18 - T__18=19 - T__19=20 - T__20=21 - T__21=22 - T__22=23 - T__23=24 - T__24=25 - T__25=26 - T__26=27 - T__27=28 - T__28=29 - T__29=30 - T__30=31 - T__31=32 - T__32=33 - T__33=34 - T__34=35 - T__35=36 - T__36=37 - T__37=38 - T__38=39 - T__39=40 - T__40=41 - T__41=42 - T__42=43 - T__43=44 - T__44=45 - T__45=46 - T__46=47 - T__47=48 - T__48=49 - T__49=50 - T__50=51 - T__51=52 - T__52=53 - T__53=54 - T__54=55 - T__55=56 - T__56=57 - T__57=58 - T__58=59 - T__59=60 - T__60=61 - T__61=62 - T__62=63 - T__63=64 - T__64=65 - T__65=66 - T__66=67 - T__67=68 - T__68=69 - T__69=70 - T__70=71 - T__71=72 - T__72=73 - T__73=74 - T__74=75 - T__75=76 - T__76=77 - T__77=78 - T__78=79 - T__79=80 - T__80=81 - T__81=82 - T__82=83 - T__83=84 - T__84=85 - T__85=86 - T__86=87 - T__87=88 - T__88=89 - T__89=90 - LEFT_BR=91 - RIGHT_BR=92 - BOOLEAN=93 - FLOAT=94 - INTEGER=95 - IDENTIFIER=96 - CHARCONST=97 - ENCSTRINGCONST=98 - STRING=99 - ML_COMMENT=100 - SL_COMMENT=101 - WS=102 - - def __init__(self, input:TokenStream, output:TextIO = sys.stdout): - super().__init__(input, output) - self.checkVersion("4.13.1") - self._interp = ParserATNSimulator(self, self.atn, self.decisionsToDFA, self.sharedContextCache) - self._predicates = None - - - - - class Description_contentContext(ParserRuleContext): - __slots__ = 'parser' - - def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): - super().__init__(parent, invokingState) - self.parser = parser - self._import_file = None # Import_fileContext - self.imports = list() # of Import_fileContexts - self._isa = None # IsaContext - self.definitions = list() # of IsaContexts - - def import_file(self, i:int=None): - if i is None: - return self.getTypedRuleContexts(CoreDSL2Parser.Import_fileContext) - else: - return self.getTypedRuleContext(CoreDSL2Parser.Import_fileContext,i) - - - def isa(self, i:int=None): - if i is None: - return self.getTypedRuleContexts(CoreDSL2Parser.IsaContext) - else: - return self.getTypedRuleContext(CoreDSL2Parser.IsaContext,i) - - - def getRuleIndex(self): - return CoreDSL2Parser.RULE_description_content - - def enterRule(self, listener:ParseTreeListener): - if hasattr( listener, "enterDescription_content" ): - listener.enterDescription_content(self) - - def exitRule(self, listener:ParseTreeListener): - if hasattr( listener, "exitDescription_content" ): - listener.exitDescription_content(self) - - def accept(self, visitor:ParseTreeVisitor): - if hasattr( visitor, "visitDescription_content" ): - return visitor.visitDescription_content(self) - else: - return visitor.visitChildren(self) - - - - - def description_content(self): - - localctx = CoreDSL2Parser.Description_contentContext(self, self._ctx, self.state) - self.enterRule(localctx, 0, self.RULE_description_content) - self._la = 0 # Token type - try: - self.enterOuterAlt(localctx, 1) - self.state = 101 - self._errHandler.sync(self) - _la = self._input.LA(1) - while _la==1: - self.state = 98 - localctx._import_file = self.import_file() - localctx.imports.append(localctx._import_file) - self.state = 103 - self._errHandler.sync(self) - _la = self._input.LA(1) - - self.state = 105 - self._errHandler.sync(self) - _la = self._input.LA(1) - while True: - self.state = 104 - localctx._isa = self.isa() - localctx.definitions.append(localctx._isa) - self.state = 107 - self._errHandler.sync(self) - _la = self._input.LA(1) - if not (_la==2 or _la==7): - break - - except RecognitionException as re: - localctx.exception = re - self._errHandler.reportError(self, re) - self._errHandler.recover(self, re) - finally: - self.exitRule() - return localctx - - - class Import_fileContext(ParserRuleContext): - __slots__ = 'parser' - - def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): - super().__init__(parent, invokingState) - self.parser = parser - self.uri = None # Token - - def STRING(self): - return self.getToken(CoreDSL2Parser.STRING, 0) - - def getRuleIndex(self): - return CoreDSL2Parser.RULE_import_file - - def enterRule(self, listener:ParseTreeListener): - if hasattr( listener, "enterImport_file" ): - listener.enterImport_file(self) - - def exitRule(self, listener:ParseTreeListener): - if hasattr( listener, "exitImport_file" ): - listener.exitImport_file(self) - - def accept(self, visitor:ParseTreeVisitor): - if hasattr( visitor, "visitImport_file" ): - return visitor.visitImport_file(self) - else: - return visitor.visitChildren(self) - - - - - def import_file(self): - - localctx = CoreDSL2Parser.Import_fileContext(self, self._ctx, self.state) - self.enterRule(localctx, 2, self.RULE_import_file) - try: - self.enterOuterAlt(localctx, 1) - self.state = 109 - self.match(CoreDSL2Parser.T__0) - self.state = 110 - localctx.uri = self.match(CoreDSL2Parser.STRING) - except RecognitionException as re: - localctx.exception = re - self._errHandler.reportError(self, re) - self._errHandler.recover(self, re) - finally: - self.exitRule() - return localctx - - - class IsaContext(ParserRuleContext): - __slots__ = 'parser' - - def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): - super().__init__(parent, invokingState) - self.parser = parser - - - def getRuleIndex(self): - return CoreDSL2Parser.RULE_isa - - - def copyFrom(self, ctx:ParserRuleContext): - super().copyFrom(ctx) - - - - class Instruction_setContext(IsaContext): - - def __init__(self, parser, ctx:ParserRuleContext): # actually a CoreDSL2Parser.IsaContext - super().__init__(parser) - self.name = None # Token - self._IDENTIFIER = None # Token - self.extension = list() # of Tokens - self._section = None # SectionContext - self.sections = list() # of SectionContexts - self.copyFrom(ctx) - - def IDENTIFIER(self, i:int=None): - if i is None: - return self.getTokens(CoreDSL2Parser.IDENTIFIER) - else: - return self.getToken(CoreDSL2Parser.IDENTIFIER, i) - def section(self, i:int=None): - if i is None: - return self.getTypedRuleContexts(CoreDSL2Parser.SectionContext) - else: - return self.getTypedRuleContext(CoreDSL2Parser.SectionContext,i) - - - def enterRule(self, listener:ParseTreeListener): - if hasattr( listener, "enterInstruction_set" ): - listener.enterInstruction_set(self) - - def exitRule(self, listener:ParseTreeListener): - if hasattr( listener, "exitInstruction_set" ): - listener.exitInstruction_set(self) - - def accept(self, visitor:ParseTreeVisitor): - if hasattr( visitor, "visitInstruction_set" ): - return visitor.visitInstruction_set(self) - else: - return visitor.visitChildren(self) - - - class Core_defContext(IsaContext): - - def __init__(self, parser, ctx:ParserRuleContext): # actually a CoreDSL2Parser.IsaContext - super().__init__(parser) - self.name = None # Token - self._IDENTIFIER = None # Token - self.contributing_types = list() # of Tokens - self._section = None # SectionContext - self.sections = list() # of SectionContexts - self.copyFrom(ctx) - - def IDENTIFIER(self, i:int=None): - if i is None: - return self.getTokens(CoreDSL2Parser.IDENTIFIER) - else: - return self.getToken(CoreDSL2Parser.IDENTIFIER, i) - def section(self, i:int=None): - if i is None: - return self.getTypedRuleContexts(CoreDSL2Parser.SectionContext) - else: - return self.getTypedRuleContext(CoreDSL2Parser.SectionContext,i) - - - def enterRule(self, listener:ParseTreeListener): - if hasattr( listener, "enterCore_def" ): - listener.enterCore_def(self) - - def exitRule(self, listener:ParseTreeListener): - if hasattr( listener, "exitCore_def" ): - listener.exitCore_def(self) - - def accept(self, visitor:ParseTreeVisitor): - if hasattr( visitor, "visitCore_def" ): - return visitor.visitCore_def(self) - else: - return visitor.visitChildren(self) - - - - def isa(self): - - localctx = CoreDSL2Parser.IsaContext(self, self._ctx, self.state) - self.enterRule(localctx, 4, self.RULE_isa) - self._la = 0 # Token type - try: - self.state = 154 - self._errHandler.sync(self) - token = self._input.LA(1) - if token in [2]: - localctx = CoreDSL2Parser.Instruction_setContext(self, localctx) - self.enterOuterAlt(localctx, 1) - self.state = 112 - self.match(CoreDSL2Parser.T__1) - self.state = 113 - localctx.name = self.match(CoreDSL2Parser.IDENTIFIER) - self.state = 123 - self._errHandler.sync(self) - _la = self._input.LA(1) - if _la==3: - self.state = 114 - self.match(CoreDSL2Parser.T__2) - self.state = 115 - localctx._IDENTIFIER = self.match(CoreDSL2Parser.IDENTIFIER) - localctx.extension.append(localctx._IDENTIFIER) - self.state = 120 - self._errHandler.sync(self) - _la = self._input.LA(1) - while _la==4: - self.state = 116 - self.match(CoreDSL2Parser.T__3) - self.state = 117 - localctx._IDENTIFIER = self.match(CoreDSL2Parser.IDENTIFIER) - localctx.extension.append(localctx._IDENTIFIER) - self.state = 122 - self._errHandler.sync(self) - _la = self._input.LA(1) - - - - self.state = 125 - self.match(CoreDSL2Parser.T__4) - self.state = 129 - self._errHandler.sync(self) - _la = self._input.LA(1) - while (((_la) & ~0x3f) == 0 and ((1 << _la) & 14848) != 0): - self.state = 126 - localctx._section = self.section() - localctx.sections.append(localctx._section) - self.state = 131 - self._errHandler.sync(self) - _la = self._input.LA(1) - - self.state = 132 - self.match(CoreDSL2Parser.T__5) - pass - elif token in [7]: - localctx = CoreDSL2Parser.Core_defContext(self, localctx) - self.enterOuterAlt(localctx, 2) - self.state = 133 - self.match(CoreDSL2Parser.T__6) - self.state = 134 - localctx.name = self.match(CoreDSL2Parser.IDENTIFIER) - self.state = 144 - self._errHandler.sync(self) - _la = self._input.LA(1) - if _la==8: - self.state = 135 - self.match(CoreDSL2Parser.T__7) - self.state = 136 - localctx._IDENTIFIER = self.match(CoreDSL2Parser.IDENTIFIER) - localctx.contributing_types.append(localctx._IDENTIFIER) - self.state = 141 - self._errHandler.sync(self) - _la = self._input.LA(1) - while _la==4: - self.state = 137 - self.match(CoreDSL2Parser.T__3) - self.state = 138 - localctx._IDENTIFIER = self.match(CoreDSL2Parser.IDENTIFIER) - localctx.contributing_types.append(localctx._IDENTIFIER) - self.state = 143 - self._errHandler.sync(self) - _la = self._input.LA(1) - - - - self.state = 146 - self.match(CoreDSL2Parser.T__4) - self.state = 150 - self._errHandler.sync(self) - _la = self._input.LA(1) - while (((_la) & ~0x3f) == 0 and ((1 << _la) & 14848) != 0): - self.state = 147 - localctx._section = self.section() - localctx.sections.append(localctx._section) - self.state = 152 - self._errHandler.sync(self) - _la = self._input.LA(1) - - self.state = 153 - self.match(CoreDSL2Parser.T__5) - pass - else: - raise NoViableAltException(self) - - except RecognitionException as re: - localctx.exception = re - self._errHandler.reportError(self, re) - self._errHandler.recover(self, re) - finally: - self.exitRule() - return localctx - - - class SectionContext(ParserRuleContext): - __slots__ = 'parser' - - def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): - super().__init__(parent, invokingState) - self.parser = parser - - - def getRuleIndex(self): - return CoreDSL2Parser.RULE_section - - - def copyFrom(self, ctx:ParserRuleContext): - super().copyFrom(ctx) - - - - class Section_instructionsContext(SectionContext): - - def __init__(self, parser, ctx:ParserRuleContext): # actually a CoreDSL2Parser.SectionContext - super().__init__(parser) - self.type_ = None # Token - self._attribute = None # AttributeContext - self.attributes = list() # of AttributeContexts - self._instruction = None # InstructionContext - self.instructions = list() # of InstructionContexts - self.copyFrom(ctx) - - def attribute(self, i:int=None): - if i is None: - return self.getTypedRuleContexts(CoreDSL2Parser.AttributeContext) - else: - return self.getTypedRuleContext(CoreDSL2Parser.AttributeContext,i) - - def instruction(self, i:int=None): - if i is None: - return self.getTypedRuleContexts(CoreDSL2Parser.InstructionContext) - else: - return self.getTypedRuleContext(CoreDSL2Parser.InstructionContext,i) - - - def enterRule(self, listener:ParseTreeListener): - if hasattr( listener, "enterSection_instructions" ): - listener.enterSection_instructions(self) - - def exitRule(self, listener:ParseTreeListener): - if hasattr( listener, "exitSection_instructions" ): - listener.exitSection_instructions(self) - - def accept(self, visitor:ParseTreeVisitor): - if hasattr( visitor, "visitSection_instructions" ): - return visitor.visitSection_instructions(self) - else: - return visitor.visitChildren(self) - - - class Section_alwaysContext(SectionContext): - - def __init__(self, parser, ctx:ParserRuleContext): # actually a CoreDSL2Parser.SectionContext - super().__init__(parser) - self.type_ = None # Token - self._attribute = None # AttributeContext - self.attributes = list() # of AttributeContexts - self._always_block = None # Always_blockContext - self.always_blocks = list() # of Always_blockContexts - self.copyFrom(ctx) - - def attribute(self, i:int=None): - if i is None: - return self.getTypedRuleContexts(CoreDSL2Parser.AttributeContext) - else: - return self.getTypedRuleContext(CoreDSL2Parser.AttributeContext,i) - - def always_block(self, i:int=None): - if i is None: - return self.getTypedRuleContexts(CoreDSL2Parser.Always_blockContext) - else: - return self.getTypedRuleContext(CoreDSL2Parser.Always_blockContext,i) - - - def enterRule(self, listener:ParseTreeListener): - if hasattr( listener, "enterSection_always" ): - listener.enterSection_always(self) - - def exitRule(self, listener:ParseTreeListener): - if hasattr( listener, "exitSection_always" ): - listener.exitSection_always(self) - - def accept(self, visitor:ParseTreeVisitor): - if hasattr( visitor, "visitSection_always" ): - return visitor.visitSection_always(self) - else: - return visitor.visitChildren(self) - - - class Section_functionsContext(SectionContext): - - def __init__(self, parser, ctx:ParserRuleContext): # actually a CoreDSL2Parser.SectionContext - super().__init__(parser) - self.type_ = None # Token - self._function_definition = None # Function_definitionContext - self.functions = list() # of Function_definitionContexts - self.copyFrom(ctx) - - def function_definition(self, i:int=None): - if i is None: - return self.getTypedRuleContexts(CoreDSL2Parser.Function_definitionContext) - else: - return self.getTypedRuleContext(CoreDSL2Parser.Function_definitionContext,i) - - - def enterRule(self, listener:ParseTreeListener): - if hasattr( listener, "enterSection_functions" ): - listener.enterSection_functions(self) - - def exitRule(self, listener:ParseTreeListener): - if hasattr( listener, "exitSection_functions" ): - listener.exitSection_functions(self) - - def accept(self, visitor:ParseTreeVisitor): - if hasattr( visitor, "visitSection_functions" ): - return visitor.visitSection_functions(self) - else: - return visitor.visitChildren(self) - - - class Section_arch_stateContext(SectionContext): - - def __init__(self, parser, ctx:ParserRuleContext): # actually a CoreDSL2Parser.SectionContext - super().__init__(parser) - self.type_ = None # Token - self._declaration = None # DeclarationContext - self.declarations = list() # of DeclarationContexts - self._expression = None # ExpressionContext - self.expressions = list() # of ExpressionContexts - self.copyFrom(ctx) - - def declaration(self, i:int=None): - if i is None: - return self.getTypedRuleContexts(CoreDSL2Parser.DeclarationContext) - else: - return self.getTypedRuleContext(CoreDSL2Parser.DeclarationContext,i) - - def expression(self, i:int=None): - if i is None: - return self.getTypedRuleContexts(CoreDSL2Parser.ExpressionContext) - else: - return self.getTypedRuleContext(CoreDSL2Parser.ExpressionContext,i) - - - def enterRule(self, listener:ParseTreeListener): - if hasattr( listener, "enterSection_arch_state" ): - listener.enterSection_arch_state(self) - - def exitRule(self, listener:ParseTreeListener): - if hasattr( listener, "exitSection_arch_state" ): - listener.exitSection_arch_state(self) - - def accept(self, visitor:ParseTreeVisitor): - if hasattr( visitor, "visitSection_arch_state" ): - return visitor.visitSection_arch_state(self) - else: - return visitor.visitChildren(self) - - - - def section(self): - - localctx = CoreDSL2Parser.SectionContext(self, self._ctx, self.state) - self.enterRule(localctx, 6, self.RULE_section) - self._la = 0 # Token type - try: - self.state = 207 - self._errHandler.sync(self) - token = self._input.LA(1) - if token in [9]: - localctx = CoreDSL2Parser.Section_arch_stateContext(self, localctx) - self.enterOuterAlt(localctx, 1) - self.state = 156 - localctx.type_ = self.match(CoreDSL2Parser.T__8) - self.state = 157 - self.match(CoreDSL2Parser.T__4) - self.state = 162 - self._errHandler.sync(self) - _la = self._input.LA(1) - while True: - self.state = 162 - self._errHandler.sync(self) - token = self._input.LA(1) - if token in [19, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 85, 86, 87, 88, 89, 90]: - self.state = 158 - localctx._declaration = self.declaration() - localctx.declarations.append(localctx._declaration) - pass - elif token in [20, 34, 35, 52, 53, 54, 55, 56, 57, 58, 59, 93, 94, 95, 96, 97, 98, 99]: - self.state = 159 - localctx._expression = self.expression(0) - localctx.expressions.append(localctx._expression) - self.state = 160 - self.match(CoreDSL2Parser.T__9) - pass - else: - raise NoViableAltException(self) - - self.state = 164 - self._errHandler.sync(self) - _la = self._input.LA(1) - if not ((((_la) & ~0x3f) == 0 and ((1 << _la) & 1149543581549592576) != 0) or ((((_la - 85)) & ~0x3f) == 0 and ((1 << (_la - 85)) & 32575) != 0)): - break - - self.state = 166 - self.match(CoreDSL2Parser.T__5) - pass - elif token in [11]: - localctx = CoreDSL2Parser.Section_functionsContext(self, localctx) - self.enterOuterAlt(localctx, 2) - self.state = 168 - localctx.type_ = self.match(CoreDSL2Parser.T__10) - self.state = 169 - self.match(CoreDSL2Parser.T__4) - self.state = 173 - self._errHandler.sync(self) - _la = self._input.LA(1) - while (((_la) & ~0x3f) == 0 and ((1 << _la) & 562675076038656) != 0) or _la==89 or _la==90: - self.state = 170 - localctx._function_definition = self.function_definition() - localctx.functions.append(localctx._function_definition) - self.state = 175 - self._errHandler.sync(self) - _la = self._input.LA(1) - - self.state = 176 - self.match(CoreDSL2Parser.T__5) - pass - elif token in [12]: - localctx = CoreDSL2Parser.Section_instructionsContext(self, localctx) - self.enterOuterAlt(localctx, 3) - self.state = 177 - localctx.type_ = self.match(CoreDSL2Parser.T__11) - self.state = 181 - self._errHandler.sync(self) - _la = self._input.LA(1) - while _la==49: - self.state = 178 - localctx._attribute = self.attribute() - localctx.attributes.append(localctx._attribute) - self.state = 183 - self._errHandler.sync(self) - _la = self._input.LA(1) - - self.state = 184 - self.match(CoreDSL2Parser.T__4) - self.state = 188 - self._errHandler.sync(self) - _la = self._input.LA(1) - while _la==96: - self.state = 185 - localctx._instruction = self.instruction() - localctx.instructions.append(localctx._instruction) - self.state = 190 - self._errHandler.sync(self) - _la = self._input.LA(1) - - self.state = 191 - self.match(CoreDSL2Parser.T__5) - pass - elif token in [13]: - localctx = CoreDSL2Parser.Section_alwaysContext(self, localctx) - self.enterOuterAlt(localctx, 4) - self.state = 192 - localctx.type_ = self.match(CoreDSL2Parser.T__12) - self.state = 196 - self._errHandler.sync(self) - _la = self._input.LA(1) - while _la==49: - self.state = 193 - localctx._attribute = self.attribute() - localctx.attributes.append(localctx._attribute) - self.state = 198 - self._errHandler.sync(self) - _la = self._input.LA(1) - - self.state = 199 - self.match(CoreDSL2Parser.T__4) - self.state = 201 - self._errHandler.sync(self) - _la = self._input.LA(1) - while True: - self.state = 200 - localctx._always_block = self.always_block() - localctx.always_blocks.append(localctx._always_block) - self.state = 203 - self._errHandler.sync(self) - _la = self._input.LA(1) - if not (_la==96): - break - - self.state = 205 - self.match(CoreDSL2Parser.T__5) - pass - else: - raise NoViableAltException(self) - - except RecognitionException as re: - localctx.exception = re - self._errHandler.reportError(self, re) - self._errHandler.recover(self, re) - finally: - self.exitRule() - return localctx - - - class Always_blockContext(ParserRuleContext): - __slots__ = 'parser' - - def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): - super().__init__(parent, invokingState) - self.parser = parser - self.name = None # Token - self._attribute = None # AttributeContext - self.attributes = list() # of AttributeContexts - self.behavior = None # BlockContext - - def IDENTIFIER(self): - return self.getToken(CoreDSL2Parser.IDENTIFIER, 0) - - def block(self): - return self.getTypedRuleContext(CoreDSL2Parser.BlockContext,0) - - - def attribute(self, i:int=None): - if i is None: - return self.getTypedRuleContexts(CoreDSL2Parser.AttributeContext) - else: - return self.getTypedRuleContext(CoreDSL2Parser.AttributeContext,i) - - - def getRuleIndex(self): - return CoreDSL2Parser.RULE_always_block - - def enterRule(self, listener:ParseTreeListener): - if hasattr( listener, "enterAlways_block" ): - listener.enterAlways_block(self) - - def exitRule(self, listener:ParseTreeListener): - if hasattr( listener, "exitAlways_block" ): - listener.exitAlways_block(self) - - def accept(self, visitor:ParseTreeVisitor): - if hasattr( visitor, "visitAlways_block" ): - return visitor.visitAlways_block(self) - else: - return visitor.visitChildren(self) - - - - - def always_block(self): - - localctx = CoreDSL2Parser.Always_blockContext(self, self._ctx, self.state) - self.enterRule(localctx, 8, self.RULE_always_block) - self._la = 0 # Token type - try: - self.enterOuterAlt(localctx, 1) - self.state = 209 - localctx.name = self.match(CoreDSL2Parser.IDENTIFIER) - self.state = 213 - self._errHandler.sync(self) - _la = self._input.LA(1) - while _la==49: - self.state = 210 - localctx._attribute = self.attribute() - localctx.attributes.append(localctx._attribute) - self.state = 215 - self._errHandler.sync(self) - _la = self._input.LA(1) - - self.state = 216 - localctx.behavior = self.block() - except RecognitionException as re: - localctx.exception = re - self._errHandler.reportError(self, re) - self._errHandler.recover(self, re) - finally: - self.exitRule() - return localctx - - - class InstructionContext(ParserRuleContext): - __slots__ = 'parser' - - def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): - super().__init__(parent, invokingState) - self.parser = parser - self.name = None # Token - self._attribute = None # AttributeContext - self.attributes = list() # of AttributeContexts - self._encoding_entry = None # Encoding_entryContext - self.encoding = list() # of Encoding_entryContexts - self.assembly = None # Token - self.mnemonic = None # Token - self.behavior = None # StatementContext - - def IDENTIFIER(self): - return self.getToken(CoreDSL2Parser.IDENTIFIER, 0) - - def encoding_entry(self, i:int=None): - if i is None: - return self.getTypedRuleContexts(CoreDSL2Parser.Encoding_entryContext) - else: - return self.getTypedRuleContext(CoreDSL2Parser.Encoding_entryContext,i) - - - def statement(self): - return self.getTypedRuleContext(CoreDSL2Parser.StatementContext,0) - - - def attribute(self, i:int=None): - if i is None: - return self.getTypedRuleContexts(CoreDSL2Parser.AttributeContext) - else: - return self.getTypedRuleContext(CoreDSL2Parser.AttributeContext,i) - - - def STRING(self, i:int=None): - if i is None: - return self.getTokens(CoreDSL2Parser.STRING) - else: - return self.getToken(CoreDSL2Parser.STRING, i) - - def getRuleIndex(self): - return CoreDSL2Parser.RULE_instruction - - def enterRule(self, listener:ParseTreeListener): - if hasattr( listener, "enterInstruction" ): - listener.enterInstruction(self) - - def exitRule(self, listener:ParseTreeListener): - if hasattr( listener, "exitInstruction" ): - listener.exitInstruction(self) - - def accept(self, visitor:ParseTreeVisitor): - if hasattr( visitor, "visitInstruction" ): - return visitor.visitInstruction(self) - else: - return visitor.visitChildren(self) - - - - - def instruction(self): - - localctx = CoreDSL2Parser.InstructionContext(self, self._ctx, self.state) - self.enterRule(localctx, 10, self.RULE_instruction) - self._la = 0 # Token type - try: - self.enterOuterAlt(localctx, 1) - self.state = 218 - localctx.name = self.match(CoreDSL2Parser.IDENTIFIER) - self.state = 222 - self._errHandler.sync(self) - _la = self._input.LA(1) - while _la==49: - self.state = 219 - localctx._attribute = self.attribute() - localctx.attributes.append(localctx._attribute) - self.state = 224 - self._errHandler.sync(self) - _la = self._input.LA(1) - - self.state = 225 - self.match(CoreDSL2Parser.T__4) - self.state = 226 - self.match(CoreDSL2Parser.T__13) - self.state = 227 - self.match(CoreDSL2Parser.T__14) - self.state = 228 - localctx._encoding_entry = self.encoding_entry() - localctx.encoding.append(localctx._encoding_entry) - self.state = 233 - self._errHandler.sync(self) - _la = self._input.LA(1) - while _la==16: - self.state = 229 - self.match(CoreDSL2Parser.T__15) - self.state = 230 - localctx._encoding_entry = self.encoding_entry() - localctx.encoding.append(localctx._encoding_entry) - self.state = 235 - self._errHandler.sync(self) - _la = self._input.LA(1) - - self.state = 236 - self.match(CoreDSL2Parser.T__9) - self.state = 248 - self._errHandler.sync(self) - _la = self._input.LA(1) - if _la==17: - self.state = 237 - self.match(CoreDSL2Parser.T__16) - self.state = 238 - self.match(CoreDSL2Parser.T__14) - self.state = 245 - self._errHandler.sync(self) - token = self._input.LA(1) - if token in [99]: - self.state = 239 - localctx.assembly = self.match(CoreDSL2Parser.STRING) - pass - elif token in [5]: - self.state = 240 - self.match(CoreDSL2Parser.T__4) - self.state = 241 - localctx.mnemonic = self.match(CoreDSL2Parser.STRING) - self.state = 242 - self.match(CoreDSL2Parser.T__3) - self.state = 243 - localctx.assembly = self.match(CoreDSL2Parser.STRING) - self.state = 244 - self.match(CoreDSL2Parser.T__5) - pass - else: - raise NoViableAltException(self) - - self.state = 247 - self.match(CoreDSL2Parser.T__9) - - - self.state = 250 - self.match(CoreDSL2Parser.T__17) - self.state = 251 - self.match(CoreDSL2Parser.T__14) - self.state = 252 - localctx.behavior = self.statement() - self.state = 253 - self.match(CoreDSL2Parser.T__5) - except RecognitionException as re: - localctx.exception = re - self._errHandler.reportError(self, re) - self._errHandler.recover(self, re) - finally: - self.exitRule() - return localctx - - - class Rule_encodingContext(ParserRuleContext): - __slots__ = 'parser' - - def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): - super().__init__(parent, invokingState) - self.parser = parser - self._encoding_entry = None # Encoding_entryContext - self.fields = list() # of Encoding_entryContexts - - def encoding_entry(self, i:int=None): - if i is None: - return self.getTypedRuleContexts(CoreDSL2Parser.Encoding_entryContext) - else: - return self.getTypedRuleContext(CoreDSL2Parser.Encoding_entryContext,i) - - - def getRuleIndex(self): - return CoreDSL2Parser.RULE_rule_encoding - - def enterRule(self, listener:ParseTreeListener): - if hasattr( listener, "enterRule_encoding" ): - listener.enterRule_encoding(self) - - def exitRule(self, listener:ParseTreeListener): - if hasattr( listener, "exitRule_encoding" ): - listener.exitRule_encoding(self) - - def accept(self, visitor:ParseTreeVisitor): - if hasattr( visitor, "visitRule_encoding" ): - return visitor.visitRule_encoding(self) - else: - return visitor.visitChildren(self) - - - - - def rule_encoding(self): - - localctx = CoreDSL2Parser.Rule_encodingContext(self, self._ctx, self.state) - self.enterRule(localctx, 12, self.RULE_rule_encoding) - self._la = 0 # Token type - try: - self.enterOuterAlt(localctx, 1) - self.state = 255 - localctx._encoding_entry = self.encoding_entry() - localctx.fields.append(localctx._encoding_entry) - self.state = 260 - self._errHandler.sync(self) - _la = self._input.LA(1) - while _la==16: - self.state = 256 - self.match(CoreDSL2Parser.T__15) - self.state = 257 - localctx._encoding_entry = self.encoding_entry() - localctx.fields.append(localctx._encoding_entry) - self.state = 262 - self._errHandler.sync(self) - _la = self._input.LA(1) - - except RecognitionException as re: - localctx.exception = re - self._errHandler.reportError(self, re) - self._errHandler.recover(self, re) - finally: - self.exitRule() - return localctx - - - class Encoding_entryContext(ParserRuleContext): - __slots__ = 'parser' - - def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): - super().__init__(parent, invokingState) - self.parser = parser - - - def getRuleIndex(self): - return CoreDSL2Parser.RULE_encoding_entry - - - def copyFrom(self, ctx:ParserRuleContext): - super().copyFrom(ctx) - - - - class Bit_fieldContext(Encoding_entryContext): - - def __init__(self, parser, ctx:ParserRuleContext): # actually a CoreDSL2Parser.Encoding_entryContext - super().__init__(parser) - self.name = None # Token - self.left = None # Integer_constantContext - self.right = None # Integer_constantContext - self.copyFrom(ctx) - - def LEFT_BR(self): - return self.getToken(CoreDSL2Parser.LEFT_BR, 0) - def RIGHT_BR(self): - return self.getToken(CoreDSL2Parser.RIGHT_BR, 0) - def IDENTIFIER(self): - return self.getToken(CoreDSL2Parser.IDENTIFIER, 0) - def integer_constant(self, i:int=None): - if i is None: - return self.getTypedRuleContexts(CoreDSL2Parser.Integer_constantContext) - else: - return self.getTypedRuleContext(CoreDSL2Parser.Integer_constantContext,i) - - - def enterRule(self, listener:ParseTreeListener): - if hasattr( listener, "enterBit_field" ): - listener.enterBit_field(self) - - def exitRule(self, listener:ParseTreeListener): - if hasattr( listener, "exitBit_field" ): - listener.exitBit_field(self) - - def accept(self, visitor:ParseTreeVisitor): - if hasattr( visitor, "visitBit_field" ): - return visitor.visitBit_field(self) - else: - return visitor.visitChildren(self) - - - class Bit_valueContext(Encoding_entryContext): - - def __init__(self, parser, ctx:ParserRuleContext): # actually a CoreDSL2Parser.Encoding_entryContext - super().__init__(parser) - self.value = None # Integer_constantContext - self.copyFrom(ctx) - - def integer_constant(self): - return self.getTypedRuleContext(CoreDSL2Parser.Integer_constantContext,0) - - - def enterRule(self, listener:ParseTreeListener): - if hasattr( listener, "enterBit_value" ): - listener.enterBit_value(self) - - def exitRule(self, listener:ParseTreeListener): - if hasattr( listener, "exitBit_value" ): - listener.exitBit_value(self) - - def accept(self, visitor:ParseTreeVisitor): - if hasattr( visitor, "visitBit_value" ): - return visitor.visitBit_value(self) - else: - return visitor.visitChildren(self) - - - - def encoding_entry(self): - - localctx = CoreDSL2Parser.Encoding_entryContext(self, self._ctx, self.state) - self.enterRule(localctx, 14, self.RULE_encoding_entry) - try: - self.state = 271 - self._errHandler.sync(self) - token = self._input.LA(1) - if token in [95]: - localctx = CoreDSL2Parser.Bit_valueContext(self, localctx) - self.enterOuterAlt(localctx, 1) - self.state = 263 - localctx.value = self.integer_constant() - pass - elif token in [96]: - localctx = CoreDSL2Parser.Bit_fieldContext(self, localctx) - self.enterOuterAlt(localctx, 2) - self.state = 264 - localctx.name = self.match(CoreDSL2Parser.IDENTIFIER) - self.state = 265 - self.match(CoreDSL2Parser.LEFT_BR) - self.state = 266 - localctx.left = self.integer_constant() - self.state = 267 - self.match(CoreDSL2Parser.T__14) - self.state = 268 - localctx.right = self.integer_constant() - self.state = 269 - self.match(CoreDSL2Parser.RIGHT_BR) - pass - else: - raise NoViableAltException(self) - - except RecognitionException as re: - localctx.exception = re - self._errHandler.reportError(self, re) - self._errHandler.recover(self, re) - finally: - self.exitRule() - return localctx - - - class Function_definitionContext(ParserRuleContext): - __slots__ = 'parser' - - def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): - super().__init__(parent, invokingState) - self.parser = parser - self.extern = None # Token - self.type_ = None # Type_specifierContext - self.name = None # Token - self.params = None # Parameter_listContext - self._attribute = None # AttributeContext - self.attributes = list() # of AttributeContexts - self.behavior = None # BlockContext - - def type_specifier(self): - return self.getTypedRuleContext(CoreDSL2Parser.Type_specifierContext,0) - - - def IDENTIFIER(self): - return self.getToken(CoreDSL2Parser.IDENTIFIER, 0) - - def parameter_list(self): - return self.getTypedRuleContext(CoreDSL2Parser.Parameter_listContext,0) - - - def attribute(self, i:int=None): - if i is None: - return self.getTypedRuleContexts(CoreDSL2Parser.AttributeContext) - else: - return self.getTypedRuleContext(CoreDSL2Parser.AttributeContext,i) - - - def block(self): - return self.getTypedRuleContext(CoreDSL2Parser.BlockContext,0) - - - def getRuleIndex(self): - return CoreDSL2Parser.RULE_function_definition - - def enterRule(self, listener:ParseTreeListener): - if hasattr( listener, "enterFunction_definition" ): - listener.enterFunction_definition(self) - - def exitRule(self, listener:ParseTreeListener): - if hasattr( listener, "exitFunction_definition" ): - listener.exitFunction_definition(self) - - def accept(self, visitor:ParseTreeVisitor): - if hasattr( visitor, "visitFunction_definition" ): - return visitor.visitFunction_definition(self) - else: - return visitor.visitChildren(self) - - - - - def function_definition(self): - - localctx = CoreDSL2Parser.Function_definitionContext(self, self._ctx, self.state) - self.enterRule(localctx, 16, self.RULE_function_definition) - self._la = 0 # Token type - try: - self.state = 306 - self._errHandler.sync(self) - token = self._input.LA(1) - if token in [19]: - self.enterOuterAlt(localctx, 1) - self.state = 273 - localctx.extern = self.match(CoreDSL2Parser.T__18) - self.state = 274 - localctx.type_ = self.type_specifier() - self.state = 275 - localctx.name = self.match(CoreDSL2Parser.IDENTIFIER) - self.state = 276 - self.match(CoreDSL2Parser.T__19) - self.state = 278 - self._errHandler.sync(self) - _la = self._input.LA(1) - if ((((_la - 38)) & ~0x3f) == 0 and ((1 << (_la - 38)) & 6755399441057791) != 0): - self.state = 277 - localctx.params = self.parameter_list() - - - self.state = 280 - self.match(CoreDSL2Parser.T__20) - self.state = 284 - self._errHandler.sync(self) - _la = self._input.LA(1) - while _la==49: - self.state = 281 - localctx._attribute = self.attribute() - localctx.attributes.append(localctx._attribute) - self.state = 286 - self._errHandler.sync(self) - _la = self._input.LA(1) - - self.state = 287 - self.match(CoreDSL2Parser.T__9) - pass - elif token in [38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 89, 90]: - self.enterOuterAlt(localctx, 2) - self.state = 289 - localctx.type_ = self.type_specifier() - self.state = 290 - localctx.name = self.match(CoreDSL2Parser.IDENTIFIER) - self.state = 291 - self.match(CoreDSL2Parser.T__19) - self.state = 293 - self._errHandler.sync(self) - _la = self._input.LA(1) - if ((((_la - 38)) & ~0x3f) == 0 and ((1 << (_la - 38)) & 6755399441057791) != 0): - self.state = 292 - localctx.params = self.parameter_list() - - - self.state = 295 - self.match(CoreDSL2Parser.T__20) - self.state = 299 - self._errHandler.sync(self) - _la = self._input.LA(1) - while _la==49: - self.state = 296 - localctx._attribute = self.attribute() - localctx.attributes.append(localctx._attribute) - self.state = 301 - self._errHandler.sync(self) - _la = self._input.LA(1) - - self.state = 304 - self._errHandler.sync(self) - token = self._input.LA(1) - if token in [5]: - self.state = 302 - localctx.behavior = self.block() - pass - elif token in [10]: - self.state = 303 - self.match(CoreDSL2Parser.T__9) - pass - else: - raise NoViableAltException(self) - - pass - else: - raise NoViableAltException(self) - - except RecognitionException as re: - localctx.exception = re - self._errHandler.reportError(self, re) - self._errHandler.recover(self, re) - finally: - self.exitRule() - return localctx - - - class Parameter_listContext(ParserRuleContext): - __slots__ = 'parser' - - def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): - super().__init__(parent, invokingState) - self.parser = parser - self._parameter_declaration = None # Parameter_declarationContext - self.params = list() # of Parameter_declarationContexts - - def parameter_declaration(self, i:int=None): - if i is None: - return self.getTypedRuleContexts(CoreDSL2Parser.Parameter_declarationContext) - else: - return self.getTypedRuleContext(CoreDSL2Parser.Parameter_declarationContext,i) - - - def getRuleIndex(self): - return CoreDSL2Parser.RULE_parameter_list - - def enterRule(self, listener:ParseTreeListener): - if hasattr( listener, "enterParameter_list" ): - listener.enterParameter_list(self) - - def exitRule(self, listener:ParseTreeListener): - if hasattr( listener, "exitParameter_list" ): - listener.exitParameter_list(self) - - def accept(self, visitor:ParseTreeVisitor): - if hasattr( visitor, "visitParameter_list" ): - return visitor.visitParameter_list(self) - else: - return visitor.visitChildren(self) - - - - - def parameter_list(self): - - localctx = CoreDSL2Parser.Parameter_listContext(self, self._ctx, self.state) - self.enterRule(localctx, 18, self.RULE_parameter_list) - self._la = 0 # Token type - try: - self.enterOuterAlt(localctx, 1) - self.state = 308 - localctx._parameter_declaration = self.parameter_declaration() - localctx.params.append(localctx._parameter_declaration) - self.state = 313 - self._errHandler.sync(self) - _la = self._input.LA(1) - while _la==4: - self.state = 309 - self.match(CoreDSL2Parser.T__3) - self.state = 310 - localctx._parameter_declaration = self.parameter_declaration() - localctx.params.append(localctx._parameter_declaration) - self.state = 315 - self._errHandler.sync(self) - _la = self._input.LA(1) - - except RecognitionException as re: - localctx.exception = re - self._errHandler.reportError(self, re) - self._errHandler.recover(self, re) - finally: - self.exitRule() - return localctx - - - class Parameter_declarationContext(ParserRuleContext): - __slots__ = 'parser' - - def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): - super().__init__(parent, invokingState) - self.parser = parser - self.type_ = None # Type_specifierContext - self.decl = None # DeclaratorContext - - def type_specifier(self): - return self.getTypedRuleContext(CoreDSL2Parser.Type_specifierContext,0) - - - def declarator(self): - return self.getTypedRuleContext(CoreDSL2Parser.DeclaratorContext,0) - - - def getRuleIndex(self): - return CoreDSL2Parser.RULE_parameter_declaration - - def enterRule(self, listener:ParseTreeListener): - if hasattr( listener, "enterParameter_declaration" ): - listener.enterParameter_declaration(self) - - def exitRule(self, listener:ParseTreeListener): - if hasattr( listener, "exitParameter_declaration" ): - listener.exitParameter_declaration(self) - - def accept(self, visitor:ParseTreeVisitor): - if hasattr( visitor, "visitParameter_declaration" ): - return visitor.visitParameter_declaration(self) - else: - return visitor.visitChildren(self) - - - - - def parameter_declaration(self): - - localctx = CoreDSL2Parser.Parameter_declarationContext(self, self._ctx, self.state) - self.enterRule(localctx, 20, self.RULE_parameter_declaration) - self._la = 0 # Token type - try: - self.enterOuterAlt(localctx, 1) - self.state = 316 - localctx.type_ = self.type_specifier() - self.state = 318 - self._errHandler.sync(self) - _la = self._input.LA(1) - if _la==96: - self.state = 317 - localctx.decl = self.declarator() - - - except RecognitionException as re: - localctx.exception = re - self._errHandler.reportError(self, re) - self._errHandler.recover(self, re) - finally: - self.exitRule() - return localctx - - - class StatementContext(ParserRuleContext): - __slots__ = 'parser' - - def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): - super().__init__(parent, invokingState) - self.parser = parser - - - def getRuleIndex(self): - return CoreDSL2Parser.RULE_statement - - - def copyFrom(self, ctx:ParserRuleContext): - super().copyFrom(ctx) - - - - class For_statementContext(StatementContext): - - def __init__(self, parser, ctx:ParserRuleContext): # actually a CoreDSL2Parser.StatementContext - super().__init__(parser) - self.type_ = None # Token - self.cond = None # For_conditionContext - self.stmt = None # StatementContext - self.copyFrom(ctx) - - def for_condition(self): - return self.getTypedRuleContext(CoreDSL2Parser.For_conditionContext,0) - - def statement(self): - return self.getTypedRuleContext(CoreDSL2Parser.StatementContext,0) - - - def enterRule(self, listener:ParseTreeListener): - if hasattr( listener, "enterFor_statement" ): - listener.enterFor_statement(self) - - def exitRule(self, listener:ParseTreeListener): - if hasattr( listener, "exitFor_statement" ): - listener.exitFor_statement(self) - - def accept(self, visitor:ParseTreeVisitor): - if hasattr( visitor, "visitFor_statement" ): - return visitor.visitFor_statement(self) - else: - return visitor.visitChildren(self) - - - class Spawn_statementContext(StatementContext): - - def __init__(self, parser, ctx:ParserRuleContext): # actually a CoreDSL2Parser.StatementContext - super().__init__(parser) - self.type_ = None # Token - self.stmt = None # StatementContext - self.copyFrom(ctx) - - def statement(self): - return self.getTypedRuleContext(CoreDSL2Parser.StatementContext,0) - - - def enterRule(self, listener:ParseTreeListener): - if hasattr( listener, "enterSpawn_statement" ): - listener.enterSpawn_statement(self) - - def exitRule(self, listener:ParseTreeListener): - if hasattr( listener, "exitSpawn_statement" ): - listener.exitSpawn_statement(self) - - def accept(self, visitor:ParseTreeVisitor): - if hasattr( visitor, "visitSpawn_statement" ): - return visitor.visitSpawn_statement(self) - else: - return visitor.visitChildren(self) - - - class Continue_statementContext(StatementContext): - - def __init__(self, parser, ctx:ParserRuleContext): # actually a CoreDSL2Parser.StatementContext - super().__init__(parser) - self.type_ = None # Token - self.copyFrom(ctx) - - - def enterRule(self, listener:ParseTreeListener): - if hasattr( listener, "enterContinue_statement" ): - listener.enterContinue_statement(self) - - def exitRule(self, listener:ParseTreeListener): - if hasattr( listener, "exitContinue_statement" ): - listener.exitContinue_statement(self) - - def accept(self, visitor:ParseTreeVisitor): - if hasattr( visitor, "visitContinue_statement" ): - return visitor.visitContinue_statement(self) - else: - return visitor.visitChildren(self) - - - class Expression_statementContext(StatementContext): - - def __init__(self, parser, ctx:ParserRuleContext): # actually a CoreDSL2Parser.StatementContext - super().__init__(parser) - self.expr = None # ExpressionContext - self.copyFrom(ctx) - - def expression(self): - return self.getTypedRuleContext(CoreDSL2Parser.ExpressionContext,0) - - - def enterRule(self, listener:ParseTreeListener): - if hasattr( listener, "enterExpression_statement" ): - listener.enterExpression_statement(self) - - def exitRule(self, listener:ParseTreeListener): - if hasattr( listener, "exitExpression_statement" ): - listener.exitExpression_statement(self) - - def accept(self, visitor:ParseTreeVisitor): - if hasattr( visitor, "visitExpression_statement" ): - return visitor.visitExpression_statement(self) - else: - return visitor.visitChildren(self) - - - class If_statementContext(StatementContext): - - def __init__(self, parser, ctx:ParserRuleContext): # actually a CoreDSL2Parser.StatementContext - super().__init__(parser) - self.type_ = None # Token - self._expression = None # ExpressionContext - self.cond = list() # of ExpressionContexts - self._statement = None # StatementContext - self.stmt = list() # of StatementContexts - self.copyFrom(ctx) - - def expression(self, i:int=None): - if i is None: - return self.getTypedRuleContexts(CoreDSL2Parser.ExpressionContext) - else: - return self.getTypedRuleContext(CoreDSL2Parser.ExpressionContext,i) - - def statement(self, i:int=None): - if i is None: - return self.getTypedRuleContexts(CoreDSL2Parser.StatementContext) - else: - return self.getTypedRuleContext(CoreDSL2Parser.StatementContext,i) - - - def enterRule(self, listener:ParseTreeListener): - if hasattr( listener, "enterIf_statement" ): - listener.enterIf_statement(self) - - def exitRule(self, listener:ParseTreeListener): - if hasattr( listener, "exitIf_statement" ): - listener.exitIf_statement(self) - - def accept(self, visitor:ParseTreeVisitor): - if hasattr( visitor, "visitIf_statement" ): - return visitor.visitIf_statement(self) - else: - return visitor.visitChildren(self) - - - class Procedure_callContext(StatementContext): - - def __init__(self, parser, ctx:ParserRuleContext): # actually a CoreDSL2Parser.StatementContext - super().__init__(parser) - self.ref = None # Token - self._expression = None # ExpressionContext - self.args = list() # of ExpressionContexts - self.copyFrom(ctx) - - def IDENTIFIER(self): - return self.getToken(CoreDSL2Parser.IDENTIFIER, 0) - def expression(self, i:int=None): - if i is None: - return self.getTypedRuleContexts(CoreDSL2Parser.ExpressionContext) - else: - return self.getTypedRuleContext(CoreDSL2Parser.ExpressionContext,i) - - - def enterRule(self, listener:ParseTreeListener): - if hasattr( listener, "enterProcedure_call" ): - listener.enterProcedure_call(self) - - def exitRule(self, listener:ParseTreeListener): - if hasattr( listener, "exitProcedure_call" ): - listener.exitProcedure_call(self) - - def accept(self, visitor:ParseTreeVisitor): - if hasattr( visitor, "visitProcedure_call" ): - return visitor.visitProcedure_call(self) - else: - return visitor.visitChildren(self) - - - class While_statementContext(StatementContext): - - def __init__(self, parser, ctx:ParserRuleContext): # actually a CoreDSL2Parser.StatementContext - super().__init__(parser) - self.type_ = None # Token - self.cond = None # ExpressionContext - self.stmt = None # StatementContext - self.copyFrom(ctx) - - def expression(self): - return self.getTypedRuleContext(CoreDSL2Parser.ExpressionContext,0) - - def statement(self): - return self.getTypedRuleContext(CoreDSL2Parser.StatementContext,0) - - - def enterRule(self, listener:ParseTreeListener): - if hasattr( listener, "enterWhile_statement" ): - listener.enterWhile_statement(self) - - def exitRule(self, listener:ParseTreeListener): - if hasattr( listener, "exitWhile_statement" ): - listener.exitWhile_statement(self) - - def accept(self, visitor:ParseTreeVisitor): - if hasattr( visitor, "visitWhile_statement" ): - return visitor.visitWhile_statement(self) - else: - return visitor.visitChildren(self) - - - class Switch_statementContext(StatementContext): - - def __init__(self, parser, ctx:ParserRuleContext): # actually a CoreDSL2Parser.StatementContext - super().__init__(parser) - self.type_ = None # Token - self.cond = None # ExpressionContext - self._switch_block_statement_group = None # Switch_block_statement_groupContext - self.items = list() # of Switch_block_statement_groupContexts - self.copyFrom(ctx) - - def expression(self): - return self.getTypedRuleContext(CoreDSL2Parser.ExpressionContext,0) - - def switch_label(self, i:int=None): - if i is None: - return self.getTypedRuleContexts(CoreDSL2Parser.Switch_labelContext) - else: - return self.getTypedRuleContext(CoreDSL2Parser.Switch_labelContext,i) - - def switch_block_statement_group(self, i:int=None): - if i is None: - return self.getTypedRuleContexts(CoreDSL2Parser.Switch_block_statement_groupContext) - else: - return self.getTypedRuleContext(CoreDSL2Parser.Switch_block_statement_groupContext,i) - - - def enterRule(self, listener:ParseTreeListener): - if hasattr( listener, "enterSwitch_statement" ): - listener.enterSwitch_statement(self) - - def exitRule(self, listener:ParseTreeListener): - if hasattr( listener, "exitSwitch_statement" ): - listener.exitSwitch_statement(self) - - def accept(self, visitor:ParseTreeVisitor): - if hasattr( visitor, "visitSwitch_statement" ): - return visitor.visitSwitch_statement(self) - else: - return visitor.visitChildren(self) - - - class Block_statementContext(StatementContext): - - def __init__(self, parser, ctx:ParserRuleContext): # actually a CoreDSL2Parser.StatementContext - super().__init__(parser) - self.copyFrom(ctx) - - def block(self): - return self.getTypedRuleContext(CoreDSL2Parser.BlockContext,0) - - - def enterRule(self, listener:ParseTreeListener): - if hasattr( listener, "enterBlock_statement" ): - listener.enterBlock_statement(self) - - def exitRule(self, listener:ParseTreeListener): - if hasattr( listener, "exitBlock_statement" ): - listener.exitBlock_statement(self) - - def accept(self, visitor:ParseTreeVisitor): - if hasattr( visitor, "visitBlock_statement" ): - return visitor.visitBlock_statement(self) - else: - return visitor.visitChildren(self) - - - class Do_statementContext(StatementContext): - - def __init__(self, parser, ctx:ParserRuleContext): # actually a CoreDSL2Parser.StatementContext - super().__init__(parser) - self.type_ = None # Token - self.stmt = None # StatementContext - self.cond = None # ExpressionContext - self.copyFrom(ctx) - - def statement(self): - return self.getTypedRuleContext(CoreDSL2Parser.StatementContext,0) - - def expression(self): - return self.getTypedRuleContext(CoreDSL2Parser.ExpressionContext,0) - - - def enterRule(self, listener:ParseTreeListener): - if hasattr( listener, "enterDo_statement" ): - listener.enterDo_statement(self) - - def exitRule(self, listener:ParseTreeListener): - if hasattr( listener, "exitDo_statement" ): - listener.exitDo_statement(self) - - def accept(self, visitor:ParseTreeVisitor): - if hasattr( visitor, "visitDo_statement" ): - return visitor.visitDo_statement(self) - else: - return visitor.visitChildren(self) - - - class Break_statementContext(StatementContext): - - def __init__(self, parser, ctx:ParserRuleContext): # actually a CoreDSL2Parser.StatementContext - super().__init__(parser) - self.type_ = None # Token - self.copyFrom(ctx) - - - def enterRule(self, listener:ParseTreeListener): - if hasattr( listener, "enterBreak_statement" ): - listener.enterBreak_statement(self) - - def exitRule(self, listener:ParseTreeListener): - if hasattr( listener, "exitBreak_statement" ): - listener.exitBreak_statement(self) - - def accept(self, visitor:ParseTreeVisitor): - if hasattr( visitor, "visitBreak_statement" ): - return visitor.visitBreak_statement(self) - else: - return visitor.visitChildren(self) - - - class Return_statementContext(StatementContext): - - def __init__(self, parser, ctx:ParserRuleContext): # actually a CoreDSL2Parser.StatementContext - super().__init__(parser) - self.type_ = None # Token - self.expr = None # ExpressionContext - self.copyFrom(ctx) - - def expression(self): - return self.getTypedRuleContext(CoreDSL2Parser.ExpressionContext,0) - - - def enterRule(self, listener:ParseTreeListener): - if hasattr( listener, "enterReturn_statement" ): - listener.enterReturn_statement(self) - - def exitRule(self, listener:ParseTreeListener): - if hasattr( listener, "exitReturn_statement" ): - listener.exitReturn_statement(self) - - def accept(self, visitor:ParseTreeVisitor): - if hasattr( visitor, "visitReturn_statement" ): - return visitor.visitReturn_statement(self) - else: - return visitor.visitChildren(self) - - - - def statement(self): - - localctx = CoreDSL2Parser.StatementContext(self, self._ctx, self.state) - self.enterRule(localctx, 22, self.RULE_statement) - self._la = 0 # Token type - try: - self.state = 409 - self._errHandler.sync(self) - la_ = self._interp.adaptivePredict(self._input,39,self._ctx) - if la_ == 1: - localctx = CoreDSL2Parser.Block_statementContext(self, localctx) - self.enterOuterAlt(localctx, 1) - self.state = 320 - self.block() - pass - - elif la_ == 2: - localctx = CoreDSL2Parser.Procedure_callContext(self, localctx) - self.enterOuterAlt(localctx, 2) - self.state = 321 - localctx.ref = self.match(CoreDSL2Parser.IDENTIFIER) - self.state = 322 - self.match(CoreDSL2Parser.T__19) - self.state = 331 - self._errHandler.sync(self) - _la = self._input.LA(1) - if (((_la) & ~0x3f) == 0 and ((1 << _la) & 1148417956520132608) != 0) or ((((_la - 93)) & ~0x3f) == 0 and ((1 << (_la - 93)) & 127) != 0): - self.state = 323 - localctx._expression = self.expression(0) - localctx.args.append(localctx._expression) - self.state = 328 - self._errHandler.sync(self) - _la = self._input.LA(1) - while _la==4: - self.state = 324 - self.match(CoreDSL2Parser.T__3) - self.state = 325 - localctx._expression = self.expression(0) - localctx.args.append(localctx._expression) - self.state = 330 - self._errHandler.sync(self) - _la = self._input.LA(1) - - - - self.state = 333 - self.match(CoreDSL2Parser.T__20) - self.state = 334 - self.match(CoreDSL2Parser.T__9) - pass - - elif la_ == 3: - localctx = CoreDSL2Parser.If_statementContext(self, localctx) - self.enterOuterAlt(localctx, 3) - self.state = 335 - localctx.type_ = self.match(CoreDSL2Parser.T__21) - self.state = 336 - self.match(CoreDSL2Parser.T__19) - self.state = 337 - localctx._expression = self.expression(0) - localctx.cond.append(localctx._expression) - self.state = 338 - self.match(CoreDSL2Parser.T__20) - self.state = 339 - localctx._statement = self.statement() - localctx.stmt.append(localctx._statement) - self.state = 349 - self._errHandler.sync(self) - _alt = self._interp.adaptivePredict(self._input,34,self._ctx) - while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER: - if _alt==1: - self.state = 340 - self.match(CoreDSL2Parser.T__22) - self.state = 341 - self.match(CoreDSL2Parser.T__21) - self.state = 342 - self.match(CoreDSL2Parser.T__19) - self.state = 343 - localctx._expression = self.expression(0) - localctx.cond.append(localctx._expression) - self.state = 344 - self.match(CoreDSL2Parser.T__20) - self.state = 345 - localctx._statement = self.statement() - localctx.stmt.append(localctx._statement) - self.state = 351 - self._errHandler.sync(self) - _alt = self._interp.adaptivePredict(self._input,34,self._ctx) - - self.state = 354 - self._errHandler.sync(self) - la_ = self._interp.adaptivePredict(self._input,35,self._ctx) - if la_ == 1: - self.state = 352 - self.match(CoreDSL2Parser.T__22) - self.state = 353 - localctx._statement = self.statement() - localctx.stmt.append(localctx._statement) - - - pass - - elif la_ == 4: - localctx = CoreDSL2Parser.For_statementContext(self, localctx) - self.enterOuterAlt(localctx, 4) - self.state = 356 - localctx.type_ = self.match(CoreDSL2Parser.T__23) - self.state = 357 - self.match(CoreDSL2Parser.T__19) - self.state = 358 - localctx.cond = self.for_condition() - self.state = 359 - self.match(CoreDSL2Parser.T__20) - self.state = 360 - localctx.stmt = self.statement() - pass - - elif la_ == 5: - localctx = CoreDSL2Parser.While_statementContext(self, localctx) - self.enterOuterAlt(localctx, 5) - self.state = 362 - localctx.type_ = self.match(CoreDSL2Parser.T__24) - self.state = 363 - self.match(CoreDSL2Parser.T__19) - self.state = 364 - localctx.cond = self.expression(0) - self.state = 365 - self.match(CoreDSL2Parser.T__20) - self.state = 366 - localctx.stmt = self.statement() - pass - - elif la_ == 6: - localctx = CoreDSL2Parser.Do_statementContext(self, localctx) - self.enterOuterAlt(localctx, 6) - self.state = 368 - localctx.type_ = self.match(CoreDSL2Parser.T__25) - self.state = 369 - localctx.stmt = self.statement() - self.state = 370 - self.match(CoreDSL2Parser.T__24) - self.state = 371 - self.match(CoreDSL2Parser.T__19) - self.state = 372 - localctx.cond = self.expression(0) - self.state = 373 - self.match(CoreDSL2Parser.T__20) - self.state = 374 - self.match(CoreDSL2Parser.T__9) - pass - - elif la_ == 7: - localctx = CoreDSL2Parser.Switch_statementContext(self, localctx) - self.enterOuterAlt(localctx, 7) - self.state = 376 - localctx.type_ = self.match(CoreDSL2Parser.T__26) - self.state = 377 - self.match(CoreDSL2Parser.T__19) - self.state = 378 - localctx.cond = self.expression(0) - self.state = 379 - self.match(CoreDSL2Parser.T__20) - self.state = 380 - self.match(CoreDSL2Parser.T__4) - self.state = 384 - self._errHandler.sync(self) - _alt = self._interp.adaptivePredict(self._input,36,self._ctx) - while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER: - if _alt==1: - self.state = 381 - localctx._switch_block_statement_group = self.switch_block_statement_group() - localctx.items.append(localctx._switch_block_statement_group) - self.state = 386 - self._errHandler.sync(self) - _alt = self._interp.adaptivePredict(self._input,36,self._ctx) - - self.state = 390 - self._errHandler.sync(self) - _la = self._input.LA(1) - while _la==32 or _la==33: - self.state = 387 - self.switch_label() - self.state = 392 - self._errHandler.sync(self) - _la = self._input.LA(1) - - self.state = 393 - self.match(CoreDSL2Parser.T__5) - pass - - elif la_ == 8: - localctx = CoreDSL2Parser.Return_statementContext(self, localctx) - self.enterOuterAlt(localctx, 8) - self.state = 395 - localctx.type_ = self.match(CoreDSL2Parser.T__27) - self.state = 397 - self._errHandler.sync(self) - _la = self._input.LA(1) - if (((_la) & ~0x3f) == 0 and ((1 << _la) & 1148417956520132608) != 0) or ((((_la - 93)) & ~0x3f) == 0 and ((1 << (_la - 93)) & 127) != 0): - self.state = 396 - localctx.expr = self.expression(0) - - - self.state = 399 - self.match(CoreDSL2Parser.T__9) - pass - - elif la_ == 9: - localctx = CoreDSL2Parser.Break_statementContext(self, localctx) - self.enterOuterAlt(localctx, 9) - self.state = 400 - localctx.type_ = self.match(CoreDSL2Parser.T__28) - self.state = 401 - self.match(CoreDSL2Parser.T__9) - pass - - elif la_ == 10: - localctx = CoreDSL2Parser.Continue_statementContext(self, localctx) - self.enterOuterAlt(localctx, 10) - self.state = 402 - localctx.type_ = self.match(CoreDSL2Parser.T__29) - self.state = 403 - self.match(CoreDSL2Parser.T__9) - pass - - elif la_ == 11: - localctx = CoreDSL2Parser.Spawn_statementContext(self, localctx) - self.enterOuterAlt(localctx, 11) - self.state = 404 - localctx.type_ = self.match(CoreDSL2Parser.T__30) - self.state = 405 - localctx.stmt = self.statement() - pass - - elif la_ == 12: - localctx = CoreDSL2Parser.Expression_statementContext(self, localctx) - self.enterOuterAlt(localctx, 12) - self.state = 406 - localctx.expr = self.expression(0) - self.state = 407 - self.match(CoreDSL2Parser.T__9) - pass - - - except RecognitionException as re: - localctx.exception = re - self._errHandler.reportError(self, re) - self._errHandler.recover(self, re) - finally: - self.exitRule() - return localctx - - - class Switch_block_statement_groupContext(ParserRuleContext): - __slots__ = 'parser' - - def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): - super().__init__(parent, invokingState) - self.parser = parser - self._switch_label = None # Switch_labelContext - self.labels = list() # of Switch_labelContexts - self._statement = None # StatementContext - self.statements = list() # of StatementContexts - - def switch_label(self, i:int=None): - if i is None: - return self.getTypedRuleContexts(CoreDSL2Parser.Switch_labelContext) - else: - return self.getTypedRuleContext(CoreDSL2Parser.Switch_labelContext,i) - - - def statement(self, i:int=None): - if i is None: - return self.getTypedRuleContexts(CoreDSL2Parser.StatementContext) - else: - return self.getTypedRuleContext(CoreDSL2Parser.StatementContext,i) - - - def getRuleIndex(self): - return CoreDSL2Parser.RULE_switch_block_statement_group - - def enterRule(self, listener:ParseTreeListener): - if hasattr( listener, "enterSwitch_block_statement_group" ): - listener.enterSwitch_block_statement_group(self) - - def exitRule(self, listener:ParseTreeListener): - if hasattr( listener, "exitSwitch_block_statement_group" ): - listener.exitSwitch_block_statement_group(self) - - def accept(self, visitor:ParseTreeVisitor): - if hasattr( visitor, "visitSwitch_block_statement_group" ): - return visitor.visitSwitch_block_statement_group(self) - else: - return visitor.visitChildren(self) - - - - - def switch_block_statement_group(self): - - localctx = CoreDSL2Parser.Switch_block_statement_groupContext(self, self._ctx, self.state) - self.enterRule(localctx, 24, self.RULE_switch_block_statement_group) - self._la = 0 # Token type - try: - self.enterOuterAlt(localctx, 1) - self.state = 412 - self._errHandler.sync(self) - _la = self._input.LA(1) - while True: - self.state = 411 - localctx._switch_label = self.switch_label() - localctx.labels.append(localctx._switch_label) - self.state = 414 - self._errHandler.sync(self) - _la = self._input.LA(1) - if not (_la==32 or _la==33): - break - - self.state = 417 - self._errHandler.sync(self) - _la = self._input.LA(1) - while True: - self.state = 416 - localctx._statement = self.statement() - localctx.statements.append(localctx._statement) - self.state = 419 - self._errHandler.sync(self) - _la = self._input.LA(1) - if not ((((_la) & ~0x3f) == 0 and ((1 << _la) & 1148417960802517024) != 0) or ((((_la - 93)) & ~0x3f) == 0 and ((1 << (_la - 93)) & 127) != 0)): - break - - except RecognitionException as re: - localctx.exception = re - self._errHandler.reportError(self, re) - self._errHandler.recover(self, re) - finally: - self.exitRule() - return localctx - - - class Switch_labelContext(ParserRuleContext): - __slots__ = 'parser' - - def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): - super().__init__(parent, invokingState) - self.parser = parser - self.const_expr = None # ExpressionContext - - def expression(self): - return self.getTypedRuleContext(CoreDSL2Parser.ExpressionContext,0) - - - def getRuleIndex(self): - return CoreDSL2Parser.RULE_switch_label - - def enterRule(self, listener:ParseTreeListener): - if hasattr( listener, "enterSwitch_label" ): - listener.enterSwitch_label(self) - - def exitRule(self, listener:ParseTreeListener): - if hasattr( listener, "exitSwitch_label" ): - listener.exitSwitch_label(self) - - def accept(self, visitor:ParseTreeVisitor): - if hasattr( visitor, "visitSwitch_label" ): - return visitor.visitSwitch_label(self) - else: - return visitor.visitChildren(self) - - - - - def switch_label(self): - - localctx = CoreDSL2Parser.Switch_labelContext(self, self._ctx, self.state) - self.enterRule(localctx, 26, self.RULE_switch_label) - try: - self.state = 427 - self._errHandler.sync(self) - token = self._input.LA(1) - if token in [32]: - self.enterOuterAlt(localctx, 1) - self.state = 421 - self.match(CoreDSL2Parser.T__31) - self.state = 422 - localctx.const_expr = self.expression(0) - self.state = 423 - self.match(CoreDSL2Parser.T__14) - pass - elif token in [33]: - self.enterOuterAlt(localctx, 2) - self.state = 425 - self.match(CoreDSL2Parser.T__32) - self.state = 426 - self.match(CoreDSL2Parser.T__14) - pass - else: - raise NoViableAltException(self) - - except RecognitionException as re: - localctx.exception = re - self._errHandler.reportError(self, re) - self._errHandler.recover(self, re) - finally: - self.exitRule() - return localctx - - - class BlockContext(ParserRuleContext): - __slots__ = 'parser' - - def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): - super().__init__(parent, invokingState) - self.parser = parser - self._block_item = None # Block_itemContext - self.items = list() # of Block_itemContexts - - def block_item(self, i:int=None): - if i is None: - return self.getTypedRuleContexts(CoreDSL2Parser.Block_itemContext) - else: - return self.getTypedRuleContext(CoreDSL2Parser.Block_itemContext,i) - - - def getRuleIndex(self): - return CoreDSL2Parser.RULE_block - - def enterRule(self, listener:ParseTreeListener): - if hasattr( listener, "enterBlock" ): - listener.enterBlock(self) - - def exitRule(self, listener:ParseTreeListener): - if hasattr( listener, "exitBlock" ): - listener.exitBlock(self) - - def accept(self, visitor:ParseTreeVisitor): - if hasattr( visitor, "visitBlock" ): - return visitor.visitBlock(self) - else: - return visitor.visitChildren(self) - - - - - def block(self): - - localctx = CoreDSL2Parser.BlockContext(self, self._ctx, self.state) - self.enterRule(localctx, 28, self.RULE_block) - self._la = 0 # Token type - try: - self.enterOuterAlt(localctx, 1) - self.state = 429 - self.match(CoreDSL2Parser.T__4) - self.state = 433 - self._errHandler.sync(self) - _la = self._input.LA(1) - while (((_la) & ~0x3f) == 0 and ((1 << _la) & 1149543585831976992) != 0) or ((((_la - 85)) & ~0x3f) == 0 and ((1 << (_la - 85)) & 32575) != 0): - self.state = 430 - localctx._block_item = self.block_item() - localctx.items.append(localctx._block_item) - self.state = 435 - self._errHandler.sync(self) - _la = self._input.LA(1) - - self.state = 436 - self.match(CoreDSL2Parser.T__5) - except RecognitionException as re: - localctx.exception = re - self._errHandler.reportError(self, re) - self._errHandler.recover(self, re) - finally: - self.exitRule() - return localctx - - - class Block_itemContext(ParserRuleContext): - __slots__ = 'parser' - - def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): - super().__init__(parent, invokingState) - self.parser = parser - - def statement(self): - return self.getTypedRuleContext(CoreDSL2Parser.StatementContext,0) - - - def declaration(self): - return self.getTypedRuleContext(CoreDSL2Parser.DeclarationContext,0) - - - def getRuleIndex(self): - return CoreDSL2Parser.RULE_block_item - - def enterRule(self, listener:ParseTreeListener): - if hasattr( listener, "enterBlock_item" ): - listener.enterBlock_item(self) - - def exitRule(self, listener:ParseTreeListener): - if hasattr( listener, "exitBlock_item" ): - listener.exitBlock_item(self) - - def accept(self, visitor:ParseTreeVisitor): - if hasattr( visitor, "visitBlock_item" ): - return visitor.visitBlock_item(self) - else: - return visitor.visitChildren(self) - - - - - def block_item(self): - - localctx = CoreDSL2Parser.Block_itemContext(self, self._ctx, self.state) - self.enterRule(localctx, 30, self.RULE_block_item) - try: - self.state = 440 - self._errHandler.sync(self) - token = self._input.LA(1) - if token in [5, 20, 22, 24, 25, 26, 27, 28, 29, 30, 31, 34, 35, 52, 53, 54, 55, 56, 57, 58, 59, 93, 94, 95, 96, 97, 98, 99]: - self.enterOuterAlt(localctx, 1) - self.state = 438 - self.statement() - pass - elif token in [19, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 85, 86, 87, 88, 89, 90]: - self.enterOuterAlt(localctx, 2) - self.state = 439 - self.declaration() - pass - else: - raise NoViableAltException(self) - - except RecognitionException as re: - localctx.exception = re - self._errHandler.reportError(self, re) - self._errHandler.recover(self, re) - finally: - self.exitRule() - return localctx - - - class For_conditionContext(ParserRuleContext): - __slots__ = 'parser' - - def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): - super().__init__(parent, invokingState) - self.parser = parser - self.start_decl = None # DeclarationContext - self.start_expr = None # ExpressionContext - self.end_expr = None # ExpressionContext - self._expression = None # ExpressionContext - self.loop_exprs = list() # of ExpressionContexts - - def declaration(self): - return self.getTypedRuleContext(CoreDSL2Parser.DeclarationContext,0) - - - def expression(self, i:int=None): - if i is None: - return self.getTypedRuleContexts(CoreDSL2Parser.ExpressionContext) - else: - return self.getTypedRuleContext(CoreDSL2Parser.ExpressionContext,i) - - - def getRuleIndex(self): - return CoreDSL2Parser.RULE_for_condition - - def enterRule(self, listener:ParseTreeListener): - if hasattr( listener, "enterFor_condition" ): - listener.enterFor_condition(self) - - def exitRule(self, listener:ParseTreeListener): - if hasattr( listener, "exitFor_condition" ): - listener.exitFor_condition(self) - - def accept(self, visitor:ParseTreeVisitor): - if hasattr( visitor, "visitFor_condition" ): - return visitor.visitFor_condition(self) - else: - return visitor.visitChildren(self) - - - - - def for_condition(self): - - localctx = CoreDSL2Parser.For_conditionContext(self, self._ctx, self.state) - self.enterRule(localctx, 32, self.RULE_for_condition) - self._la = 0 # Token type - try: - self.enterOuterAlt(localctx, 1) - self.state = 447 - self._errHandler.sync(self) - token = self._input.LA(1) - if token in [19, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 85, 86, 87, 88, 89, 90]: - self.state = 442 - localctx.start_decl = self.declaration() - pass - elif token in [10, 20, 34, 35, 52, 53, 54, 55, 56, 57, 58, 59, 93, 94, 95, 96, 97, 98, 99]: - self.state = 444 - self._errHandler.sync(self) - _la = self._input.LA(1) - if (((_la) & ~0x3f) == 0 and ((1 << _la) & 1148417956520132608) != 0) or ((((_la - 93)) & ~0x3f) == 0 and ((1 << (_la - 93)) & 127) != 0): - self.state = 443 - localctx.start_expr = self.expression(0) - - - self.state = 446 - self.match(CoreDSL2Parser.T__9) - pass - else: - raise NoViableAltException(self) - - self.state = 450 - self._errHandler.sync(self) - _la = self._input.LA(1) - if (((_la) & ~0x3f) == 0 and ((1 << _la) & 1148417956520132608) != 0) or ((((_la - 93)) & ~0x3f) == 0 and ((1 << (_la - 93)) & 127) != 0): - self.state = 449 - localctx.end_expr = self.expression(0) - - - self.state = 452 - self.match(CoreDSL2Parser.T__9) - self.state = 461 - self._errHandler.sync(self) - _la = self._input.LA(1) - if (((_la) & ~0x3f) == 0 and ((1 << _la) & 1148417956520132608) != 0) or ((((_la - 93)) & ~0x3f) == 0 and ((1 << (_la - 93)) & 127) != 0): - self.state = 453 - localctx._expression = self.expression(0) - localctx.loop_exprs.append(localctx._expression) - self.state = 458 - self._errHandler.sync(self) - _la = self._input.LA(1) - while _la==4: - self.state = 454 - self.match(CoreDSL2Parser.T__3) - self.state = 455 - localctx._expression = self.expression(0) - localctx.loop_exprs.append(localctx._expression) - self.state = 460 - self._errHandler.sync(self) - _la = self._input.LA(1) - - - - except RecognitionException as re: - localctx.exception = re - self._errHandler.reportError(self, re) - self._errHandler.recover(self, re) - finally: - self.exitRule() - return localctx - - - class DeclarationContext(ParserRuleContext): - __slots__ = 'parser' - - def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): - super().__init__(parent, invokingState) - self.parser = parser - self._storage_class_specifier = None # Storage_class_specifierContext - self.storage = list() # of Storage_class_specifierContexts - self._type_qualifier = None # Type_qualifierContext - self.qualifiers = list() # of Type_qualifierContexts - self._attribute = None # AttributeContext - self.attributes = list() # of AttributeContexts - self.type_ = None # Type_specifierContext - self._declarator = None # DeclaratorContext - self.declarations = list() # of DeclaratorContexts - - def type_specifier(self): - return self.getTypedRuleContext(CoreDSL2Parser.Type_specifierContext,0) - - - def storage_class_specifier(self, i:int=None): - if i is None: - return self.getTypedRuleContexts(CoreDSL2Parser.Storage_class_specifierContext) - else: - return self.getTypedRuleContext(CoreDSL2Parser.Storage_class_specifierContext,i) - - - def type_qualifier(self, i:int=None): - if i is None: - return self.getTypedRuleContexts(CoreDSL2Parser.Type_qualifierContext) - else: - return self.getTypedRuleContext(CoreDSL2Parser.Type_qualifierContext,i) - - - def attribute(self, i:int=None): - if i is None: - return self.getTypedRuleContexts(CoreDSL2Parser.AttributeContext) - else: - return self.getTypedRuleContext(CoreDSL2Parser.AttributeContext,i) - - - def declarator(self, i:int=None): - if i is None: - return self.getTypedRuleContexts(CoreDSL2Parser.DeclaratorContext) - else: - return self.getTypedRuleContext(CoreDSL2Parser.DeclaratorContext,i) - - - def getRuleIndex(self): - return CoreDSL2Parser.RULE_declaration - - def enterRule(self, listener:ParseTreeListener): - if hasattr( listener, "enterDeclaration" ): - listener.enterDeclaration(self) - - def exitRule(self, listener:ParseTreeListener): - if hasattr( listener, "exitDeclaration" ): - listener.exitDeclaration(self) - - def accept(self, visitor:ParseTreeVisitor): - if hasattr( visitor, "visitDeclaration" ): - return visitor.visitDeclaration(self) - else: - return visitor.visitChildren(self) - - - - - def declaration(self): - - localctx = CoreDSL2Parser.DeclarationContext(self, self._ctx, self.state) - self.enterRule(localctx, 34, self.RULE_declaration) - self._la = 0 # Token type - try: - self.enterOuterAlt(localctx, 1) - self.state = 468 - self._errHandler.sync(self) - _la = self._input.LA(1) - while _la==19 or _la==49 or ((((_la - 85)) & ~0x3f) == 0 and ((1 << (_la - 85)) & 15) != 0): - self.state = 466 - self._errHandler.sync(self) - token = self._input.LA(1) - if token in [19, 87, 88]: - self.state = 463 - localctx._storage_class_specifier = self.storage_class_specifier() - localctx.storage.append(localctx._storage_class_specifier) - pass - elif token in [85, 86]: - self.state = 464 - localctx._type_qualifier = self.type_qualifier() - localctx.qualifiers.append(localctx._type_qualifier) - pass - elif token in [49]: - self.state = 465 - localctx._attribute = self.attribute() - localctx.attributes.append(localctx._attribute) - pass - else: - raise NoViableAltException(self) - - self.state = 470 - self._errHandler.sync(self) - _la = self._input.LA(1) - - self.state = 471 - localctx.type_ = self.type_specifier() - self.state = 480 - self._errHandler.sync(self) - _la = self._input.LA(1) - if _la==96: - self.state = 472 - localctx._declarator = self.declarator() - localctx.declarations.append(localctx._declarator) - self.state = 477 - self._errHandler.sync(self) - _la = self._input.LA(1) - while _la==4: - self.state = 473 - self.match(CoreDSL2Parser.T__3) - self.state = 474 - localctx._declarator = self.declarator() - localctx.declarations.append(localctx._declarator) - self.state = 479 - self._errHandler.sync(self) - _la = self._input.LA(1) - - - - self.state = 482 - self.match(CoreDSL2Parser.T__9) - except RecognitionException as re: - localctx.exception = re - self._errHandler.reportError(self, re) - self._errHandler.recover(self, re) - finally: - self.exitRule() - return localctx - - - class Type_specifierContext(ParserRuleContext): - __slots__ = 'parser' - - def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): - super().__init__(parent, invokingState) - self.parser = parser - self.type_ = None # Value_type_specifierContext - self.ptr = None # Token - - def value_type_specifier(self): - return self.getTypedRuleContext(CoreDSL2Parser.Value_type_specifierContext,0) - - - def getRuleIndex(self): - return CoreDSL2Parser.RULE_type_specifier - - def enterRule(self, listener:ParseTreeListener): - if hasattr( listener, "enterType_specifier" ): - listener.enterType_specifier(self) - - def exitRule(self, listener:ParseTreeListener): - if hasattr( listener, "exitType_specifier" ): - listener.exitType_specifier(self) - - def accept(self, visitor:ParseTreeVisitor): - if hasattr( visitor, "visitType_specifier" ): - return visitor.visitType_specifier(self) - else: - return visitor.visitChildren(self) - - - - - def type_specifier(self): - - localctx = CoreDSL2Parser.Type_specifierContext(self, self._ctx, self.state) - self.enterRule(localctx, 36, self.RULE_type_specifier) - try: - self.enterOuterAlt(localctx, 1) - self.state = 484 - localctx.type_ = self.value_type_specifier() - self.state = 487 - self._errHandler.sync(self) - token = self._input.LA(1) - if token in [34]: - self.state = 485 - localctx.ptr = self.match(CoreDSL2Parser.T__33) - pass - elif token in [35]: - self.state = 486 - localctx.ptr = self.match(CoreDSL2Parser.T__34) - pass - elif token in [4, 10, 21, 96]: - pass - else: - pass - except RecognitionException as re: - localctx.exception = re - self._errHandler.reportError(self, re) - self._errHandler.recover(self, re) - finally: - self.exitRule() - return localctx - - - class Value_type_specifierContext(ParserRuleContext): - __slots__ = 'parser' - - def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): - super().__init__(parent, invokingState) - self.parser = parser - - - def getRuleIndex(self): - return CoreDSL2Parser.RULE_value_type_specifier - - - def copyFrom(self, ctx:ParserRuleContext): - super().copyFrom(ctx) - - - - class Composite_declarationContext(Value_type_specifierContext): - - def __init__(self, parser, ctx:ParserRuleContext): # actually a CoreDSL2Parser.Value_type_specifierContext - super().__init__(parser) - self.type_ = None # Struct_or_unionContext - self.name = None # Token - self._struct_declaration = None # Struct_declarationContext - self.declarations = list() # of Struct_declarationContexts - self.copyFrom(ctx) - - def struct_or_union(self): - return self.getTypedRuleContext(CoreDSL2Parser.Struct_or_unionContext,0) - - def IDENTIFIER(self): - return self.getToken(CoreDSL2Parser.IDENTIFIER, 0) - def struct_declaration(self, i:int=None): - if i is None: - return self.getTypedRuleContexts(CoreDSL2Parser.Struct_declarationContext) - else: - return self.getTypedRuleContext(CoreDSL2Parser.Struct_declarationContext,i) - - - def enterRule(self, listener:ParseTreeListener): - if hasattr( listener, "enterComposite_declaration" ): - listener.enterComposite_declaration(self) - - def exitRule(self, listener:ParseTreeListener): - if hasattr( listener, "exitComposite_declaration" ): - listener.exitComposite_declaration(self) - - def accept(self, visitor:ParseTreeVisitor): - if hasattr( visitor, "visitComposite_declaration" ): - return visitor.visitComposite_declaration(self) - else: - return visitor.visitChildren(self) - - - class Composite_referenceContext(Value_type_specifierContext): - - def __init__(self, parser, ctx:ParserRuleContext): # actually a CoreDSL2Parser.Value_type_specifierContext - super().__init__(parser) - self.type_ = None # Struct_or_unionContext - self.name = None # Token - self.copyFrom(ctx) - - def struct_or_union(self): - return self.getTypedRuleContext(CoreDSL2Parser.Struct_or_unionContext,0) - - def IDENTIFIER(self): - return self.getToken(CoreDSL2Parser.IDENTIFIER, 0) - - def enterRule(self, listener:ParseTreeListener): - if hasattr( listener, "enterComposite_reference" ): - listener.enterComposite_reference(self) - - def exitRule(self, listener:ParseTreeListener): - if hasattr( listener, "exitComposite_reference" ): - listener.exitComposite_reference(self) - - def accept(self, visitor:ParseTreeVisitor): - if hasattr( visitor, "visitComposite_reference" ): - return visitor.visitComposite_reference(self) - else: - return visitor.visitChildren(self) - - - class Enum_declarationContext(Value_type_specifierContext): - - def __init__(self, parser, ctx:ParserRuleContext): # actually a CoreDSL2Parser.Value_type_specifierContext - super().__init__(parser) - self.type_ = None # Token - self.name = None # Token - self.copyFrom(ctx) - - def enumerator_list(self): - return self.getTypedRuleContext(CoreDSL2Parser.Enumerator_listContext,0) - - def IDENTIFIER(self): - return self.getToken(CoreDSL2Parser.IDENTIFIER, 0) - - def enterRule(self, listener:ParseTreeListener): - if hasattr( listener, "enterEnum_declaration" ): - listener.enterEnum_declaration(self) - - def exitRule(self, listener:ParseTreeListener): - if hasattr( listener, "exitEnum_declaration" ): - listener.exitEnum_declaration(self) - - def accept(self, visitor:ParseTreeVisitor): - if hasattr( visitor, "visitEnum_declaration" ): - return visitor.visitEnum_declaration(self) - else: - return visitor.visitChildren(self) - - - class Void_typeContext(Value_type_specifierContext): - - def __init__(self, parser, ctx:ParserRuleContext): # actually a CoreDSL2Parser.Value_type_specifierContext - super().__init__(parser) - self.type_ = None # Token - self.copyFrom(ctx) - - - def enterRule(self, listener:ParseTreeListener): - if hasattr( listener, "enterVoid_type" ): - listener.enterVoid_type(self) - - def exitRule(self, listener:ParseTreeListener): - if hasattr( listener, "exitVoid_type" ): - listener.exitVoid_type(self) - - def accept(self, visitor:ParseTreeVisitor): - if hasattr( visitor, "visitVoid_type" ): - return visitor.visitVoid_type(self) - else: - return visitor.visitChildren(self) - - - class Enum_referenceContext(Value_type_specifierContext): - - def __init__(self, parser, ctx:ParserRuleContext): # actually a CoreDSL2Parser.Value_type_specifierContext - super().__init__(parser) - self.type_ = None # Token - self.name = None # Token - self.copyFrom(ctx) - - def IDENTIFIER(self): - return self.getToken(CoreDSL2Parser.IDENTIFIER, 0) - - def enterRule(self, listener:ParseTreeListener): - if hasattr( listener, "enterEnum_reference" ): - listener.enterEnum_reference(self) - - def exitRule(self, listener:ParseTreeListener): - if hasattr( listener, "exitEnum_reference" ): - listener.exitEnum_reference(self) - - def accept(self, visitor:ParseTreeVisitor): - if hasattr( visitor, "visitEnum_reference" ): - return visitor.visitEnum_reference(self) - else: - return visitor.visitChildren(self) - - - class Float_typeContext(Value_type_specifierContext): - - def __init__(self, parser, ctx:ParserRuleContext): # actually a CoreDSL2Parser.Value_type_specifierContext - super().__init__(parser) - self.shorthand = None # Float_shorthandContext - self.copyFrom(ctx) - - def float_shorthand(self): - return self.getTypedRuleContext(CoreDSL2Parser.Float_shorthandContext,0) - - - def enterRule(self, listener:ParseTreeListener): - if hasattr( listener, "enterFloat_type" ): - listener.enterFloat_type(self) - - def exitRule(self, listener:ParseTreeListener): - if hasattr( listener, "exitFloat_type" ): - listener.exitFloat_type(self) - - def accept(self, visitor:ParseTreeVisitor): - if hasattr( visitor, "visitFloat_type" ): - return visitor.visitFloat_type(self) - else: - return visitor.visitChildren(self) - - - class Bool_typeContext(Value_type_specifierContext): - - def __init__(self, parser, ctx:ParserRuleContext): # actually a CoreDSL2Parser.Value_type_specifierContext - super().__init__(parser) - self.type_ = None # Token - self.copyFrom(ctx) - - - def enterRule(self, listener:ParseTreeListener): - if hasattr( listener, "enterBool_type" ): - listener.enterBool_type(self) - - def exitRule(self, listener:ParseTreeListener): - if hasattr( listener, "exitBool_type" ): - listener.exitBool_type(self) - - def accept(self, visitor:ParseTreeVisitor): - if hasattr( visitor, "visitBool_type" ): - return visitor.visitBool_type(self) - else: - return visitor.visitChildren(self) - - - class Integer_typeContext(Value_type_specifierContext): - - def __init__(self, parser, ctx:ParserRuleContext): # actually a CoreDSL2Parser.Value_type_specifierContext - super().__init__(parser) - self.signed = None # Integer_signednessContext - self.shorthand = None # Integer_shorthandContext - self.size = None # PrimaryContext - self.copyFrom(ctx) - - def integer_signedness(self): - return self.getTypedRuleContext(CoreDSL2Parser.Integer_signednessContext,0) - - def integer_shorthand(self): - return self.getTypedRuleContext(CoreDSL2Parser.Integer_shorthandContext,0) - - def primary(self): - return self.getTypedRuleContext(CoreDSL2Parser.PrimaryContext,0) - - - def enterRule(self, listener:ParseTreeListener): - if hasattr( listener, "enterInteger_type" ): - listener.enterInteger_type(self) - - def exitRule(self, listener:ParseTreeListener): - if hasattr( listener, "exitInteger_type" ): - listener.exitInteger_type(self) - - def accept(self, visitor:ParseTreeVisitor): - if hasattr( visitor, "visitInteger_type" ): - return visitor.visitInteger_type(self) - else: - return visitor.visitChildren(self) - - - - def value_type_specifier(self): - - localctx = CoreDSL2Parser.Value_type_specifierContext(self, self._ctx, self.state) - self.enterRule(localctx, 38, self.RULE_value_type_specifier) - self._la = 0 # Token type - try: - self.state = 530 - self._errHandler.sync(self) - la_ = self._interp.adaptivePredict(self._input,60,self._ctx) - if la_ == 1: - localctx = CoreDSL2Parser.Integer_typeContext(self, localctx) - self.enterOuterAlt(localctx, 1) - self.state = 489 - localctx.signed = self.integer_signedness() - self.state = 495 - self._errHandler.sync(self) - token = self._input.LA(1) - if token in [43, 44, 45, 46]: - self.state = 490 - localctx.shorthand = self.integer_shorthand() - pass - elif token in [36]: - self.state = 491 - self.match(CoreDSL2Parser.T__35) - self.state = 492 - localctx.size = self.primary() - self.state = 493 - self.match(CoreDSL2Parser.T__36) - pass - else: - raise NoViableAltException(self) - - pass - - elif la_ == 2: - localctx = CoreDSL2Parser.Integer_typeContext(self, localctx) - self.enterOuterAlt(localctx, 2) - self.state = 497 - localctx.shorthand = self.integer_shorthand() - pass - - elif la_ == 3: - localctx = CoreDSL2Parser.Float_typeContext(self, localctx) - self.enterOuterAlt(localctx, 3) - self.state = 498 - localctx.shorthand = self.float_shorthand() - pass - - elif la_ == 4: - localctx = CoreDSL2Parser.Bool_typeContext(self, localctx) - self.enterOuterAlt(localctx, 4) - self.state = 499 - localctx.type_ = self.match(CoreDSL2Parser.T__37) - pass - - elif la_ == 5: - localctx = CoreDSL2Parser.Void_typeContext(self, localctx) - self.enterOuterAlt(localctx, 5) - self.state = 500 - localctx.type_ = self.match(CoreDSL2Parser.T__38) - pass - - elif la_ == 6: - localctx = CoreDSL2Parser.Composite_declarationContext(self, localctx) - self.enterOuterAlt(localctx, 6) - self.state = 501 - localctx.type_ = self.struct_or_union() - self.state = 503 - self._errHandler.sync(self) - _la = self._input.LA(1) - if _la==96: - self.state = 502 - localctx.name = self.match(CoreDSL2Parser.IDENTIFIER) - - - self.state = 505 - self.match(CoreDSL2Parser.T__4) - self.state = 509 - self._errHandler.sync(self) - _la = self._input.LA(1) - while ((((_la - 38)) & ~0x3f) == 0 and ((1 << (_la - 38)) & 7177611906123775) != 0): - self.state = 506 - localctx._struct_declaration = self.struct_declaration() - localctx.declarations.append(localctx._struct_declaration) - self.state = 511 - self._errHandler.sync(self) - _la = self._input.LA(1) - - self.state = 512 - self.match(CoreDSL2Parser.T__5) - pass - - elif la_ == 7: - localctx = CoreDSL2Parser.Composite_referenceContext(self, localctx) - self.enterOuterAlt(localctx, 7) - self.state = 514 - localctx.type_ = self.struct_or_union() - self.state = 515 - localctx.name = self.match(CoreDSL2Parser.IDENTIFIER) - pass - - elif la_ == 8: - localctx = CoreDSL2Parser.Enum_declarationContext(self, localctx) - self.enterOuterAlt(localctx, 8) - self.state = 517 - localctx.type_ = self.match(CoreDSL2Parser.T__39) - self.state = 519 - self._errHandler.sync(self) - _la = self._input.LA(1) - if _la==96: - self.state = 518 - localctx.name = self.match(CoreDSL2Parser.IDENTIFIER) - - - self.state = 521 - self.match(CoreDSL2Parser.T__4) - self.state = 522 - self.enumerator_list() - self.state = 524 - self._errHandler.sync(self) - _la = self._input.LA(1) - if _la==4: - self.state = 523 - self.match(CoreDSL2Parser.T__3) - - - self.state = 526 - self.match(CoreDSL2Parser.T__5) - pass - - elif la_ == 9: - localctx = CoreDSL2Parser.Enum_referenceContext(self, localctx) - self.enterOuterAlt(localctx, 9) - self.state = 528 - localctx.type_ = self.match(CoreDSL2Parser.T__39) - self.state = 529 - localctx.name = self.match(CoreDSL2Parser.IDENTIFIER) - pass - - - except RecognitionException as re: - localctx.exception = re - self._errHandler.reportError(self, re) - self._errHandler.recover(self, re) - finally: - self.exitRule() - return localctx - - - class Integer_signednessContext(ParserRuleContext): - __slots__ = 'parser' - - def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): - super().__init__(parent, invokingState) - self.parser = parser - - - def getRuleIndex(self): - return CoreDSL2Parser.RULE_integer_signedness - - def enterRule(self, listener:ParseTreeListener): - if hasattr( listener, "enterInteger_signedness" ): - listener.enterInteger_signedness(self) - - def exitRule(self, listener:ParseTreeListener): - if hasattr( listener, "exitInteger_signedness" ): - listener.exitInteger_signedness(self) - - def accept(self, visitor:ParseTreeVisitor): - if hasattr( visitor, "visitInteger_signedness" ): - return visitor.visitInteger_signedness(self) - else: - return visitor.visitChildren(self) - - - - - def integer_signedness(self): - - localctx = CoreDSL2Parser.Integer_signednessContext(self, self._ctx, self.state) - self.enterRule(localctx, 40, self.RULE_integer_signedness) - self._la = 0 # Token type - try: - self.enterOuterAlt(localctx, 1) - self.state = 532 - _la = self._input.LA(1) - if not(_la==41 or _la==42): - self._errHandler.recoverInline(self) - else: - self._errHandler.reportMatch(self) - self.consume() - except RecognitionException as re: - localctx.exception = re - self._errHandler.reportError(self, re) - self._errHandler.recover(self, re) - finally: - self.exitRule() - return localctx - - - class Integer_shorthandContext(ParserRuleContext): - __slots__ = 'parser' - - def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): - super().__init__(parent, invokingState) - self.parser = parser - - - def getRuleIndex(self): - return CoreDSL2Parser.RULE_integer_shorthand - - def enterRule(self, listener:ParseTreeListener): - if hasattr( listener, "enterInteger_shorthand" ): - listener.enterInteger_shorthand(self) - - def exitRule(self, listener:ParseTreeListener): - if hasattr( listener, "exitInteger_shorthand" ): - listener.exitInteger_shorthand(self) - - def accept(self, visitor:ParseTreeVisitor): - if hasattr( visitor, "visitInteger_shorthand" ): - return visitor.visitInteger_shorthand(self) - else: - return visitor.visitChildren(self) - - - - - def integer_shorthand(self): - - localctx = CoreDSL2Parser.Integer_shorthandContext(self, self._ctx, self.state) - self.enterRule(localctx, 42, self.RULE_integer_shorthand) - self._la = 0 # Token type - try: - self.enterOuterAlt(localctx, 1) - self.state = 534 - _la = self._input.LA(1) - if not((((_la) & ~0x3f) == 0 and ((1 << _la) & 131941395333120) != 0)): - self._errHandler.recoverInline(self) - else: - self._errHandler.reportMatch(self) - self.consume() - except RecognitionException as re: - localctx.exception = re - self._errHandler.reportError(self, re) - self._errHandler.recover(self, re) - finally: - self.exitRule() - return localctx - - - class Float_shorthandContext(ParserRuleContext): - __slots__ = 'parser' - - def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): - super().__init__(parent, invokingState) - self.parser = parser - - - def getRuleIndex(self): - return CoreDSL2Parser.RULE_float_shorthand - - def enterRule(self, listener:ParseTreeListener): - if hasattr( listener, "enterFloat_shorthand" ): - listener.enterFloat_shorthand(self) - - def exitRule(self, listener:ParseTreeListener): - if hasattr( listener, "exitFloat_shorthand" ): - listener.exitFloat_shorthand(self) - - def accept(self, visitor:ParseTreeVisitor): - if hasattr( visitor, "visitFloat_shorthand" ): - return visitor.visitFloat_shorthand(self) - else: - return visitor.visitChildren(self) - - - - - def float_shorthand(self): - - localctx = CoreDSL2Parser.Float_shorthandContext(self, self._ctx, self.state) - self.enterRule(localctx, 44, self.RULE_float_shorthand) - self._la = 0 # Token type - try: - self.enterOuterAlt(localctx, 1) - self.state = 536 - _la = self._input.LA(1) - if not(_la==47 or _la==48): - self._errHandler.recoverInline(self) - else: - self._errHandler.reportMatch(self) - self.consume() - except RecognitionException as re: - localctx.exception = re - self._errHandler.reportError(self, re) - self._errHandler.recover(self, re) - finally: - self.exitRule() - return localctx - - - class AttributeContext(ParserRuleContext): - __slots__ = 'parser' - - def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): - super().__init__(parent, invokingState) - self.parser = parser - self.name = None # Token - self._expression = None # ExpressionContext - self.params = list() # of ExpressionContexts - - def IDENTIFIER(self): - return self.getToken(CoreDSL2Parser.IDENTIFIER, 0) - - def expression(self, i:int=None): - if i is None: - return self.getTypedRuleContexts(CoreDSL2Parser.ExpressionContext) - else: - return self.getTypedRuleContext(CoreDSL2Parser.ExpressionContext,i) - - - def getRuleIndex(self): - return CoreDSL2Parser.RULE_attribute - - def enterRule(self, listener:ParseTreeListener): - if hasattr( listener, "enterAttribute" ): - listener.enterAttribute(self) - - def exitRule(self, listener:ParseTreeListener): - if hasattr( listener, "exitAttribute" ): - listener.exitAttribute(self) - - def accept(self, visitor:ParseTreeVisitor): - if hasattr( visitor, "visitAttribute" ): - return visitor.visitAttribute(self) - else: - return visitor.visitChildren(self) - - - - - def attribute(self): - - localctx = CoreDSL2Parser.AttributeContext(self, self._ctx, self.state) - self.enterRule(localctx, 46, self.RULE_attribute) - self._la = 0 # Token type - try: - self.enterOuterAlt(localctx, 1) - self.state = 538 - self.match(CoreDSL2Parser.T__48) - self.state = 539 - localctx.name = self.match(CoreDSL2Parser.IDENTIFIER) - self.state = 553 - self._errHandler.sync(self) - token = self._input.LA(1) - if token in [50]: - self.state = 540 - self.match(CoreDSL2Parser.T__49) - self.state = 541 - localctx._expression = self.expression(0) - localctx.params.append(localctx._expression) - pass - elif token in [20]: - self.state = 542 - self.match(CoreDSL2Parser.T__19) - self.state = 543 - localctx._expression = self.expression(0) - localctx.params.append(localctx._expression) - self.state = 548 - self._errHandler.sync(self) - _la = self._input.LA(1) - while _la==4: - self.state = 544 - self.match(CoreDSL2Parser.T__3) - self.state = 545 - localctx._expression = self.expression(0) - localctx.params.append(localctx._expression) - self.state = 550 - self._errHandler.sync(self) - _la = self._input.LA(1) - - self.state = 551 - self.match(CoreDSL2Parser.T__20) - pass - elif token in [51]: - pass - else: - pass - self.state = 555 - self.match(CoreDSL2Parser.T__50) - except RecognitionException as re: - localctx.exception = re - self._errHandler.reportError(self, re) - self._errHandler.recover(self, re) - finally: - self.exitRule() - return localctx - - - class Bit_size_specifierContext(ParserRuleContext): - __slots__ = 'parser' - - def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): - super().__init__(parent, invokingState) - self.parser = parser - self._primary = None # PrimaryContext - self.size = list() # of PrimaryContexts - - def primary(self, i:int=None): - if i is None: - return self.getTypedRuleContexts(CoreDSL2Parser.PrimaryContext) - else: - return self.getTypedRuleContext(CoreDSL2Parser.PrimaryContext,i) - - - def getRuleIndex(self): - return CoreDSL2Parser.RULE_bit_size_specifier - - def enterRule(self, listener:ParseTreeListener): - if hasattr( listener, "enterBit_size_specifier" ): - listener.enterBit_size_specifier(self) - - def exitRule(self, listener:ParseTreeListener): - if hasattr( listener, "exitBit_size_specifier" ): - listener.exitBit_size_specifier(self) - - def accept(self, visitor:ParseTreeVisitor): - if hasattr( visitor, "visitBit_size_specifier" ): - return visitor.visitBit_size_specifier(self) - else: - return visitor.visitChildren(self) - - - - - def bit_size_specifier(self): - - localctx = CoreDSL2Parser.Bit_size_specifierContext(self, self._ctx, self.state) - self.enterRule(localctx, 48, self.RULE_bit_size_specifier) - self._la = 0 # Token type - try: - self.enterOuterAlt(localctx, 1) - self.state = 557 - self.match(CoreDSL2Parser.T__35) - self.state = 558 - localctx._primary = self.primary() - localctx.size.append(localctx._primary) - self.state = 566 - self._errHandler.sync(self) - _la = self._input.LA(1) - if _la==4: - self.state = 559 - self.match(CoreDSL2Parser.T__3) - self.state = 560 - localctx._primary = self.primary() - localctx.size.append(localctx._primary) - self.state = 561 - self.match(CoreDSL2Parser.T__3) - self.state = 562 - localctx._primary = self.primary() - localctx.size.append(localctx._primary) - self.state = 563 - self.match(CoreDSL2Parser.T__3) - self.state = 564 - localctx._primary = self.primary() - localctx.size.append(localctx._primary) - - - self.state = 568 - self.match(CoreDSL2Parser.T__36) - except RecognitionException as re: - localctx.exception = re - self._errHandler.reportError(self, re) - self._errHandler.recover(self, re) - finally: - self.exitRule() - return localctx - - - class Enumerator_listContext(ParserRuleContext): - __slots__ = 'parser' - - def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): - super().__init__(parent, invokingState) - self.parser = parser - self._enumerator = None # EnumeratorContext - self.enumerators = list() # of EnumeratorContexts - - def enumerator(self, i:int=None): - if i is None: - return self.getTypedRuleContexts(CoreDSL2Parser.EnumeratorContext) - else: - return self.getTypedRuleContext(CoreDSL2Parser.EnumeratorContext,i) - - - def getRuleIndex(self): - return CoreDSL2Parser.RULE_enumerator_list - - def enterRule(self, listener:ParseTreeListener): - if hasattr( listener, "enterEnumerator_list" ): - listener.enterEnumerator_list(self) - - def exitRule(self, listener:ParseTreeListener): - if hasattr( listener, "exitEnumerator_list" ): - listener.exitEnumerator_list(self) - - def accept(self, visitor:ParseTreeVisitor): - if hasattr( visitor, "visitEnumerator_list" ): - return visitor.visitEnumerator_list(self) - else: - return visitor.visitChildren(self) - - - - - def enumerator_list(self): - - localctx = CoreDSL2Parser.Enumerator_listContext(self, self._ctx, self.state) - self.enterRule(localctx, 50, self.RULE_enumerator_list) - try: - self.enterOuterAlt(localctx, 1) - self.state = 570 - localctx._enumerator = self.enumerator() - localctx.enumerators.append(localctx._enumerator) - self.state = 575 - self._errHandler.sync(self) - _alt = self._interp.adaptivePredict(self._input,64,self._ctx) - while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER: - if _alt==1: - self.state = 571 - self.match(CoreDSL2Parser.T__3) - self.state = 572 - localctx._enumerator = self.enumerator() - localctx.enumerators.append(localctx._enumerator) - self.state = 577 - self._errHandler.sync(self) - _alt = self._interp.adaptivePredict(self._input,64,self._ctx) - - except RecognitionException as re: - localctx.exception = re - self._errHandler.reportError(self, re) - self._errHandler.recover(self, re) - finally: - self.exitRule() - return localctx - - - class EnumeratorContext(ParserRuleContext): - __slots__ = 'parser' - - def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): - super().__init__(parent, invokingState) - self.parser = parser - self.name = None # Token - - def IDENTIFIER(self): - return self.getToken(CoreDSL2Parser.IDENTIFIER, 0) - - def expression(self): - return self.getTypedRuleContext(CoreDSL2Parser.ExpressionContext,0) - - - def getRuleIndex(self): - return CoreDSL2Parser.RULE_enumerator - - def enterRule(self, listener:ParseTreeListener): - if hasattr( listener, "enterEnumerator" ): - listener.enterEnumerator(self) - - def exitRule(self, listener:ParseTreeListener): - if hasattr( listener, "exitEnumerator" ): - listener.exitEnumerator(self) - - def accept(self, visitor:ParseTreeVisitor): - if hasattr( visitor, "visitEnumerator" ): - return visitor.visitEnumerator(self) - else: - return visitor.visitChildren(self) - - - - - def enumerator(self): - - localctx = CoreDSL2Parser.EnumeratorContext(self, self._ctx, self.state) - self.enterRule(localctx, 52, self.RULE_enumerator) - try: - self.state = 582 - self._errHandler.sync(self) - la_ = self._interp.adaptivePredict(self._input,65,self._ctx) - if la_ == 1: - self.enterOuterAlt(localctx, 1) - self.state = 578 - localctx.name = self.match(CoreDSL2Parser.IDENTIFIER) - pass - - elif la_ == 2: - self.enterOuterAlt(localctx, 2) - self.state = 579 - localctx.name = self.match(CoreDSL2Parser.IDENTIFIER) - self.state = 580 - self.match(CoreDSL2Parser.T__49) - self.state = 581 - self.expression(0) - pass - - - except RecognitionException as re: - localctx.exception = re - self._errHandler.reportError(self, re) - self._errHandler.recover(self, re) - finally: - self.exitRule() - return localctx - - - class Struct_declarationContext(ParserRuleContext): - __slots__ = 'parser' - - def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): - super().__init__(parent, invokingState) - self.parser = parser - self.specifier = None # Struct_declaration_specifierContext - self._declarator = None # DeclaratorContext - self.declarators = list() # of DeclaratorContexts - - def struct_declaration_specifier(self): - return self.getTypedRuleContext(CoreDSL2Parser.Struct_declaration_specifierContext,0) - - - def declarator(self, i:int=None): - if i is None: - return self.getTypedRuleContexts(CoreDSL2Parser.DeclaratorContext) - else: - return self.getTypedRuleContext(CoreDSL2Parser.DeclaratorContext,i) - - - def getRuleIndex(self): - return CoreDSL2Parser.RULE_struct_declaration - - def enterRule(self, listener:ParseTreeListener): - if hasattr( listener, "enterStruct_declaration" ): - listener.enterStruct_declaration(self) - - def exitRule(self, listener:ParseTreeListener): - if hasattr( listener, "exitStruct_declaration" ): - listener.exitStruct_declaration(self) - - def accept(self, visitor:ParseTreeVisitor): - if hasattr( visitor, "visitStruct_declaration" ): - return visitor.visitStruct_declaration(self) - else: - return visitor.visitChildren(self) - - - - - def struct_declaration(self): - - localctx = CoreDSL2Parser.Struct_declarationContext(self, self._ctx, self.state) - self.enterRule(localctx, 54, self.RULE_struct_declaration) - self._la = 0 # Token type - try: - self.enterOuterAlt(localctx, 1) - self.state = 584 - localctx.specifier = self.struct_declaration_specifier() - self.state = 585 - localctx._declarator = self.declarator() - localctx.declarators.append(localctx._declarator) - self.state = 590 - self._errHandler.sync(self) - _la = self._input.LA(1) - while _la==4: - self.state = 586 - self.match(CoreDSL2Parser.T__3) - self.state = 587 - localctx._declarator = self.declarator() - localctx.declarators.append(localctx._declarator) - self.state = 592 - self._errHandler.sync(self) - _la = self._input.LA(1) - - self.state = 593 - self.match(CoreDSL2Parser.T__9) - except RecognitionException as re: - localctx.exception = re - self._errHandler.reportError(self, re) - self._errHandler.recover(self, re) - finally: - self.exitRule() - return localctx - - - class Struct_declaration_specifierContext(ParserRuleContext): - __slots__ = 'parser' - - def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): - super().__init__(parent, invokingState) - self.parser = parser - self.type_ = None # Type_specifierContext - self._type_qualifier = None # Type_qualifierContext - self.qualifiers = list() # of Type_qualifierContexts - - def type_specifier(self): - return self.getTypedRuleContext(CoreDSL2Parser.Type_specifierContext,0) - - - def type_qualifier(self): - return self.getTypedRuleContext(CoreDSL2Parser.Type_qualifierContext,0) - - - def getRuleIndex(self): - return CoreDSL2Parser.RULE_struct_declaration_specifier - - def enterRule(self, listener:ParseTreeListener): - if hasattr( listener, "enterStruct_declaration_specifier" ): - listener.enterStruct_declaration_specifier(self) - - def exitRule(self, listener:ParseTreeListener): - if hasattr( listener, "exitStruct_declaration_specifier" ): - listener.exitStruct_declaration_specifier(self) - - def accept(self, visitor:ParseTreeVisitor): - if hasattr( visitor, "visitStruct_declaration_specifier" ): - return visitor.visitStruct_declaration_specifier(self) - else: - return visitor.visitChildren(self) - - - - - def struct_declaration_specifier(self): - - localctx = CoreDSL2Parser.Struct_declaration_specifierContext(self, self._ctx, self.state) - self.enterRule(localctx, 56, self.RULE_struct_declaration_specifier) - try: - self.state = 597 - self._errHandler.sync(self) - token = self._input.LA(1) - if token in [38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 89, 90]: - self.enterOuterAlt(localctx, 1) - self.state = 595 - localctx.type_ = self.type_specifier() - pass - elif token in [85, 86]: - self.enterOuterAlt(localctx, 2) - self.state = 596 - localctx._type_qualifier = self.type_qualifier() - localctx.qualifiers.append(localctx._type_qualifier) - pass - else: - raise NoViableAltException(self) - - except RecognitionException as re: - localctx.exception = re - self._errHandler.reportError(self, re) - self._errHandler.recover(self, re) - finally: - self.exitRule() - return localctx - - - class DeclaratorContext(ParserRuleContext): - __slots__ = 'parser' - - def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): - super().__init__(parent, invokingState) - self.parser = parser - self.name = None # Token - self._expression = None # ExpressionContext - self.size = list() # of ExpressionContexts - self._attribute = None # AttributeContext - self.attributes = list() # of AttributeContexts - self.init = None # InitializerContext - - def IDENTIFIER(self): - return self.getToken(CoreDSL2Parser.IDENTIFIER, 0) - - def LEFT_BR(self, i:int=None): - if i is None: - return self.getTokens(CoreDSL2Parser.LEFT_BR) - else: - return self.getToken(CoreDSL2Parser.LEFT_BR, i) - - def RIGHT_BR(self, i:int=None): - if i is None: - return self.getTokens(CoreDSL2Parser.RIGHT_BR) - else: - return self.getToken(CoreDSL2Parser.RIGHT_BR, i) - - def expression(self, i:int=None): - if i is None: - return self.getTypedRuleContexts(CoreDSL2Parser.ExpressionContext) - else: - return self.getTypedRuleContext(CoreDSL2Parser.ExpressionContext,i) - - - def attribute(self, i:int=None): - if i is None: - return self.getTypedRuleContexts(CoreDSL2Parser.AttributeContext) - else: - return self.getTypedRuleContext(CoreDSL2Parser.AttributeContext,i) - - - def initializer(self): - return self.getTypedRuleContext(CoreDSL2Parser.InitializerContext,0) - - - def getRuleIndex(self): - return CoreDSL2Parser.RULE_declarator - - def enterRule(self, listener:ParseTreeListener): - if hasattr( listener, "enterDeclarator" ): - listener.enterDeclarator(self) - - def exitRule(self, listener:ParseTreeListener): - if hasattr( listener, "exitDeclarator" ): - listener.exitDeclarator(self) - - def accept(self, visitor:ParseTreeVisitor): - if hasattr( visitor, "visitDeclarator" ): - return visitor.visitDeclarator(self) - else: - return visitor.visitChildren(self) - - - - - def declarator(self): - - localctx = CoreDSL2Parser.DeclaratorContext(self, self._ctx, self.state) - self.enterRule(localctx, 58, self.RULE_declarator) - self._la = 0 # Token type - try: - self.enterOuterAlt(localctx, 1) - self.state = 599 - localctx.name = self.match(CoreDSL2Parser.IDENTIFIER) - self.state = 606 - self._errHandler.sync(self) - _la = self._input.LA(1) - while _la==91: - self.state = 600 - self.match(CoreDSL2Parser.LEFT_BR) - self.state = 601 - localctx._expression = self.expression(0) - localctx.size.append(localctx._expression) - self.state = 602 - self.match(CoreDSL2Parser.RIGHT_BR) - self.state = 608 - self._errHandler.sync(self) - _la = self._input.LA(1) - - self.state = 612 - self._errHandler.sync(self) - _la = self._input.LA(1) - while _la==49: - self.state = 609 - localctx._attribute = self.attribute() - localctx.attributes.append(localctx._attribute) - self.state = 614 - self._errHandler.sync(self) - _la = self._input.LA(1) - - self.state = 617 - self._errHandler.sync(self) - _la = self._input.LA(1) - if _la==50: - self.state = 615 - self.match(CoreDSL2Parser.T__49) - self.state = 616 - localctx.init = self.initializer() - - - except RecognitionException as re: - localctx.exception = re - self._errHandler.reportError(self, re) - self._errHandler.recover(self, re) - finally: - self.exitRule() - return localctx - - - class InitializerContext(ParserRuleContext): - __slots__ = 'parser' - - def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): - super().__init__(parent, invokingState) - self.parser = parser - self.expr = None # ExpressionContext - - def expression(self): - return self.getTypedRuleContext(CoreDSL2Parser.ExpressionContext,0) - - - def initializerList(self): - return self.getTypedRuleContext(CoreDSL2Parser.InitializerListContext,0) - - - def getRuleIndex(self): - return CoreDSL2Parser.RULE_initializer - - def enterRule(self, listener:ParseTreeListener): - if hasattr( listener, "enterInitializer" ): - listener.enterInitializer(self) - - def exitRule(self, listener:ParseTreeListener): - if hasattr( listener, "exitInitializer" ): - listener.exitInitializer(self) - - def accept(self, visitor:ParseTreeVisitor): - if hasattr( visitor, "visitInitializer" ): - return visitor.visitInitializer(self) - else: - return visitor.visitChildren(self) - - - - - def initializer(self): - - localctx = CoreDSL2Parser.InitializerContext(self, self._ctx, self.state) - self.enterRule(localctx, 60, self.RULE_initializer) - self._la = 0 # Token type - try: - self.state = 627 - self._errHandler.sync(self) - token = self._input.LA(1) - if token in [20, 34, 35, 52, 53, 54, 55, 56, 57, 58, 59, 93, 94, 95, 96, 97, 98, 99]: - self.enterOuterAlt(localctx, 1) - self.state = 619 - localctx.expr = self.expression(0) - pass - elif token in [5]: - self.enterOuterAlt(localctx, 2) - self.state = 620 - self.match(CoreDSL2Parser.T__4) - self.state = 621 - self.initializerList() - self.state = 623 - self._errHandler.sync(self) - _la = self._input.LA(1) - if _la==4: - self.state = 622 - self.match(CoreDSL2Parser.T__3) - - - self.state = 625 - self.match(CoreDSL2Parser.T__5) - pass - else: - raise NoViableAltException(self) - - except RecognitionException as re: - localctx.exception = re - self._errHandler.reportError(self, re) - self._errHandler.recover(self, re) - finally: - self.exitRule() - return localctx - - - class InitializerListContext(ParserRuleContext): - __slots__ = 'parser' - - def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): - super().__init__(parent, invokingState) - self.parser = parser - - def designated_initializer(self, i:int=None): - if i is None: - return self.getTypedRuleContexts(CoreDSL2Parser.Designated_initializerContext) - else: - return self.getTypedRuleContext(CoreDSL2Parser.Designated_initializerContext,i) - - - def initializer(self, i:int=None): - if i is None: - return self.getTypedRuleContexts(CoreDSL2Parser.InitializerContext) - else: - return self.getTypedRuleContext(CoreDSL2Parser.InitializerContext,i) - - - def getRuleIndex(self): - return CoreDSL2Parser.RULE_initializerList - - def enterRule(self, listener:ParseTreeListener): - if hasattr( listener, "enterInitializerList" ): - listener.enterInitializerList(self) - - def exitRule(self, listener:ParseTreeListener): - if hasattr( listener, "exitInitializerList" ): - listener.exitInitializerList(self) - - def accept(self, visitor:ParseTreeVisitor): - if hasattr( visitor, "visitInitializerList" ): - return visitor.visitInitializerList(self) - else: - return visitor.visitChildren(self) - - - - - def initializerList(self): - - localctx = CoreDSL2Parser.InitializerListContext(self, self._ctx, self.state) - self.enterRule(localctx, 62, self.RULE_initializerList) - try: - self.enterOuterAlt(localctx, 1) - self.state = 631 - self._errHandler.sync(self) - la_ = self._interp.adaptivePredict(self._input,73,self._ctx) - if la_ == 1: - self.state = 629 - self.designated_initializer() - pass - - elif la_ == 2: - self.state = 630 - self.initializer() - pass - - - self.state = 640 - self._errHandler.sync(self) - _alt = self._interp.adaptivePredict(self._input,75,self._ctx) - while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER: - if _alt==1: - self.state = 633 - self.match(CoreDSL2Parser.T__3) - self.state = 636 - self._errHandler.sync(self) - la_ = self._interp.adaptivePredict(self._input,74,self._ctx) - if la_ == 1: - self.state = 634 - self.designated_initializer() - pass - - elif la_ == 2: - self.state = 635 - self.initializer() - pass - - - self.state = 642 - self._errHandler.sync(self) - _alt = self._interp.adaptivePredict(self._input,75,self._ctx) - - except RecognitionException as re: - localctx.exception = re - self._errHandler.reportError(self, re) - self._errHandler.recover(self, re) - finally: - self.exitRule() - return localctx - - - class Designated_initializerContext(ParserRuleContext): - __slots__ = 'parser' - - def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): - super().__init__(parent, invokingState) - self.parser = parser - self._designator = None # DesignatorContext - self.designators = list() # of DesignatorContexts - self.init = None # InitializerContext - - def initializer(self): - return self.getTypedRuleContext(CoreDSL2Parser.InitializerContext,0) - - - def designator(self, i:int=None): - if i is None: - return self.getTypedRuleContexts(CoreDSL2Parser.DesignatorContext) - else: - return self.getTypedRuleContext(CoreDSL2Parser.DesignatorContext,i) - - - def getRuleIndex(self): - return CoreDSL2Parser.RULE_designated_initializer - - def enterRule(self, listener:ParseTreeListener): - if hasattr( listener, "enterDesignated_initializer" ): - listener.enterDesignated_initializer(self) - - def exitRule(self, listener:ParseTreeListener): - if hasattr( listener, "exitDesignated_initializer" ): - listener.exitDesignated_initializer(self) - - def accept(self, visitor:ParseTreeVisitor): - if hasattr( visitor, "visitDesignated_initializer" ): - return visitor.visitDesignated_initializer(self) - else: - return visitor.visitChildren(self) - - - - - def designated_initializer(self): - - localctx = CoreDSL2Parser.Designated_initializerContext(self, self._ctx, self.state) - self.enterRule(localctx, 64, self.RULE_designated_initializer) - self._la = 0 # Token type - try: - self.enterOuterAlt(localctx, 1) - self.state = 644 - self._errHandler.sync(self) - _la = self._input.LA(1) - while True: - self.state = 643 - localctx._designator = self.designator() - localctx.designators.append(localctx._designator) - self.state = 646 - self._errHandler.sync(self) - _la = self._input.LA(1) - if not (_la==52 or _la==91): - break - - self.state = 648 - self.match(CoreDSL2Parser.T__49) - self.state = 649 - localctx.init = self.initializer() - except RecognitionException as re: - localctx.exception = re - self._errHandler.reportError(self, re) - self._errHandler.recover(self, re) - finally: - self.exitRule() - return localctx - - - class DesignatorContext(ParserRuleContext): - __slots__ = 'parser' - - def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): - super().__init__(parent, invokingState) - self.parser = parser - self.idx = None # ExpressionContext - self.prop = None # Token - - def LEFT_BR(self): - return self.getToken(CoreDSL2Parser.LEFT_BR, 0) - - def RIGHT_BR(self): - return self.getToken(CoreDSL2Parser.RIGHT_BR, 0) - - def expression(self): - return self.getTypedRuleContext(CoreDSL2Parser.ExpressionContext,0) - - - def IDENTIFIER(self): - return self.getToken(CoreDSL2Parser.IDENTIFIER, 0) - - def getRuleIndex(self): - return CoreDSL2Parser.RULE_designator - - def enterRule(self, listener:ParseTreeListener): - if hasattr( listener, "enterDesignator" ): - listener.enterDesignator(self) - - def exitRule(self, listener:ParseTreeListener): - if hasattr( listener, "exitDesignator" ): - listener.exitDesignator(self) - - def accept(self, visitor:ParseTreeVisitor): - if hasattr( visitor, "visitDesignator" ): - return visitor.visitDesignator(self) - else: - return visitor.visitChildren(self) - - - - - def designator(self): - - localctx = CoreDSL2Parser.DesignatorContext(self, self._ctx, self.state) - self.enterRule(localctx, 66, self.RULE_designator) - try: - self.state = 657 - self._errHandler.sync(self) - token = self._input.LA(1) - if token in [91]: - self.enterOuterAlt(localctx, 1) - self.state = 651 - self.match(CoreDSL2Parser.LEFT_BR) - self.state = 652 - localctx.idx = self.expression(0) - self.state = 653 - self.match(CoreDSL2Parser.RIGHT_BR) - pass - elif token in [52]: - self.enterOuterAlt(localctx, 2) - self.state = 655 - self.match(CoreDSL2Parser.T__51) - self.state = 656 - localctx.prop = self.match(CoreDSL2Parser.IDENTIFIER) - pass - else: - raise NoViableAltException(self) - - except RecognitionException as re: - localctx.exception = re - self._errHandler.reportError(self, re) - self._errHandler.recover(self, re) - finally: - self.exitRule() - return localctx - - - class ExpressionContext(ParserRuleContext): - __slots__ = 'parser' - - def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): - super().__init__(parent, invokingState) - self.parser = parser - - - def getRuleIndex(self): - return CoreDSL2Parser.RULE_expression - - - def copyFrom(self, ctx:ParserRuleContext): - super().copyFrom(ctx) - - - class Cast_expressionContext(ExpressionContext): - - def __init__(self, parser, ctx:ParserRuleContext): # actually a CoreDSL2Parser.ExpressionContext - super().__init__(parser) - self.type_ = None # Type_specifierContext - self.sign = None # Integer_signednessContext - self.right = None # ExpressionContext - self.copyFrom(ctx) - - def expression(self): - return self.getTypedRuleContext(CoreDSL2Parser.ExpressionContext,0) - - def type_specifier(self): - return self.getTypedRuleContext(CoreDSL2Parser.Type_specifierContext,0) - - def integer_signedness(self): - return self.getTypedRuleContext(CoreDSL2Parser.Integer_signednessContext,0) - - - def enterRule(self, listener:ParseTreeListener): - if hasattr( listener, "enterCast_expression" ): - listener.enterCast_expression(self) - - def exitRule(self, listener:ParseTreeListener): - if hasattr( listener, "exitCast_expression" ): - listener.exitCast_expression(self) - - def accept(self, visitor:ParseTreeVisitor): - if hasattr( visitor, "visitCast_expression" ): - return visitor.visitCast_expression(self) - else: - return visitor.visitChildren(self) - - - class Binary_expressionContext(ExpressionContext): - - def __init__(self, parser, ctx:ParserRuleContext): # actually a CoreDSL2Parser.ExpressionContext - super().__init__(parser) - self.left = None # ExpressionContext - self.bop = None # Token - self.right = None # ExpressionContext - self.copyFrom(ctx) - - def expression(self, i:int=None): - if i is None: - return self.getTypedRuleContexts(CoreDSL2Parser.ExpressionContext) - else: - return self.getTypedRuleContext(CoreDSL2Parser.ExpressionContext,i) - - - def enterRule(self, listener:ParseTreeListener): - if hasattr( listener, "enterBinary_expression" ): - listener.enterBinary_expression(self) - - def exitRule(self, listener:ParseTreeListener): - if hasattr( listener, "exitBinary_expression" ): - listener.exitBinary_expression(self) - - def accept(self, visitor:ParseTreeVisitor): - if hasattr( visitor, "visitBinary_expression" ): - return visitor.visitBinary_expression(self) - else: - return visitor.visitChildren(self) - - - class Preinc_expressionContext(ExpressionContext): - - def __init__(self, parser, ctx:ParserRuleContext): # actually a CoreDSL2Parser.ExpressionContext - super().__init__(parser) - self.op = None # Token - self.right = None # ExpressionContext - self.copyFrom(ctx) - - def expression(self): - return self.getTypedRuleContext(CoreDSL2Parser.ExpressionContext,0) - - - def enterRule(self, listener:ParseTreeListener): - if hasattr( listener, "enterPreinc_expression" ): - listener.enterPreinc_expression(self) - - def exitRule(self, listener:ParseTreeListener): - if hasattr( listener, "exitPreinc_expression" ): - listener.exitPreinc_expression(self) - - def accept(self, visitor:ParseTreeVisitor): - if hasattr( visitor, "visitPreinc_expression" ): - return visitor.visitPreinc_expression(self) - else: - return visitor.visitChildren(self) - - - class Conditional_expressionContext(ExpressionContext): - - def __init__(self, parser, ctx:ParserRuleContext): # actually a CoreDSL2Parser.ExpressionContext - super().__init__(parser) - self.cond = None # ExpressionContext - self.bop = None # Token - self.then_expr = None # ExpressionContext - self.else_expr = None # ExpressionContext - self.copyFrom(ctx) - - def expression(self, i:int=None): - if i is None: - return self.getTypedRuleContexts(CoreDSL2Parser.ExpressionContext) - else: - return self.getTypedRuleContext(CoreDSL2Parser.ExpressionContext,i) - - - def enterRule(self, listener:ParseTreeListener): - if hasattr( listener, "enterConditional_expression" ): - listener.enterConditional_expression(self) - - def exitRule(self, listener:ParseTreeListener): - if hasattr( listener, "exitConditional_expression" ): - listener.exitConditional_expression(self) - - def accept(self, visitor:ParseTreeVisitor): - if hasattr( visitor, "visitConditional_expression" ): - return visitor.visitConditional_expression(self) - else: - return visitor.visitChildren(self) - - - class Deref_expressionContext(ExpressionContext): - - def __init__(self, parser, ctx:ParserRuleContext): # actually a CoreDSL2Parser.ExpressionContext - super().__init__(parser) - self.bop = None # Token - self.ref = None # Token - self.copyFrom(ctx) - - def IDENTIFIER(self): - return self.getToken(CoreDSL2Parser.IDENTIFIER, 0) - - def enterRule(self, listener:ParseTreeListener): - if hasattr( listener, "enterDeref_expression" ): - listener.enterDeref_expression(self) - - def exitRule(self, listener:ParseTreeListener): - if hasattr( listener, "exitDeref_expression" ): - listener.exitDeref_expression(self) - - def accept(self, visitor:ParseTreeVisitor): - if hasattr( visitor, "visitDeref_expression" ): - return visitor.visitDeref_expression(self) - else: - return visitor.visitChildren(self) - - - class Prefix_expressionContext(ExpressionContext): - - def __init__(self, parser, ctx:ParserRuleContext): # actually a CoreDSL2Parser.ExpressionContext - super().__init__(parser) - self.prefix = None # Token - self.right = None # ExpressionContext - self.copyFrom(ctx) - - def expression(self): - return self.getTypedRuleContext(CoreDSL2Parser.ExpressionContext,0) - - - def enterRule(self, listener:ParseTreeListener): - if hasattr( listener, "enterPrefix_expression" ): - listener.enterPrefix_expression(self) - - def exitRule(self, listener:ParseTreeListener): - if hasattr( listener, "exitPrefix_expression" ): - listener.exitPrefix_expression(self) - - def accept(self, visitor:ParseTreeVisitor): - if hasattr( visitor, "visitPrefix_expression" ): - return visitor.visitPrefix_expression(self) - else: - return visitor.visitChildren(self) - - - class Postinc_expressionContext(ExpressionContext): - - def __init__(self, parser, ctx:ParserRuleContext): # actually a CoreDSL2Parser.ExpressionContext - super().__init__(parser) - self.left = None # ExpressionContext - self.op = None # Token - self.copyFrom(ctx) - - def expression(self): - return self.getTypedRuleContext(CoreDSL2Parser.ExpressionContext,0) - - - def enterRule(self, listener:ParseTreeListener): - if hasattr( listener, "enterPostinc_expression" ): - listener.enterPostinc_expression(self) - - def exitRule(self, listener:ParseTreeListener): - if hasattr( listener, "exitPostinc_expression" ): - listener.exitPostinc_expression(self) - - def accept(self, visitor:ParseTreeVisitor): - if hasattr( visitor, "visitPostinc_expression" ): - return visitor.visitPostinc_expression(self) - else: - return visitor.visitChildren(self) - - - class Concat_expressionContext(ExpressionContext): - - def __init__(self, parser, ctx:ParserRuleContext): # actually a CoreDSL2Parser.ExpressionContext - super().__init__(parser) - self.left = None # ExpressionContext - self.bop = None # Token - self.right = None # ExpressionContext - self.copyFrom(ctx) - - def expression(self, i:int=None): - if i is None: - return self.getTypedRuleContexts(CoreDSL2Parser.ExpressionContext) - else: - return self.getTypedRuleContext(CoreDSL2Parser.ExpressionContext,i) - - - def enterRule(self, listener:ParseTreeListener): - if hasattr( listener, "enterConcat_expression" ): - listener.enterConcat_expression(self) - - def exitRule(self, listener:ParseTreeListener): - if hasattr( listener, "exitConcat_expression" ): - listener.exitConcat_expression(self) - - def accept(self, visitor:ParseTreeVisitor): - if hasattr( visitor, "visitConcat_expression" ): - return visitor.visitConcat_expression(self) - else: - return visitor.visitChildren(self) - - - class Assignment_expressionContext(ExpressionContext): - - def __init__(self, parser, ctx:ParserRuleContext): # actually a CoreDSL2Parser.ExpressionContext - super().__init__(parser) - self.left = None # ExpressionContext - self.bop = None # Token - self.right = None # ExpressionContext - self.copyFrom(ctx) - - def expression(self, i:int=None): - if i is None: - return self.getTypedRuleContexts(CoreDSL2Parser.ExpressionContext) - else: - return self.getTypedRuleContext(CoreDSL2Parser.ExpressionContext,i) - - - def enterRule(self, listener:ParseTreeListener): - if hasattr( listener, "enterAssignment_expression" ): - listener.enterAssignment_expression(self) - - def exitRule(self, listener:ParseTreeListener): - if hasattr( listener, "exitAssignment_expression" ): - listener.exitAssignment_expression(self) - - def accept(self, visitor:ParseTreeVisitor): - if hasattr( visitor, "visitAssignment_expression" ): - return visitor.visitAssignment_expression(self) - else: - return visitor.visitChildren(self) - - - class Method_callContext(ExpressionContext): - - def __init__(self, parser, ctx:ParserRuleContext): # actually a CoreDSL2Parser.ExpressionContext - super().__init__(parser) - self.ref = None # Token - self._expression = None # ExpressionContext - self.args = list() # of ExpressionContexts - self.copyFrom(ctx) - - def IDENTIFIER(self): - return self.getToken(CoreDSL2Parser.IDENTIFIER, 0) - def expression(self, i:int=None): - if i is None: - return self.getTypedRuleContexts(CoreDSL2Parser.ExpressionContext) - else: - return self.getTypedRuleContext(CoreDSL2Parser.ExpressionContext,i) - - - def enterRule(self, listener:ParseTreeListener): - if hasattr( listener, "enterMethod_call" ): - listener.enterMethod_call(self) - - def exitRule(self, listener:ParseTreeListener): - if hasattr( listener, "exitMethod_call" ): - listener.exitMethod_call(self) - - def accept(self, visitor:ParseTreeVisitor): - if hasattr( visitor, "visitMethod_call" ): - return visitor.visitMethod_call(self) - else: - return visitor.visitChildren(self) - - - class Primary_expressionContext(ExpressionContext): - - def __init__(self, parser, ctx:ParserRuleContext): # actually a CoreDSL2Parser.ExpressionContext - super().__init__(parser) - self.copyFrom(ctx) - - def primary(self): - return self.getTypedRuleContext(CoreDSL2Parser.PrimaryContext,0) - - - def enterRule(self, listener:ParseTreeListener): - if hasattr( listener, "enterPrimary_expression" ): - listener.enterPrimary_expression(self) - - def exitRule(self, listener:ParseTreeListener): - if hasattr( listener, "exitPrimary_expression" ): - listener.exitPrimary_expression(self) - - def accept(self, visitor:ParseTreeVisitor): - if hasattr( visitor, "visitPrimary_expression" ): - return visitor.visitPrimary_expression(self) - else: - return visitor.visitChildren(self) - - - class Slice_expressionContext(ExpressionContext): - - def __init__(self, parser, ctx:ParserRuleContext): # actually a CoreDSL2Parser.ExpressionContext - super().__init__(parser) - self.expr = None # ExpressionContext - self.bop = None # Token - self.left = None # ExpressionContext - self.right = None # ExpressionContext - self.copyFrom(ctx) - - def RIGHT_BR(self): - return self.getToken(CoreDSL2Parser.RIGHT_BR, 0) - def expression(self, i:int=None): - if i is None: - return self.getTypedRuleContexts(CoreDSL2Parser.ExpressionContext) - else: - return self.getTypedRuleContext(CoreDSL2Parser.ExpressionContext,i) - - def LEFT_BR(self): - return self.getToken(CoreDSL2Parser.LEFT_BR, 0) - - def enterRule(self, listener:ParseTreeListener): - if hasattr( listener, "enterSlice_expression" ): - listener.enterSlice_expression(self) - - def exitRule(self, listener:ParseTreeListener): - if hasattr( listener, "exitSlice_expression" ): - listener.exitSlice_expression(self) - - def accept(self, visitor:ParseTreeVisitor): - if hasattr( visitor, "visitSlice_expression" ): - return visitor.visitSlice_expression(self) - else: - return visitor.visitChildren(self) - - - - def expression(self, _p:int=0): - _parentctx = self._ctx - _parentState = self.state - localctx = CoreDSL2Parser.ExpressionContext(self, self._ctx, _parentState) - _prevctx = localctx - _startState = 68 - self.enterRecursionRule(localctx, 68, self.RULE_expression, _p) - self._la = 0 # Token type - try: - self.enterOuterAlt(localctx, 1) - self.state = 690 - self._errHandler.sync(self) - la_ = self._interp.adaptivePredict(self._input,81,self._ctx) - if la_ == 1: - localctx = CoreDSL2Parser.Primary_expressionContext(self, localctx) - self._ctx = localctx - _prevctx = localctx - - self.state = 660 - self.primary() - pass - - elif la_ == 2: - localctx = CoreDSL2Parser.Deref_expressionContext(self, localctx) - self._ctx = localctx - _prevctx = localctx - self.state = 661 - localctx.bop = self._input.LT(1) - _la = self._input.LA(1) - if not(_la==52 or _la==53): - localctx.bop = self._errHandler.recoverInline(self) - else: - self._errHandler.reportMatch(self) - self.consume() - self.state = 662 - localctx.ref = self.match(CoreDSL2Parser.IDENTIFIER) - pass - - elif la_ == 3: - localctx = CoreDSL2Parser.Method_callContext(self, localctx) - self._ctx = localctx - _prevctx = localctx - self.state = 663 - localctx.ref = self.match(CoreDSL2Parser.IDENTIFIER) - self.state = 664 - self.match(CoreDSL2Parser.T__19) - self.state = 673 - self._errHandler.sync(self) - _la = self._input.LA(1) - if (((_la) & ~0x3f) == 0 and ((1 << _la) & 1148417956520132608) != 0) or ((((_la - 93)) & ~0x3f) == 0 and ((1 << (_la - 93)) & 127) != 0): - self.state = 665 - localctx._expression = self.expression(0) - localctx.args.append(localctx._expression) - self.state = 670 - self._errHandler.sync(self) - _la = self._input.LA(1) - while _la==4: - self.state = 666 - self.match(CoreDSL2Parser.T__3) - self.state = 667 - localctx._expression = self.expression(0) - localctx.args.append(localctx._expression) - self.state = 672 - self._errHandler.sync(self) - _la = self._input.LA(1) - - - - self.state = 675 - self.match(CoreDSL2Parser.T__20) - pass - - elif la_ == 4: - localctx = CoreDSL2Parser.Preinc_expressionContext(self, localctx) - self._ctx = localctx - _prevctx = localctx - self.state = 676 - localctx.op = self._input.LT(1) - _la = self._input.LA(1) - if not(_la==54 or _la==55): - localctx.op = self._errHandler.recoverInline(self) - else: - self._errHandler.reportMatch(self) - self.consume() - self.state = 677 - localctx.right = self.expression(17) - pass - - elif la_ == 5: - localctx = CoreDSL2Parser.Prefix_expressionContext(self, localctx) - self._ctx = localctx - _prevctx = localctx - self.state = 678 - localctx.prefix = self._input.LT(1) - _la = self._input.LA(1) - if not((((_la) & ~0x3f) == 0 and ((1 << _la) & 216172833653391360) != 0)): - localctx.prefix = self._errHandler.recoverInline(self) - else: - self._errHandler.reportMatch(self) - self.consume() - self.state = 679 - localctx.right = self.expression(16) - pass - - elif la_ == 6: - localctx = CoreDSL2Parser.Prefix_expressionContext(self, localctx) - self._ctx = localctx - _prevctx = localctx - self.state = 680 - localctx.prefix = self._input.LT(1) - _la = self._input.LA(1) - if not(_la==58 or _la==59): - localctx.prefix = self._errHandler.recoverInline(self) - else: - self._errHandler.reportMatch(self) - self.consume() - self.state = 681 - localctx.right = self.expression(15) - pass - - elif la_ == 7: - localctx = CoreDSL2Parser.Cast_expressionContext(self, localctx) - self._ctx = localctx - _prevctx = localctx - self.state = 682 - self.match(CoreDSL2Parser.T__19) - self.state = 685 - self._errHandler.sync(self) - la_ = self._interp.adaptivePredict(self._input,80,self._ctx) - if la_ == 1: - self.state = 683 - localctx.type_ = self.type_specifier() - pass - - elif la_ == 2: - self.state = 684 - localctx.sign = self.integer_signedness() - pass - - - self.state = 687 - self.match(CoreDSL2Parser.T__20) - self.state = 688 - localctx.right = self.expression(14) - pass - - - self._ctx.stop = self._input.LT(-1) - self.state = 747 - self._errHandler.sync(self) - _alt = self._interp.adaptivePredict(self._input,84,self._ctx) - while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER: - if _alt==1: - if self._parseListeners is not None: - self.triggerExitRuleEvent() - _prevctx = localctx - self.state = 745 - self._errHandler.sync(self) - la_ = self._interp.adaptivePredict(self._input,83,self._ctx) - if la_ == 1: - localctx = CoreDSL2Parser.Binary_expressionContext(self, CoreDSL2Parser.ExpressionContext(self, _parentctx, _parentState)) - localctx.left = _prevctx - self.pushNewRecursionContext(localctx, _startState, self.RULE_expression) - self.state = 692 - if not self.precpred(self._ctx, 13): - from antlr4.error.Errors import FailedPredicateException - raise FailedPredicateException(self, "self.precpred(self._ctx, 13)") - self.state = 693 - localctx.bop = self._input.LT(1) - _la = self._input.LA(1) - if not((((_la) & ~0x3f) == 0 and ((1 << _la) & 3458764531000410112) != 0)): - localctx.bop = self._errHandler.recoverInline(self) - else: - self._errHandler.reportMatch(self) - self.consume() - self.state = 694 - localctx.right = self.expression(14) - pass - - elif la_ == 2: - localctx = CoreDSL2Parser.Binary_expressionContext(self, CoreDSL2Parser.ExpressionContext(self, _parentctx, _parentState)) - localctx.left = _prevctx - self.pushNewRecursionContext(localctx, _startState, self.RULE_expression) - self.state = 695 - if not self.precpred(self._ctx, 12): - from antlr4.error.Errors import FailedPredicateException - raise FailedPredicateException(self, "self.precpred(self._ctx, 12)") - self.state = 696 - localctx.bop = self._input.LT(1) - _la = self._input.LA(1) - if not(_la==56 or _la==57): - localctx.bop = self._errHandler.recoverInline(self) - else: - self._errHandler.reportMatch(self) - self.consume() - self.state = 697 - localctx.right = self.expression(13) - pass - - elif la_ == 3: - localctx = CoreDSL2Parser.Binary_expressionContext(self, CoreDSL2Parser.ExpressionContext(self, _parentctx, _parentState)) - localctx.left = _prevctx - self.pushNewRecursionContext(localctx, _startState, self.RULE_expression) - self.state = 698 - if not self.precpred(self._ctx, 11): - from antlr4.error.Errors import FailedPredicateException - raise FailedPredicateException(self, "self.precpred(self._ctx, 11)") - self.state = 699 - localctx.bop = self._input.LT(1) - _la = self._input.LA(1) - if not(_la==62 or _la==63): - localctx.bop = self._errHandler.recoverInline(self) - else: - self._errHandler.reportMatch(self) - self.consume() - self.state = 700 - localctx.right = self.expression(12) - pass - - elif la_ == 4: - localctx = CoreDSL2Parser.Binary_expressionContext(self, CoreDSL2Parser.ExpressionContext(self, _parentctx, _parentState)) - localctx.left = _prevctx - self.pushNewRecursionContext(localctx, _startState, self.RULE_expression) - self.state = 701 - if not self.precpred(self._ctx, 10): - from antlr4.error.Errors import FailedPredicateException - raise FailedPredicateException(self, "self.precpred(self._ctx, 10)") - self.state = 702 - localctx.bop = self._input.LT(1) - _la = self._input.LA(1) - if not(((((_la - 36)) & ~0x3f) == 0 and ((1 << (_la - 36)) & 805306371) != 0)): - localctx.bop = self._errHandler.recoverInline(self) - else: - self._errHandler.reportMatch(self) - self.consume() - self.state = 703 - localctx.right = self.expression(11) - pass - - elif la_ == 5: - localctx = CoreDSL2Parser.Binary_expressionContext(self, CoreDSL2Parser.ExpressionContext(self, _parentctx, _parentState)) - localctx.left = _prevctx - self.pushNewRecursionContext(localctx, _startState, self.RULE_expression) - self.state = 704 - if not self.precpred(self._ctx, 9): - from antlr4.error.Errors import FailedPredicateException - raise FailedPredicateException(self, "self.precpred(self._ctx, 9)") - self.state = 705 - localctx.bop = self._input.LT(1) - _la = self._input.LA(1) - if not(_la==66 or _la==67): - localctx.bop = self._errHandler.recoverInline(self) - else: - self._errHandler.reportMatch(self) - self.consume() - self.state = 706 - localctx.right = self.expression(10) - pass - - elif la_ == 6: - localctx = CoreDSL2Parser.Binary_expressionContext(self, CoreDSL2Parser.ExpressionContext(self, _parentctx, _parentState)) - localctx.left = _prevctx - self.pushNewRecursionContext(localctx, _startState, self.RULE_expression) - self.state = 707 - if not self.precpred(self._ctx, 8): - from antlr4.error.Errors import FailedPredicateException - raise FailedPredicateException(self, "self.precpred(self._ctx, 8)") - self.state = 708 - localctx.bop = self.match(CoreDSL2Parser.T__34) - self.state = 709 - localctx.right = self.expression(9) - pass - - elif la_ == 7: - localctx = CoreDSL2Parser.Binary_expressionContext(self, CoreDSL2Parser.ExpressionContext(self, _parentctx, _parentState)) - localctx.left = _prevctx - self.pushNewRecursionContext(localctx, _startState, self.RULE_expression) - self.state = 710 - if not self.precpred(self._ctx, 7): - from antlr4.error.Errors import FailedPredicateException - raise FailedPredicateException(self, "self.precpred(self._ctx, 7)") - self.state = 711 - localctx.bop = self.match(CoreDSL2Parser.T__67) - self.state = 712 - localctx.right = self.expression(8) - pass - - elif la_ == 8: - localctx = CoreDSL2Parser.Binary_expressionContext(self, CoreDSL2Parser.ExpressionContext(self, _parentctx, _parentState)) - localctx.left = _prevctx - self.pushNewRecursionContext(localctx, _startState, self.RULE_expression) - self.state = 713 - if not self.precpred(self._ctx, 6): - from antlr4.error.Errors import FailedPredicateException - raise FailedPredicateException(self, "self.precpred(self._ctx, 6)") - self.state = 714 - localctx.bop = self.match(CoreDSL2Parser.T__68) - self.state = 715 - localctx.right = self.expression(7) - pass - - elif la_ == 9: - localctx = CoreDSL2Parser.Binary_expressionContext(self, CoreDSL2Parser.ExpressionContext(self, _parentctx, _parentState)) - localctx.left = _prevctx - self.pushNewRecursionContext(localctx, _startState, self.RULE_expression) - self.state = 716 - if not self.precpred(self._ctx, 5): - from antlr4.error.Errors import FailedPredicateException - raise FailedPredicateException(self, "self.precpred(self._ctx, 5)") - self.state = 717 - localctx.bop = self.match(CoreDSL2Parser.T__69) - self.state = 718 - localctx.right = self.expression(6) - pass - - elif la_ == 10: - localctx = CoreDSL2Parser.Binary_expressionContext(self, CoreDSL2Parser.ExpressionContext(self, _parentctx, _parentState)) - localctx.left = _prevctx - self.pushNewRecursionContext(localctx, _startState, self.RULE_expression) - self.state = 719 - if not self.precpred(self._ctx, 4): - from antlr4.error.Errors import FailedPredicateException - raise FailedPredicateException(self, "self.precpred(self._ctx, 4)") - self.state = 720 - localctx.bop = self.match(CoreDSL2Parser.T__70) - self.state = 721 - localctx.right = self.expression(5) - pass - - elif la_ == 11: - localctx = CoreDSL2Parser.Concat_expressionContext(self, CoreDSL2Parser.ExpressionContext(self, _parentctx, _parentState)) - localctx.left = _prevctx - self.pushNewRecursionContext(localctx, _startState, self.RULE_expression) - self.state = 722 - if not self.precpred(self._ctx, 3): - from antlr4.error.Errors import FailedPredicateException - raise FailedPredicateException(self, "self.precpred(self._ctx, 3)") - self.state = 723 - localctx.bop = self.match(CoreDSL2Parser.T__15) - self.state = 724 - localctx.right = self.expression(4) - pass - - elif la_ == 12: - localctx = CoreDSL2Parser.Conditional_expressionContext(self, CoreDSL2Parser.ExpressionContext(self, _parentctx, _parentState)) - localctx.cond = _prevctx - self.pushNewRecursionContext(localctx, _startState, self.RULE_expression) - self.state = 725 - if not self.precpred(self._ctx, 2): - from antlr4.error.Errors import FailedPredicateException - raise FailedPredicateException(self, "self.precpred(self._ctx, 2)") - self.state = 726 - localctx.bop = self.match(CoreDSL2Parser.T__71) - self.state = 727 - localctx.then_expr = self.expression(0) - self.state = 728 - self.match(CoreDSL2Parser.T__14) - self.state = 729 - localctx.else_expr = self.expression(2) - pass - - elif la_ == 13: - localctx = CoreDSL2Parser.Assignment_expressionContext(self, CoreDSL2Parser.ExpressionContext(self, _parentctx, _parentState)) - localctx.left = _prevctx - self.pushNewRecursionContext(localctx, _startState, self.RULE_expression) - self.state = 731 - if not self.precpred(self._ctx, 1): - from antlr4.error.Errors import FailedPredicateException - raise FailedPredicateException(self, "self.precpred(self._ctx, 1)") - self.state = 732 - localctx.bop = self._input.LT(1) - _la = self._input.LA(1) - if not(((((_la - 50)) & ~0x3f) == 0 and ((1 << (_la - 50)) & 17171480577) != 0)): - localctx.bop = self._errHandler.recoverInline(self) - else: - self._errHandler.reportMatch(self) - self.consume() - self.state = 733 - localctx.right = self.expression(1) - pass - - elif la_ == 14: - localctx = CoreDSL2Parser.Slice_expressionContext(self, CoreDSL2Parser.ExpressionContext(self, _parentctx, _parentState)) - localctx.expr = _prevctx - self.pushNewRecursionContext(localctx, _startState, self.RULE_expression) - self.state = 734 - if not self.precpred(self._ctx, 20): - from antlr4.error.Errors import FailedPredicateException - raise FailedPredicateException(self, "self.precpred(self._ctx, 20)") - self.state = 735 - localctx.bop = self.match(CoreDSL2Parser.LEFT_BR) - self.state = 736 - localctx.left = self.expression(0) - self.state = 739 - self._errHandler.sync(self) - _la = self._input.LA(1) - if _la==15: - self.state = 737 - self.match(CoreDSL2Parser.T__14) - self.state = 738 - localctx.right = self.expression(0) - - - self.state = 741 - self.match(CoreDSL2Parser.RIGHT_BR) - pass - - elif la_ == 15: - localctx = CoreDSL2Parser.Postinc_expressionContext(self, CoreDSL2Parser.ExpressionContext(self, _parentctx, _parentState)) - localctx.left = _prevctx - self.pushNewRecursionContext(localctx, _startState, self.RULE_expression) - self.state = 743 - if not self.precpred(self._ctx, 18): - from antlr4.error.Errors import FailedPredicateException - raise FailedPredicateException(self, "self.precpred(self._ctx, 18)") - self.state = 744 - localctx.op = self._input.LT(1) - _la = self._input.LA(1) - if not(_la==54 or _la==55): - localctx.op = self._errHandler.recoverInline(self) - else: - self._errHandler.reportMatch(self) - self.consume() - pass - - - self.state = 749 - self._errHandler.sync(self) - _alt = self._interp.adaptivePredict(self._input,84,self._ctx) - - except RecognitionException as re: - localctx.exception = re - self._errHandler.reportError(self, re) - self._errHandler.recover(self, re) - finally: - self.unrollRecursionContexts(_parentctx) - return localctx - - - class PrimaryContext(ParserRuleContext): - __slots__ = 'parser' - - def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): - super().__init__(parent, invokingState) - self.parser = parser - - - def getRuleIndex(self): - return CoreDSL2Parser.RULE_primary - - - def copyFrom(self, ctx:ParserRuleContext): - super().copyFrom(ctx) - - - - class Reference_expressionContext(PrimaryContext): - - def __init__(self, parser, ctx:ParserRuleContext): # actually a CoreDSL2Parser.PrimaryContext - super().__init__(parser) - self.ref = None # Token - self.copyFrom(ctx) - - def IDENTIFIER(self): - return self.getToken(CoreDSL2Parser.IDENTIFIER, 0) - - def enterRule(self, listener:ParseTreeListener): - if hasattr( listener, "enterReference_expression" ): - listener.enterReference_expression(self) - - def exitRule(self, listener:ParseTreeListener): - if hasattr( listener, "exitReference_expression" ): - listener.exitReference_expression(self) - - def accept(self, visitor:ParseTreeVisitor): - if hasattr( visitor, "visitReference_expression" ): - return visitor.visitReference_expression(self) - else: - return visitor.visitChildren(self) - - - class Constant_expressionContext(PrimaryContext): - - def __init__(self, parser, ctx:ParserRuleContext): # actually a CoreDSL2Parser.PrimaryContext - super().__init__(parser) - self.const_expr = None # ConstantContext - self.copyFrom(ctx) - - def constant(self): - return self.getTypedRuleContext(CoreDSL2Parser.ConstantContext,0) - - - def enterRule(self, listener:ParseTreeListener): - if hasattr( listener, "enterConstant_expression" ): - listener.enterConstant_expression(self) - - def exitRule(self, listener:ParseTreeListener): - if hasattr( listener, "exitConstant_expression" ): - listener.exitConstant_expression(self) - - def accept(self, visitor:ParseTreeVisitor): - if hasattr( visitor, "visitConstant_expression" ): - return visitor.visitConstant_expression(self) - else: - return visitor.visitChildren(self) - - - class Literal_expressionContext(PrimaryContext): - - def __init__(self, parser, ctx:ParserRuleContext): # actually a CoreDSL2Parser.PrimaryContext - super().__init__(parser) - self._string_literal = None # String_literalContext - self.literal = list() # of String_literalContexts - self.copyFrom(ctx) - - def string_literal(self, i:int=None): - if i is None: - return self.getTypedRuleContexts(CoreDSL2Parser.String_literalContext) - else: - return self.getTypedRuleContext(CoreDSL2Parser.String_literalContext,i) - - - def enterRule(self, listener:ParseTreeListener): - if hasattr( listener, "enterLiteral_expression" ): - listener.enterLiteral_expression(self) - - def exitRule(self, listener:ParseTreeListener): - if hasattr( listener, "exitLiteral_expression" ): - listener.exitLiteral_expression(self) - - def accept(self, visitor:ParseTreeVisitor): - if hasattr( visitor, "visitLiteral_expression" ): - return visitor.visitLiteral_expression(self) - else: - return visitor.visitChildren(self) - - - class Parens_expressionContext(PrimaryContext): - - def __init__(self, parser, ctx:ParserRuleContext): # actually a CoreDSL2Parser.PrimaryContext - super().__init__(parser) - self.expr = None # ExpressionContext - self.copyFrom(ctx) - - def expression(self): - return self.getTypedRuleContext(CoreDSL2Parser.ExpressionContext,0) - - - def enterRule(self, listener:ParseTreeListener): - if hasattr( listener, "enterParens_expression" ): - listener.enterParens_expression(self) - - def exitRule(self, listener:ParseTreeListener): - if hasattr( listener, "exitParens_expression" ): - listener.exitParens_expression(self) - - def accept(self, visitor:ParseTreeVisitor): - if hasattr( visitor, "visitParens_expression" ): - return visitor.visitParens_expression(self) - else: - return visitor.visitChildren(self) - - - - def primary(self): - - localctx = CoreDSL2Parser.PrimaryContext(self, self._ctx, self.state) - self.enterRule(localctx, 70, self.RULE_primary) - try: - self.state = 761 - self._errHandler.sync(self) - la_ = self._interp.adaptivePredict(self._input,86,self._ctx) - if la_ == 1: - localctx = CoreDSL2Parser.Reference_expressionContext(self, localctx) - self.enterOuterAlt(localctx, 1) - self.state = 750 - localctx.ref = self.match(CoreDSL2Parser.IDENTIFIER) - pass - - elif la_ == 2: - localctx = CoreDSL2Parser.Constant_expressionContext(self, localctx) - self.enterOuterAlt(localctx, 2) - self.state = 751 - localctx.const_expr = self.constant() - pass - - elif la_ == 3: - localctx = CoreDSL2Parser.Literal_expressionContext(self, localctx) - self.enterOuterAlt(localctx, 3) - self.state = 753 - self._errHandler.sync(self) - _alt = 1 - while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER: - if _alt == 1: - self.state = 752 - localctx._string_literal = self.string_literal() - localctx.literal.append(localctx._string_literal) - - else: - raise NoViableAltException(self) - self.state = 755 - self._errHandler.sync(self) - _alt = self._interp.adaptivePredict(self._input,85,self._ctx) - - pass - - elif la_ == 4: - localctx = CoreDSL2Parser.Parens_expressionContext(self, localctx) - self.enterOuterAlt(localctx, 4) - self.state = 757 - self.match(CoreDSL2Parser.T__19) - self.state = 758 - localctx.expr = self.expression(0) - self.state = 759 - self.match(CoreDSL2Parser.T__20) - pass - - - except RecognitionException as re: - localctx.exception = re - self._errHandler.reportError(self, re) - self._errHandler.recover(self, re) - finally: - self.exitRule() - return localctx - - - class String_literalContext(ParserRuleContext): - __slots__ = 'parser' - - def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): - super().__init__(parent, invokingState) - self.parser = parser - - def ENCSTRINGCONST(self): - return self.getToken(CoreDSL2Parser.ENCSTRINGCONST, 0) - - def STRING(self): - return self.getToken(CoreDSL2Parser.STRING, 0) - - def getRuleIndex(self): - return CoreDSL2Parser.RULE_string_literal - - def enterRule(self, listener:ParseTreeListener): - if hasattr( listener, "enterString_literal" ): - listener.enterString_literal(self) - - def exitRule(self, listener:ParseTreeListener): - if hasattr( listener, "exitString_literal" ): - listener.exitString_literal(self) - - def accept(self, visitor:ParseTreeVisitor): - if hasattr( visitor, "visitString_literal" ): - return visitor.visitString_literal(self) - else: - return visitor.visitChildren(self) - - - - - def string_literal(self): - - localctx = CoreDSL2Parser.String_literalContext(self, self._ctx, self.state) - self.enterRule(localctx, 72, self.RULE_string_literal) - self._la = 0 # Token type - try: - self.enterOuterAlt(localctx, 1) - self.state = 763 - _la = self._input.LA(1) - if not(_la==98 or _la==99): - self._errHandler.recoverInline(self) - else: - self._errHandler.reportMatch(self) - self.consume() - except RecognitionException as re: - localctx.exception = re - self._errHandler.reportError(self, re) - self._errHandler.recover(self, re) - finally: - self.exitRule() - return localctx - - - class ConstantContext(ParserRuleContext): - __slots__ = 'parser' - - def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): - super().__init__(parent, invokingState) - self.parser = parser - - def integer_constant(self): - return self.getTypedRuleContext(CoreDSL2Parser.Integer_constantContext,0) - - - def floating_constant(self): - return self.getTypedRuleContext(CoreDSL2Parser.Floating_constantContext,0) - - - def character_constant(self): - return self.getTypedRuleContext(CoreDSL2Parser.Character_constantContext,0) - - - def string_constant(self): - return self.getTypedRuleContext(CoreDSL2Parser.String_constantContext,0) - - - def bool_constant(self): - return self.getTypedRuleContext(CoreDSL2Parser.Bool_constantContext,0) - - - def getRuleIndex(self): - return CoreDSL2Parser.RULE_constant - - def enterRule(self, listener:ParseTreeListener): - if hasattr( listener, "enterConstant" ): - listener.enterConstant(self) - - def exitRule(self, listener:ParseTreeListener): - if hasattr( listener, "exitConstant" ): - listener.exitConstant(self) - - def accept(self, visitor:ParseTreeVisitor): - if hasattr( visitor, "visitConstant" ): - return visitor.visitConstant(self) - else: - return visitor.visitChildren(self) - - - - - def constant(self): - - localctx = CoreDSL2Parser.ConstantContext(self, self._ctx, self.state) - self.enterRule(localctx, 74, self.RULE_constant) - try: - self.state = 770 - self._errHandler.sync(self) - token = self._input.LA(1) - if token in [95]: - self.enterOuterAlt(localctx, 1) - self.state = 765 - self.integer_constant() - pass - elif token in [94]: - self.enterOuterAlt(localctx, 2) - self.state = 766 - self.floating_constant() - pass - elif token in [97]: - self.enterOuterAlt(localctx, 3) - self.state = 767 - self.character_constant() - pass - elif token in [99]: - self.enterOuterAlt(localctx, 4) - self.state = 768 - self.string_constant() - pass - elif token in [93]: - self.enterOuterAlt(localctx, 5) - self.state = 769 - self.bool_constant() - pass - else: - raise NoViableAltException(self) - - except RecognitionException as re: - localctx.exception = re - self._errHandler.reportError(self, re) - self._errHandler.recover(self, re) - finally: - self.exitRule() - return localctx - - - class Integer_constantContext(ParserRuleContext): - __slots__ = 'parser' - - def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): - super().__init__(parent, invokingState) - self.parser = parser - self.value = None # Token - - def INTEGER(self): - return self.getToken(CoreDSL2Parser.INTEGER, 0) - - def getRuleIndex(self): - return CoreDSL2Parser.RULE_integer_constant - - def enterRule(self, listener:ParseTreeListener): - if hasattr( listener, "enterInteger_constant" ): - listener.enterInteger_constant(self) - - def exitRule(self, listener:ParseTreeListener): - if hasattr( listener, "exitInteger_constant" ): - listener.exitInteger_constant(self) - - def accept(self, visitor:ParseTreeVisitor): - if hasattr( visitor, "visitInteger_constant" ): - return visitor.visitInteger_constant(self) - else: - return visitor.visitChildren(self) - - - - - def integer_constant(self): - - localctx = CoreDSL2Parser.Integer_constantContext(self, self._ctx, self.state) - self.enterRule(localctx, 76, self.RULE_integer_constant) - try: - self.enterOuterAlt(localctx, 1) - self.state = 772 - localctx.value = self.match(CoreDSL2Parser.INTEGER) - except RecognitionException as re: - localctx.exception = re - self._errHandler.reportError(self, re) - self._errHandler.recover(self, re) - finally: - self.exitRule() - return localctx - - - class Floating_constantContext(ParserRuleContext): - __slots__ = 'parser' - - def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): - super().__init__(parent, invokingState) - self.parser = parser - self.value = None # Token - - def FLOAT(self): - return self.getToken(CoreDSL2Parser.FLOAT, 0) - - def getRuleIndex(self): - return CoreDSL2Parser.RULE_floating_constant - - def enterRule(self, listener:ParseTreeListener): - if hasattr( listener, "enterFloating_constant" ): - listener.enterFloating_constant(self) - - def exitRule(self, listener:ParseTreeListener): - if hasattr( listener, "exitFloating_constant" ): - listener.exitFloating_constant(self) - - def accept(self, visitor:ParseTreeVisitor): - if hasattr( visitor, "visitFloating_constant" ): - return visitor.visitFloating_constant(self) - else: - return visitor.visitChildren(self) - - - - - def floating_constant(self): - - localctx = CoreDSL2Parser.Floating_constantContext(self, self._ctx, self.state) - self.enterRule(localctx, 78, self.RULE_floating_constant) - try: - self.enterOuterAlt(localctx, 1) - self.state = 774 - localctx.value = self.match(CoreDSL2Parser.FLOAT) - except RecognitionException as re: - localctx.exception = re - self._errHandler.reportError(self, re) - self._errHandler.recover(self, re) - finally: - self.exitRule() - return localctx - - - class Bool_constantContext(ParserRuleContext): - __slots__ = 'parser' - - def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): - super().__init__(parent, invokingState) - self.parser = parser - self.value = None # Token - - def BOOLEAN(self): - return self.getToken(CoreDSL2Parser.BOOLEAN, 0) - - def getRuleIndex(self): - return CoreDSL2Parser.RULE_bool_constant - - def enterRule(self, listener:ParseTreeListener): - if hasattr( listener, "enterBool_constant" ): - listener.enterBool_constant(self) - - def exitRule(self, listener:ParseTreeListener): - if hasattr( listener, "exitBool_constant" ): - listener.exitBool_constant(self) - - def accept(self, visitor:ParseTreeVisitor): - if hasattr( visitor, "visitBool_constant" ): - return visitor.visitBool_constant(self) - else: - return visitor.visitChildren(self) - - - - - def bool_constant(self): - - localctx = CoreDSL2Parser.Bool_constantContext(self, self._ctx, self.state) - self.enterRule(localctx, 80, self.RULE_bool_constant) - try: - self.enterOuterAlt(localctx, 1) - self.state = 776 - localctx.value = self.match(CoreDSL2Parser.BOOLEAN) - except RecognitionException as re: - localctx.exception = re - self._errHandler.reportError(self, re) - self._errHandler.recover(self, re) - finally: - self.exitRule() - return localctx - - - class Character_constantContext(ParserRuleContext): - __slots__ = 'parser' - - def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): - super().__init__(parent, invokingState) - self.parser = parser - self.value = None # Token - - def CHARCONST(self): - return self.getToken(CoreDSL2Parser.CHARCONST, 0) - - def getRuleIndex(self): - return CoreDSL2Parser.RULE_character_constant - - def enterRule(self, listener:ParseTreeListener): - if hasattr( listener, "enterCharacter_constant" ): - listener.enterCharacter_constant(self) - - def exitRule(self, listener:ParseTreeListener): - if hasattr( listener, "exitCharacter_constant" ): - listener.exitCharacter_constant(self) - - def accept(self, visitor:ParseTreeVisitor): - if hasattr( visitor, "visitCharacter_constant" ): - return visitor.visitCharacter_constant(self) - else: - return visitor.visitChildren(self) - - - - - def character_constant(self): - - localctx = CoreDSL2Parser.Character_constantContext(self, self._ctx, self.state) - self.enterRule(localctx, 82, self.RULE_character_constant) - try: - self.enterOuterAlt(localctx, 1) - self.state = 778 - localctx.value = self.match(CoreDSL2Parser.CHARCONST) - except RecognitionException as re: - localctx.exception = re - self._errHandler.reportError(self, re) - self._errHandler.recover(self, re) - finally: - self.exitRule() - return localctx - - - class String_constantContext(ParserRuleContext): - __slots__ = 'parser' - - def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): - super().__init__(parent, invokingState) - self.parser = parser - self.value = None # Token - - def STRING(self): - return self.getToken(CoreDSL2Parser.STRING, 0) - - def getRuleIndex(self): - return CoreDSL2Parser.RULE_string_constant - - def enterRule(self, listener:ParseTreeListener): - if hasattr( listener, "enterString_constant" ): - listener.enterString_constant(self) - - def exitRule(self, listener:ParseTreeListener): - if hasattr( listener, "exitString_constant" ): - listener.exitString_constant(self) - - def accept(self, visitor:ParseTreeVisitor): - if hasattr( visitor, "visitString_constant" ): - return visitor.visitString_constant(self) - else: - return visitor.visitChildren(self) - - - - - def string_constant(self): - - localctx = CoreDSL2Parser.String_constantContext(self, self._ctx, self.state) - self.enterRule(localctx, 84, self.RULE_string_constant) - try: - self.enterOuterAlt(localctx, 1) - self.state = 780 - localctx.value = self.match(CoreDSL2Parser.STRING) - except RecognitionException as re: - localctx.exception = re - self._errHandler.reportError(self, re) - self._errHandler.recover(self, re) - finally: - self.exitRule() - return localctx - - - class Double_left_bracketContext(ParserRuleContext): - __slots__ = 'parser' - - def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): - super().__init__(parent, invokingState) - self.parser = parser - - def LEFT_BR(self, i:int=None): - if i is None: - return self.getTokens(CoreDSL2Parser.LEFT_BR) - else: - return self.getToken(CoreDSL2Parser.LEFT_BR, i) - - def getRuleIndex(self): - return CoreDSL2Parser.RULE_double_left_bracket - - def enterRule(self, listener:ParseTreeListener): - if hasattr( listener, "enterDouble_left_bracket" ): - listener.enterDouble_left_bracket(self) - - def exitRule(self, listener:ParseTreeListener): - if hasattr( listener, "exitDouble_left_bracket" ): - listener.exitDouble_left_bracket(self) - - def accept(self, visitor:ParseTreeVisitor): - if hasattr( visitor, "visitDouble_left_bracket" ): - return visitor.visitDouble_left_bracket(self) - else: - return visitor.visitChildren(self) - - - - - def double_left_bracket(self): - - localctx = CoreDSL2Parser.Double_left_bracketContext(self, self._ctx, self.state) - self.enterRule(localctx, 86, self.RULE_double_left_bracket) - try: - self.enterOuterAlt(localctx, 1) - self.state = 782 - self.match(CoreDSL2Parser.LEFT_BR) - self.state = 783 - self.match(CoreDSL2Parser.LEFT_BR) - except RecognitionException as re: - localctx.exception = re - self._errHandler.reportError(self, re) - self._errHandler.recover(self, re) - finally: - self.exitRule() - return localctx - - - class Double_right_bracketContext(ParserRuleContext): - __slots__ = 'parser' - - def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): - super().__init__(parent, invokingState) - self.parser = parser - - def RIGHT_BR(self, i:int=None): - if i is None: - return self.getTokens(CoreDSL2Parser.RIGHT_BR) - else: - return self.getToken(CoreDSL2Parser.RIGHT_BR, i) - - def getRuleIndex(self): - return CoreDSL2Parser.RULE_double_right_bracket - - def enterRule(self, listener:ParseTreeListener): - if hasattr( listener, "enterDouble_right_bracket" ): - listener.enterDouble_right_bracket(self) - - def exitRule(self, listener:ParseTreeListener): - if hasattr( listener, "exitDouble_right_bracket" ): - listener.exitDouble_right_bracket(self) - - def accept(self, visitor:ParseTreeVisitor): - if hasattr( visitor, "visitDouble_right_bracket" ): - return visitor.visitDouble_right_bracket(self) - else: - return visitor.visitChildren(self) - - - - - def double_right_bracket(self): - - localctx = CoreDSL2Parser.Double_right_bracketContext(self, self._ctx, self.state) - self.enterRule(localctx, 88, self.RULE_double_right_bracket) - try: - self.enterOuterAlt(localctx, 1) - self.state = 785 - self.match(CoreDSL2Parser.RIGHT_BR) - self.state = 786 - self.match(CoreDSL2Parser.RIGHT_BR) - except RecognitionException as re: - localctx.exception = re - self._errHandler.reportError(self, re) - self._errHandler.recover(self, re) - finally: - self.exitRule() - return localctx - - - class Data_typesContext(ParserRuleContext): - __slots__ = 'parser' - - def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): - super().__init__(parent, invokingState) - self.parser = parser - - - def getRuleIndex(self): - return CoreDSL2Parser.RULE_data_types - - def enterRule(self, listener:ParseTreeListener): - if hasattr( listener, "enterData_types" ): - listener.enterData_types(self) - - def exitRule(self, listener:ParseTreeListener): - if hasattr( listener, "exitData_types" ): - listener.exitData_types(self) - - def accept(self, visitor:ParseTreeVisitor): - if hasattr( visitor, "visitData_types" ): - return visitor.visitData_types(self) - else: - return visitor.visitChildren(self) - - - - - def data_types(self): - - localctx = CoreDSL2Parser.Data_typesContext(self, self._ctx, self.state) - self.enterRule(localctx, 90, self.RULE_data_types) - self._la = 0 # Token type - try: - self.enterOuterAlt(localctx, 1) - self.state = 788 - _la = self._input.LA(1) - if not(((((_la - 38)) & ~0x3f) == 0 and ((1 << (_la - 38)) & 70368744179707) != 0)): - self._errHandler.recoverInline(self) - else: - self._errHandler.reportMatch(self) - self.consume() - except RecognitionException as re: - localctx.exception = re - self._errHandler.reportError(self, re) - self._errHandler.recover(self, re) - finally: - self.exitRule() - return localctx - - - class Type_qualifierContext(ParserRuleContext): - __slots__ = 'parser' - - def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): - super().__init__(parent, invokingState) - self.parser = parser - - - def getRuleIndex(self): - return CoreDSL2Parser.RULE_type_qualifier - - def enterRule(self, listener:ParseTreeListener): - if hasattr( listener, "enterType_qualifier" ): - listener.enterType_qualifier(self) - - def exitRule(self, listener:ParseTreeListener): - if hasattr( listener, "exitType_qualifier" ): - listener.exitType_qualifier(self) - - def accept(self, visitor:ParseTreeVisitor): - if hasattr( visitor, "visitType_qualifier" ): - return visitor.visitType_qualifier(self) - else: - return visitor.visitChildren(self) - - - - - def type_qualifier(self): - - localctx = CoreDSL2Parser.Type_qualifierContext(self, self._ctx, self.state) - self.enterRule(localctx, 92, self.RULE_type_qualifier) - self._la = 0 # Token type - try: - self.enterOuterAlt(localctx, 1) - self.state = 790 - _la = self._input.LA(1) - if not(_la==85 or _la==86): - self._errHandler.recoverInline(self) - else: - self._errHandler.reportMatch(self) - self.consume() - except RecognitionException as re: - localctx.exception = re - self._errHandler.reportError(self, re) - self._errHandler.recover(self, re) - finally: - self.exitRule() - return localctx - - - class Storage_class_specifierContext(ParserRuleContext): - __slots__ = 'parser' - - def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): - super().__init__(parent, invokingState) - self.parser = parser - - - def getRuleIndex(self): - return CoreDSL2Parser.RULE_storage_class_specifier - - def enterRule(self, listener:ParseTreeListener): - if hasattr( listener, "enterStorage_class_specifier" ): - listener.enterStorage_class_specifier(self) - - def exitRule(self, listener:ParseTreeListener): - if hasattr( listener, "exitStorage_class_specifier" ): - listener.exitStorage_class_specifier(self) - - def accept(self, visitor:ParseTreeVisitor): - if hasattr( visitor, "visitStorage_class_specifier" ): - return visitor.visitStorage_class_specifier(self) - else: - return visitor.visitChildren(self) - - - - - def storage_class_specifier(self): - - localctx = CoreDSL2Parser.Storage_class_specifierContext(self, self._ctx, self.state) - self.enterRule(localctx, 94, self.RULE_storage_class_specifier) - self._la = 0 # Token type - try: - self.enterOuterAlt(localctx, 1) - self.state = 792 - _la = self._input.LA(1) - if not(_la==19 or _la==87 or _la==88): - self._errHandler.recoverInline(self) - else: - self._errHandler.reportMatch(self) - self.consume() - except RecognitionException as re: - localctx.exception = re - self._errHandler.reportError(self, re) - self._errHandler.recover(self, re) - finally: - self.exitRule() - return localctx - - - class Struct_or_unionContext(ParserRuleContext): - __slots__ = 'parser' - - def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): - super().__init__(parent, invokingState) - self.parser = parser - - - def getRuleIndex(self): - return CoreDSL2Parser.RULE_struct_or_union - - def enterRule(self, listener:ParseTreeListener): - if hasattr( listener, "enterStruct_or_union" ): - listener.enterStruct_or_union(self) - - def exitRule(self, listener:ParseTreeListener): - if hasattr( listener, "exitStruct_or_union" ): - listener.exitStruct_or_union(self) - - def accept(self, visitor:ParseTreeVisitor): - if hasattr( visitor, "visitStruct_or_union" ): - return visitor.visitStruct_or_union(self) - else: - return visitor.visitChildren(self) - - - - - def struct_or_union(self): - - localctx = CoreDSL2Parser.Struct_or_unionContext(self, self._ctx, self.state) - self.enterRule(localctx, 96, self.RULE_struct_or_union) - self._la = 0 # Token type - try: - self.enterOuterAlt(localctx, 1) - self.state = 794 - _la = self._input.LA(1) - if not(_la==89 or _la==90): - self._errHandler.recoverInline(self) - else: - self._errHandler.reportMatch(self) - self.consume() - except RecognitionException as re: - localctx.exception = re - self._errHandler.reportError(self, re) - self._errHandler.recover(self, re) - finally: - self.exitRule() - return localctx - - - - def sempred(self, localctx:RuleContext, ruleIndex:int, predIndex:int): - if self._predicates == None: - self._predicates = dict() - self._predicates[34] = self.expression_sempred - pred = self._predicates.get(ruleIndex, None) - if pred is None: - raise Exception("No predicate with index:" + str(ruleIndex)) - else: - return pred(localctx, predIndex) - - def expression_sempred(self, localctx:ExpressionContext, predIndex:int): - if predIndex == 0: - return self.precpred(self._ctx, 13) - - - if predIndex == 1: - return self.precpred(self._ctx, 12) - - - if predIndex == 2: - return self.precpred(self._ctx, 11) - - - if predIndex == 3: - return self.precpred(self._ctx, 10) - - - if predIndex == 4: - return self.precpred(self._ctx, 9) - - - if predIndex == 5: - return self.precpred(self._ctx, 8) - - - if predIndex == 6: - return self.precpred(self._ctx, 7) - - - if predIndex == 7: - return self.precpred(self._ctx, 6) - - - if predIndex == 8: - return self.precpred(self._ctx, 5) - - - if predIndex == 9: - return self.precpred(self._ctx, 4) - - - if predIndex == 10: - return self.precpred(self._ctx, 3) - - - if predIndex == 11: - return self.precpred(self._ctx, 2) - - - if predIndex == 12: - return self.precpred(self._ctx, 1) - - - if predIndex == 13: - return self.precpred(self._ctx, 20) - - - if predIndex == 14: - return self.precpred(self._ctx, 18) - - - - - diff --git a/m2isar/frontends/coredsl2_set/parser_gen/CoreDSL2Visitor.py b/m2isar/frontends/coredsl2_set/parser_gen/CoreDSL2Visitor.py deleted file mode 100644 index 40a2df9b..00000000 --- a/m2isar/frontends/coredsl2_set/parser_gen/CoreDSL2Visitor.py +++ /dev/null @@ -1,443 +0,0 @@ -# Generated from ../coredsl2/CoreDSL2.g4 by ANTLR 4.13.1 -from antlr4 import * -if "." in __name__: - from .CoreDSL2Parser import CoreDSL2Parser -else: - from CoreDSL2Parser import CoreDSL2Parser - -# This class defines a complete generic visitor for a parse tree produced by CoreDSL2Parser. - -class CoreDSL2Visitor(ParseTreeVisitor): - - # Visit a parse tree produced by CoreDSL2Parser#description_content. - def visitDescription_content(self, ctx:CoreDSL2Parser.Description_contentContext): - return self.visitChildren(ctx) - - - # Visit a parse tree produced by CoreDSL2Parser#import_file. - def visitImport_file(self, ctx:CoreDSL2Parser.Import_fileContext): - return self.visitChildren(ctx) - - - # Visit a parse tree produced by CoreDSL2Parser#instruction_set. - def visitInstruction_set(self, ctx:CoreDSL2Parser.Instruction_setContext): - return self.visitChildren(ctx) - - - # Visit a parse tree produced by CoreDSL2Parser#core_def. - def visitCore_def(self, ctx:CoreDSL2Parser.Core_defContext): - return self.visitChildren(ctx) - - - # Visit a parse tree produced by CoreDSL2Parser#section_arch_state. - def visitSection_arch_state(self, ctx:CoreDSL2Parser.Section_arch_stateContext): - return self.visitChildren(ctx) - - - # Visit a parse tree produced by CoreDSL2Parser#section_functions. - def visitSection_functions(self, ctx:CoreDSL2Parser.Section_functionsContext): - return self.visitChildren(ctx) - - - # Visit a parse tree produced by CoreDSL2Parser#section_instructions. - def visitSection_instructions(self, ctx:CoreDSL2Parser.Section_instructionsContext): - return self.visitChildren(ctx) - - - # Visit a parse tree produced by CoreDSL2Parser#section_always. - def visitSection_always(self, ctx:CoreDSL2Parser.Section_alwaysContext): - return self.visitChildren(ctx) - - - # Visit a parse tree produced by CoreDSL2Parser#always_block. - def visitAlways_block(self, ctx:CoreDSL2Parser.Always_blockContext): - return self.visitChildren(ctx) - - - # Visit a parse tree produced by CoreDSL2Parser#instruction. - def visitInstruction(self, ctx:CoreDSL2Parser.InstructionContext): - return self.visitChildren(ctx) - - - # Visit a parse tree produced by CoreDSL2Parser#rule_encoding. - def visitRule_encoding(self, ctx:CoreDSL2Parser.Rule_encodingContext): - return self.visitChildren(ctx) - - - # Visit a parse tree produced by CoreDSL2Parser#bit_value. - def visitBit_value(self, ctx:CoreDSL2Parser.Bit_valueContext): - return self.visitChildren(ctx) - - - # Visit a parse tree produced by CoreDSL2Parser#bit_field. - def visitBit_field(self, ctx:CoreDSL2Parser.Bit_fieldContext): - return self.visitChildren(ctx) - - - # Visit a parse tree produced by CoreDSL2Parser#function_definition. - def visitFunction_definition(self, ctx:CoreDSL2Parser.Function_definitionContext): - return self.visitChildren(ctx) - - - # Visit a parse tree produced by CoreDSL2Parser#parameter_list. - def visitParameter_list(self, ctx:CoreDSL2Parser.Parameter_listContext): - return self.visitChildren(ctx) - - - # Visit a parse tree produced by CoreDSL2Parser#parameter_declaration. - def visitParameter_declaration(self, ctx:CoreDSL2Parser.Parameter_declarationContext): - return self.visitChildren(ctx) - - - # Visit a parse tree produced by CoreDSL2Parser#block_statement. - def visitBlock_statement(self, ctx:CoreDSL2Parser.Block_statementContext): - return self.visitChildren(ctx) - - - # Visit a parse tree produced by CoreDSL2Parser#procedure_call. - def visitProcedure_call(self, ctx:CoreDSL2Parser.Procedure_callContext): - return self.visitChildren(ctx) - - - # Visit a parse tree produced by CoreDSL2Parser#if_statement. - def visitIf_statement(self, ctx:CoreDSL2Parser.If_statementContext): - return self.visitChildren(ctx) - - - # Visit a parse tree produced by CoreDSL2Parser#for_statement. - def visitFor_statement(self, ctx:CoreDSL2Parser.For_statementContext): - return self.visitChildren(ctx) - - - # Visit a parse tree produced by CoreDSL2Parser#while_statement. - def visitWhile_statement(self, ctx:CoreDSL2Parser.While_statementContext): - return self.visitChildren(ctx) - - - # Visit a parse tree produced by CoreDSL2Parser#do_statement. - def visitDo_statement(self, ctx:CoreDSL2Parser.Do_statementContext): - return self.visitChildren(ctx) - - - # Visit a parse tree produced by CoreDSL2Parser#switch_statement. - def visitSwitch_statement(self, ctx:CoreDSL2Parser.Switch_statementContext): - return self.visitChildren(ctx) - - - # Visit a parse tree produced by CoreDSL2Parser#return_statement. - def visitReturn_statement(self, ctx:CoreDSL2Parser.Return_statementContext): - return self.visitChildren(ctx) - - - # Visit a parse tree produced by CoreDSL2Parser#break_statement. - def visitBreak_statement(self, ctx:CoreDSL2Parser.Break_statementContext): - return self.visitChildren(ctx) - - - # Visit a parse tree produced by CoreDSL2Parser#continue_statement. - def visitContinue_statement(self, ctx:CoreDSL2Parser.Continue_statementContext): - return self.visitChildren(ctx) - - - # Visit a parse tree produced by CoreDSL2Parser#spawn_statement. - def visitSpawn_statement(self, ctx:CoreDSL2Parser.Spawn_statementContext): - return self.visitChildren(ctx) - - - # Visit a parse tree produced by CoreDSL2Parser#expression_statement. - def visitExpression_statement(self, ctx:CoreDSL2Parser.Expression_statementContext): - return self.visitChildren(ctx) - - - # Visit a parse tree produced by CoreDSL2Parser#switch_block_statement_group. - def visitSwitch_block_statement_group(self, ctx:CoreDSL2Parser.Switch_block_statement_groupContext): - return self.visitChildren(ctx) - - - # Visit a parse tree produced by CoreDSL2Parser#switch_label. - def visitSwitch_label(self, ctx:CoreDSL2Parser.Switch_labelContext): - return self.visitChildren(ctx) - - - # Visit a parse tree produced by CoreDSL2Parser#block. - def visitBlock(self, ctx:CoreDSL2Parser.BlockContext): - return self.visitChildren(ctx) - - - # Visit a parse tree produced by CoreDSL2Parser#block_item. - def visitBlock_item(self, ctx:CoreDSL2Parser.Block_itemContext): - return self.visitChildren(ctx) - - - # Visit a parse tree produced by CoreDSL2Parser#for_condition. - def visitFor_condition(self, ctx:CoreDSL2Parser.For_conditionContext): - return self.visitChildren(ctx) - - - # Visit a parse tree produced by CoreDSL2Parser#declaration. - def visitDeclaration(self, ctx:CoreDSL2Parser.DeclarationContext): - return self.visitChildren(ctx) - - - # Visit a parse tree produced by CoreDSL2Parser#type_specifier. - def visitType_specifier(self, ctx:CoreDSL2Parser.Type_specifierContext): - return self.visitChildren(ctx) - - - # Visit a parse tree produced by CoreDSL2Parser#integer_type. - def visitInteger_type(self, ctx:CoreDSL2Parser.Integer_typeContext): - return self.visitChildren(ctx) - - - # Visit a parse tree produced by CoreDSL2Parser#float_type. - def visitFloat_type(self, ctx:CoreDSL2Parser.Float_typeContext): - return self.visitChildren(ctx) - - - # Visit a parse tree produced by CoreDSL2Parser#bool_type. - def visitBool_type(self, ctx:CoreDSL2Parser.Bool_typeContext): - return self.visitChildren(ctx) - - - # Visit a parse tree produced by CoreDSL2Parser#void_type. - def visitVoid_type(self, ctx:CoreDSL2Parser.Void_typeContext): - return self.visitChildren(ctx) - - - # Visit a parse tree produced by CoreDSL2Parser#composite_declaration. - def visitComposite_declaration(self, ctx:CoreDSL2Parser.Composite_declarationContext): - return self.visitChildren(ctx) - - - # Visit a parse tree produced by CoreDSL2Parser#composite_reference. - def visitComposite_reference(self, ctx:CoreDSL2Parser.Composite_referenceContext): - return self.visitChildren(ctx) - - - # Visit a parse tree produced by CoreDSL2Parser#enum_declaration. - def visitEnum_declaration(self, ctx:CoreDSL2Parser.Enum_declarationContext): - return self.visitChildren(ctx) - - - # Visit a parse tree produced by CoreDSL2Parser#enum_reference. - def visitEnum_reference(self, ctx:CoreDSL2Parser.Enum_referenceContext): - return self.visitChildren(ctx) - - - # Visit a parse tree produced by CoreDSL2Parser#integer_signedness. - def visitInteger_signedness(self, ctx:CoreDSL2Parser.Integer_signednessContext): - return self.visitChildren(ctx) - - - # Visit a parse tree produced by CoreDSL2Parser#integer_shorthand. - def visitInteger_shorthand(self, ctx:CoreDSL2Parser.Integer_shorthandContext): - return self.visitChildren(ctx) - - - # Visit a parse tree produced by CoreDSL2Parser#float_shorthand. - def visitFloat_shorthand(self, ctx:CoreDSL2Parser.Float_shorthandContext): - return self.visitChildren(ctx) - - - # Visit a parse tree produced by CoreDSL2Parser#attribute. - def visitAttribute(self, ctx:CoreDSL2Parser.AttributeContext): - return self.visitChildren(ctx) - - - # Visit a parse tree produced by CoreDSL2Parser#bit_size_specifier. - def visitBit_size_specifier(self, ctx:CoreDSL2Parser.Bit_size_specifierContext): - return self.visitChildren(ctx) - - - # Visit a parse tree produced by CoreDSL2Parser#enumerator_list. - def visitEnumerator_list(self, ctx:CoreDSL2Parser.Enumerator_listContext): - return self.visitChildren(ctx) - - - # Visit a parse tree produced by CoreDSL2Parser#enumerator. - def visitEnumerator(self, ctx:CoreDSL2Parser.EnumeratorContext): - return self.visitChildren(ctx) - - - # Visit a parse tree produced by CoreDSL2Parser#struct_declaration. - def visitStruct_declaration(self, ctx:CoreDSL2Parser.Struct_declarationContext): - return self.visitChildren(ctx) - - - # Visit a parse tree produced by CoreDSL2Parser#struct_declaration_specifier. - def visitStruct_declaration_specifier(self, ctx:CoreDSL2Parser.Struct_declaration_specifierContext): - return self.visitChildren(ctx) - - - # Visit a parse tree produced by CoreDSL2Parser#declarator. - def visitDeclarator(self, ctx:CoreDSL2Parser.DeclaratorContext): - return self.visitChildren(ctx) - - - # Visit a parse tree produced by CoreDSL2Parser#initializer. - def visitInitializer(self, ctx:CoreDSL2Parser.InitializerContext): - return self.visitChildren(ctx) - - - # Visit a parse tree produced by CoreDSL2Parser#initializerList. - def visitInitializerList(self, ctx:CoreDSL2Parser.InitializerListContext): - return self.visitChildren(ctx) - - - # Visit a parse tree produced by CoreDSL2Parser#designated_initializer. - def visitDesignated_initializer(self, ctx:CoreDSL2Parser.Designated_initializerContext): - return self.visitChildren(ctx) - - - # Visit a parse tree produced by CoreDSL2Parser#designator. - def visitDesignator(self, ctx:CoreDSL2Parser.DesignatorContext): - return self.visitChildren(ctx) - - - # Visit a parse tree produced by CoreDSL2Parser#cast_expression. - def visitCast_expression(self, ctx:CoreDSL2Parser.Cast_expressionContext): - return self.visitChildren(ctx) - - - # Visit a parse tree produced by CoreDSL2Parser#binary_expression. - def visitBinary_expression(self, ctx:CoreDSL2Parser.Binary_expressionContext): - return self.visitChildren(ctx) - - - # Visit a parse tree produced by CoreDSL2Parser#preinc_expression. - def visitPreinc_expression(self, ctx:CoreDSL2Parser.Preinc_expressionContext): - return self.visitChildren(ctx) - - - # Visit a parse tree produced by CoreDSL2Parser#conditional_expression. - def visitConditional_expression(self, ctx:CoreDSL2Parser.Conditional_expressionContext): - return self.visitChildren(ctx) - - - # Visit a parse tree produced by CoreDSL2Parser#deref_expression. - def visitDeref_expression(self, ctx:CoreDSL2Parser.Deref_expressionContext): - return self.visitChildren(ctx) - - - # Visit a parse tree produced by CoreDSL2Parser#prefix_expression. - def visitPrefix_expression(self, ctx:CoreDSL2Parser.Prefix_expressionContext): - return self.visitChildren(ctx) - - - # Visit a parse tree produced by CoreDSL2Parser#postinc_expression. - def visitPostinc_expression(self, ctx:CoreDSL2Parser.Postinc_expressionContext): - return self.visitChildren(ctx) - - - # Visit a parse tree produced by CoreDSL2Parser#concat_expression. - def visitConcat_expression(self, ctx:CoreDSL2Parser.Concat_expressionContext): - return self.visitChildren(ctx) - - - # Visit a parse tree produced by CoreDSL2Parser#assignment_expression. - def visitAssignment_expression(self, ctx:CoreDSL2Parser.Assignment_expressionContext): - return self.visitChildren(ctx) - - - # Visit a parse tree produced by CoreDSL2Parser#method_call. - def visitMethod_call(self, ctx:CoreDSL2Parser.Method_callContext): - return self.visitChildren(ctx) - - - # Visit a parse tree produced by CoreDSL2Parser#primary_expression. - def visitPrimary_expression(self, ctx:CoreDSL2Parser.Primary_expressionContext): - return self.visitChildren(ctx) - - - # Visit a parse tree produced by CoreDSL2Parser#slice_expression. - def visitSlice_expression(self, ctx:CoreDSL2Parser.Slice_expressionContext): - return self.visitChildren(ctx) - - - # Visit a parse tree produced by CoreDSL2Parser#reference_expression. - def visitReference_expression(self, ctx:CoreDSL2Parser.Reference_expressionContext): - return self.visitChildren(ctx) - - - # Visit a parse tree produced by CoreDSL2Parser#constant_expression. - def visitConstant_expression(self, ctx:CoreDSL2Parser.Constant_expressionContext): - return self.visitChildren(ctx) - - - # Visit a parse tree produced by CoreDSL2Parser#literal_expression. - def visitLiteral_expression(self, ctx:CoreDSL2Parser.Literal_expressionContext): - return self.visitChildren(ctx) - - - # Visit a parse tree produced by CoreDSL2Parser#parens_expression. - def visitParens_expression(self, ctx:CoreDSL2Parser.Parens_expressionContext): - return self.visitChildren(ctx) - - - # Visit a parse tree produced by CoreDSL2Parser#string_literal. - def visitString_literal(self, ctx:CoreDSL2Parser.String_literalContext): - return self.visitChildren(ctx) - - - # Visit a parse tree produced by CoreDSL2Parser#constant. - def visitConstant(self, ctx:CoreDSL2Parser.ConstantContext): - return self.visitChildren(ctx) - - - # Visit a parse tree produced by CoreDSL2Parser#integer_constant. - def visitInteger_constant(self, ctx:CoreDSL2Parser.Integer_constantContext): - return self.visitChildren(ctx) - - - # Visit a parse tree produced by CoreDSL2Parser#floating_constant. - def visitFloating_constant(self, ctx:CoreDSL2Parser.Floating_constantContext): - return self.visitChildren(ctx) - - - # Visit a parse tree produced by CoreDSL2Parser#bool_constant. - def visitBool_constant(self, ctx:CoreDSL2Parser.Bool_constantContext): - return self.visitChildren(ctx) - - - # Visit a parse tree produced by CoreDSL2Parser#character_constant. - def visitCharacter_constant(self, ctx:CoreDSL2Parser.Character_constantContext): - return self.visitChildren(ctx) - - - # Visit a parse tree produced by CoreDSL2Parser#string_constant. - def visitString_constant(self, ctx:CoreDSL2Parser.String_constantContext): - return self.visitChildren(ctx) - - - # Visit a parse tree produced by CoreDSL2Parser#double_left_bracket. - def visitDouble_left_bracket(self, ctx:CoreDSL2Parser.Double_left_bracketContext): - return self.visitChildren(ctx) - - - # Visit a parse tree produced by CoreDSL2Parser#double_right_bracket. - def visitDouble_right_bracket(self, ctx:CoreDSL2Parser.Double_right_bracketContext): - return self.visitChildren(ctx) - - - # Visit a parse tree produced by CoreDSL2Parser#data_types. - def visitData_types(self, ctx:CoreDSL2Parser.Data_typesContext): - return self.visitChildren(ctx) - - - # Visit a parse tree produced by CoreDSL2Parser#type_qualifier. - def visitType_qualifier(self, ctx:CoreDSL2Parser.Type_qualifierContext): - return self.visitChildren(ctx) - - - # Visit a parse tree produced by CoreDSL2Parser#storage_class_specifier. - def visitStorage_class_specifier(self, ctx:CoreDSL2Parser.Storage_class_specifierContext): - return self.visitChildren(ctx) - - - # Visit a parse tree produced by CoreDSL2Parser#struct_or_union. - def visitStruct_or_union(self, ctx:CoreDSL2Parser.Struct_or_unionContext): - return self.visitChildren(ctx) - - - -del CoreDSL2Parser \ No newline at end of file diff --git a/m2isar/frontends/coredsl2_set/parser_gen/__init__.py b/m2isar/frontends/coredsl2_set/parser_gen/__init__.py deleted file mode 100644 index 18f965d7..00000000 --- a/m2isar/frontends/coredsl2_set/parser_gen/__init__.py +++ /dev/null @@ -1,16 +0,0 @@ -# SPDX-License-Identifier: Apache-2.0 -# -# This file is part of the M2-ISA-R project: https://github.com/tum-ei-eda/M2-ISA-R -# -# Copyright (C) 2022 -# Chair of Electrical Design Automation -# Technical University of Munich - -"""This module contains the python files generated by ANTLR. These are version controlled -to allow users without a working ANTLR and/or Java setup to also use M2-ISA-R. -""" - -from .CoreDSL2Lexer import CoreDSL2Lexer -from .CoreDSL2Listener import CoreDSL2Listener -from .CoreDSL2Parser import CoreDSL2Parser -from .CoreDSL2Visitor import CoreDSL2Visitor \ No newline at end of file diff --git a/m2isar/frontends/coredsl2_set/utils.py b/m2isar/frontends/coredsl2_set/utils.py index ffe63588..a3bd7f8b 100644 --- a/m2isar/frontends/coredsl2_set/utils.py +++ b/m2isar/frontends/coredsl2_set/utils.py @@ -10,7 +10,7 @@ import antlr4.error.ErrorListener from m2isar import M2SyntaxError -from .parser_gen import CoreDSL2Lexer, CoreDSL2Parser +from ..coredsl2.parser_gen import CoreDSL2Lexer, CoreDSL2Parser RADIX = {"b": 2, "h": 16, "d": 10, "o": 8}