raesl.compile.typechecking.reldef_builder#

Collect and process relation definition that are found by the parser.

Module Contents#

Classes#

RelationDefBuilder

Builder to construct relation definitions.

Attributes#

INPUT

OUTPUT

INPOUT

raesl.compile.typechecking.reldef_builder.INPUT#
raesl.compile.typechecking.reldef_builder.OUTPUT#
raesl.compile.typechecking.reldef_builder.INPOUT#
class raesl.compile.typechecking.reldef_builder.RelationDefBuilder(ast_builder: raesl.compile.typechecking.ast_builder.AstBuilder)#

Builder to construct relation definitions.

Parameters:

ast_builder – AST builder instance.

diag_store#

Storage for found diagnostics.

rel_defs#

Created relation definitions while collecting data from parsing.

current_reldef#

Reference to the entry in ‘rel_defs’ that is being filled.

last_occurrences#

Map of input/output directions to token of last occurrence of that direction in the current definition.

current_direction#

Parameter direction to attach to a new parameter.

notify_new_section(_new_top_section: bool)#

Parser found a new section, drop all ‘in-progress’ relation definition construction.

add_reldef(name: raesl.compile.scanner.Token)#

Add a new relation definition. Parameters will follow.

Parameters:

definition. (Name of the relation) –

reldef_param_header(header_tok: raesl.compile.scanner.Token, direction: str)#

New parameter subsection with a direction. Set the direction for the parameters that will follow.

Parameters:
  • header_tok – Token of the direction, for deriving position information if needed.

  • direction – Direction of the next parameters of the relation definition.

reldef_add_param(name: raesl.compile.scanner.Token, type_name: raesl.compile.scanner.Token, multi: bool)#

Add a parameter to the current relation definition.

finish(spec: raesl.compile.ast.specification.Specification)#

Check the relation definitions and add them to the result specification.