raesl.compile.typechecking.goal_transform_base#

Base class for goal and transformation processing to improve code sharing.

Module Contents#

Classes#

GoalTransformBaseBuilder

Common base class for checking goals and transformations.

class raesl.compile.typechecking.goal_transform_base.GoalTransformBaseBuilder(diag_store: raesl.compile.diagnostics.DiagnosticStore)#

Common base class for checking goals and transformations.

Parameters:

diag_store – Storage for found diagnostics.

reported_names#

Names of flows with a reported error, to avoid duplicate error generation.

verify_verb_prepos(verb_tok: raesl.compile.scanner.Token, prepos_tok: raesl.compile.scanner.Token, vpps: Set[Tuple[str, str]])#

Verify verb and pre-position and report an error if the combination does not exist.

Parameters:
  • verb_tok – Token holding the verb text.

  • prepos_tok – Token holding the prepos text.

  • vpps – Available combinations of verbs and prepositions.

verify_flows(flows: List[raesl.compile.ast.components.Flow], vps: Dict[str, raesl.compile.ast.components.VarParam]) bool#

Check that each flow exists as variable or parameter. Update the link in the Flow object to point to the matching variable or parameter.

Parameters:
  • flows – Flows to check.

  • vps – Available variables and parameters in the component.

Returns:

Whether all flows can be matched to a variable or parameter.

resolve_component(compinst_tok: raesl.compile.scanner.Token, cinsts: Dict[str, raesl.compile.ast.components.ComponentInstance]) raesl.compile.ast.components.ComponentInstance | None#

Find a component instance with the provided instance name. If it exists, return it, else report an error and return None, indicating failure.

check_form(sect_name: str, kind: str, doesaux: raesl.compile.scanner.Token, sub_clauses: List[raesl.compile.ast.components.SubClause])#

Check whether the requirement or constraint form of the text is correct with respect to the containing section.

Parameters:
  • sect_name – Name of the section (goal or transformation).

  • kind – Kind of section containing the text (requirement or constraint).

  • doesaux – Token in the formulation that is either ‘does’ or one of the auxiliary verbs.

  • sub_clauses – Sub clauses belong to the requirement or constraint.

_check_constraint_expr(expr: raesl.compile.ast.exprs.Disjunction | raesl.compile.ast.exprs.RelationComparison | raesl.compile.ast.exprs.ObjectiveComparison)#

Check whether the subclauses have the proper form for a constraint section. Report an error if something wrong is found.

_check_requirement_expr(expr: raesl.compile.ast.exprs.Disjunction | raesl.compile.ast.exprs.RelationComparison | raesl.compile.ast.exprs.ObjectiveComparison)#

Check whether the subclauses have the proper form for a requirement section. Report an error if something wrong is found.