raesl.compile.ast.specification#

Overall output specification.

Module Contents#

Classes#

Specification

Main class.

_DumpSpec

Class for dumping the specification to an output stream.

Functions#

unfold_disjunction(...)

Convert the child expressions of top-level disjunction expressions to a list.

dump(spec[, output_stream])

Dump the provided specification to an output.

get_doc_comment_spec_elements(...)

Retrieve the specification elements interested in getting documentation comments

class raesl.compile.ast.specification.Specification#

Main class.

types#

Types of the specification.

verb_prepos#

Verbs and pre-positions.

rel_defs#

Relation definitions.

comp_defs#

Component definitions.

world#

Root component.

class raesl.compile.ast.specification._DumpSpec(output_stream: TextIO | None = None)#

Class for dumping the specification to an output stream.

dump(spec: Specification)#

Write the specification symbolically onto the output stream. Intended use is verifying content or debugging.

dump_component(compdef)#

Dump content of the provided component.

_dump_expr(expr: raesl.compile.ast.exprs.Expression, indent: str)#
_dump_nodes(node: raesl.compile.ast.nodes.Node, prefixes: List[str] = None)#

Recursively dump the tree of var/param nodes rooted at ‘node’, with ‘prefixes’ containing the leading text-fields if not None.

_dump_docs(element: raesl.compile.ast.comment_storage.DocElement, indent_text: str)#

Dump documentation of the given element if it has any. If no documentation has been added, report there is no documentation.

Parameters:
  • element – Element to check for documentation.

  • indent_text – Leading text printed at each line by the function.

_dump_type(btp: raesl.compile.ast.types.BaseType) str#

Dump unique types onto the self.output_stream while assigning them names of the form ‘type#<num>’. Each type is output once.

Arugments:

btp: Type to dump.

Returns:

Name of the type during the dump process.

_dump_compinst_params(compinst)#

Dump the arguments of the component instance.

_dump_relinst_params(relinst)#

Dump the arguments of the relation instance.

_dump_subclauses(clauses)#
_dump_conds(conditions)#
_dump_results(results)#
raesl.compile.ast.specification.unfold_disjunction(expr: raesl.compile.ast.exprs.Expression) List[raesl.compile.ast.exprs.Expression]#

Convert the child expressions of top-level disjunction expressions to a list.

raesl.compile.ast.specification.dump(spec: Specification, output_stream: TextIO | None = None)#

Dump the provided specification to an output.

Parameters:
  • spec – Specification to dump.

  • output_stream – Stream to write to, None means stdout.

raesl.compile.ast.specification.get_doc_comment_spec_elements(spec: Specification) Generator[raesl.compile.ast.comment_storage.DocStore, None, None]#

Retrieve the specification elements interested in getting documentation comments from the input.

Note: Component definitions are added through components

get_doc_comment_comp_elements

Note: The implementation is highly knowledgeable about data structure here with

respect to the implementation.