m2isar.frontends.coredsl2.source_validator

Validate source information that is lost when lowering to the metamodel.

Rules follow the analyzer in the source bundle of MINRES CoreDSL 2.0.21. The semantic pass handles known integer/array types and scoped ISA parameters. Remaining elaboration and provider gaps are tracked in the parity map.

Attributes

logger

ATTRIBUTES

Classes

Diagnostics

Validation errors reported together: the first is raised, the rest are attached to it.

ScopeStack

Lexical scopes in self.scopes: name -> entity dicts, innermost last.

SourceValidator

Functions

location(ctx)

unresolved(ctx, kind, name)

The release's linking diagnostic for a name that does not resolve.

in_progress(active, key)

Mark key active for the block; yield whether it already was (a cycle).

dependencies(definition)

Names of the instruction sets a core or instruction set builds on.

contributors(definitions, root)

root and every definition it builds on, each once, dependencies first.

provided(definitions, starts)

starts and the definitions they build on, each once, in lookup precedence order.

is_const(declaration)

is_alias(type_specifier)

return_terminated(ctx)

statement_expression(ctx)

validate_source(tree, warnings_info[, parameter_values])

_validate_source(tree, warnings_info[, parameter_values])

Module Contents

logger[source]
ATTRIBUTES[source]
location(ctx)[source]
unresolved(ctx, kind, name)[source]

The release’s linking diagnostic for a name that does not resolve.

class Diagnostics[source]

Bases: list

Validation errors reported together: the first is raised, the rest are attached to it.

add(ctx, issue, message)[source]
collect()[source]

Record a validation error raised in the block instead of propagating it.

raise_if_any()[source]
class ScopeStack[source]

Lexical scopes in self.scopes: name -> entity dicts, innermost last.

scope(names=None)[source]
only_scopes(scopes)[source]

Replace the whole scope stack for the block.

in_progress(active, key)[source]

Mark key active for the block; yield whether it already was (a cycle).

dependencies(definition)[source]

Names of the instruction sets a core or instruction set builds on.

contributors(definitions, root)[source]

root and every definition it builds on, each once, dependencies first.

provided(definitions, starts)[source]

starts and the definitions they build on, each once, in lookup precedence order.

is_const(declaration)[source]
is_alias(type_specifier)[source]
return_terminated(ctx)[source]
statement_expression(ctx)[source]
class SourceValidator(warnings_info)[source]

Bases: m2isar.frontends.coredsl2.parser_gen.CoreDSL2Visitor, m2isar.warnings.WarningsManager

function = None[source]
loop_depth = 0[source]
switch_depth = 0[source]
static error(ctx, issue, message)[source]
warning(ctx, name, message)[source]
constant(ctx)[source]
visitInteger_type(ctx)[source]
visitAttribute(ctx)[source]
encoding_size(instruction)[source]
_encoding_size(instruction)[source]
visitInstruction(ctx)[source]
visitFunction_definition(ctx)[source]
visitParameter_declaration(ctx)[source]
visitEnumerator(ctx)[source]
visitDeclaration(ctx)[source]
visitBlock(ctx)[source]
visitReturn_statement(ctx)[source]
visitBreak_statement(ctx)[source]
visitContinue_statement(ctx)[source]
visit_loop(ctx)[source]
visitFor_statement[source]
visitWhile_statement[source]
visitDo_statement[source]
visitSwitch_statement(ctx)[source]
visitSpawn_statement(ctx)[source]
visitExpression_statement(ctx)[source]
visitFor_condition(ctx)[source]
check_condition(expr)[source]
visitIf_statement(ctx)[source]
validate_source(tree, warnings_info, parameter_values=None)[source]
_validate_source(tree, warnings_info, parameter_values=None)[source]