qat.frontend.parsers.qasm.base module

class AbstractParser

Bases: ABC

can_parse(qasm)
Return type:

ParseResults

parser_language()
Return type:

Languages

abstract walk_node(node, context, builder, **kwargs)
class ParseResults(**data)

Bases: NoExtraFieldsModel

Results object for attempted parse. When coerced to a boolean matches against if parse was successful.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

errors: str
model_config: ClassVar[ConfigDict] = {'extra': 'forbid', 'ser_json_inf_nan': 'constants', 'use_enum_values': False, 'validate_assignment': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

success: bool
class QasmContext(**data)

Bases: NoExtraFieldsModel

Container object for all data relating to the scope/pass of QASM currently under analysis.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

gates: dict[str, Any]
model_config: ClassVar[ConfigDict] = {'extra': 'forbid', 'ser_json_inf_nan': 'constants', 'use_enum_values': False, 'validate_assignment': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

registers: Registers
variables: ValidatedDict[str, Variable]