Data Model

class semdsl.datamodel.semdsl_model.WeakRefShimBaseModel[source]

Bases: BaseModel

class semdsl.datamodel.semdsl_model.ConfiguredBaseModel[source]

Bases: WeakRefShimBaseModel

class semdsl.datamodel.semdsl_model.ParserType(value)[source]

Bases: str, Enum

An enumeration.

earley = 'earley'
lalr = 'lalr'
class semdsl.datamodel.semdsl_model.GrammarType(value)[source]

Bases: str, Enum

An enumeration.

ContextFree = 'ContextFree'
Regular = 'Regular'
ContextSensitive = 'ContextSensitive'
class semdsl.datamodel.semdsl_model.GrammarSyntaxType(value)[source]

Bases: str, Enum

An enumeration.

lark = 'lark'
antlr = 'antlr'
ebnf = 'ebnf'
class semdsl.datamodel.semdsl_model.SchemaGrammar(*, description: str | None = None, rules: List[ProductionRule] | None = None, expressivity: GrammarType | None = None, start_symbols: List[str] | None = None, parser: ParserType | None = None, pragmas: List[str] | None = None, syntax: GrammarSyntaxType | None = None, normalize_collections: bool | None = None)[source]

Bases: ConfiguredBaseModel

A SchemaGrammar (or DSL) is a set of production rules that are mapped to a schema

description: str | None
rules: List[ProductionRule] | None
expressivity: GrammarType | None
start_symbols: List[str] | None
parser: ParserType | None
pragmas: List[str] | None
syntax: GrammarSyntaxType | None
normalize_collections: bool | None
class semdsl.datamodel.semdsl_model.ProductionRule(*, description: str | None = None, lhs_symbol: str | None = None, lhs: Sequence | Disjunction | AtomicSequence | None = None, rhs: Sequence | Disjunction | AtomicSequence | None = None, rhs_serialized: str | None = None, is_terminal: bool | None = None, alias: str | None = None, source_class: str | None = None, source_slot: str | None = None, yields: Any | None = None)[source]

Bases: ConfiguredBaseModel

A production rule is a mapping from a left-hand side (LHS) to a right-hand side (RHS). The LHS is a non-terminal symbol, and the RHS is a sequence of symbols, which may be terminals or non-terminals.

description: str | None
lhs_symbol: str | None
lhs: Sequence | Disjunction | AtomicSequence | None
rhs: Sequence | Disjunction | AtomicSequence | None
rhs_serialized: str | None
is_terminal: bool | None
alias: str | None
source_class: str | None
source_slot: str | None
yields: Any | None
class semdsl.datamodel.semdsl_model.Sequence(*, type: Literal['Sequence'] = 'Sequence', serialized: str | None = None)[source]

Bases: ConfiguredBaseModel

A sequence is a sequence of symbols, which may be terminals or non-terminals.

type: Literal['Sequence']
serialized: str | None
class semdsl.datamodel.semdsl_model.Disjunction(*, type: Literal['Disjunction'] = 'Disjunction', serialized: str | None = None, operands: List[Sequence | Disjunction | AtomicSequence] | None = None)[source]

Bases: Sequence

A disjunction is a set of sequences that represent alternative ways to parse tokens

operands: List[Sequence | Disjunction | AtomicSequence] | None
type: Literal['Disjunction']
serialized: str | None
class semdsl.datamodel.semdsl_model.AtomicSequence(*, type: Literal['AtomicSequence'] = 'AtomicSequence', serialized: str | None = None, elements: List[Sequence | Disjunction | AtomicSequence | Symbol | Terminal | NonTerminal] | None = None, alias: str | None = None, source_class: str | None = None)[source]

Bases: Sequence

An atomic sequence is a sequence of symbols, which may be terminals or non-terminals.

elements: List[Sequence | Disjunction | AtomicSequence | Symbol | Terminal | NonTerminal] | None
alias: str | None
source_class: str | None
type: Literal['AtomicSequence']
serialized: str | None
class semdsl.datamodel.semdsl_model.Symbol(*, type: Literal['Symbol'] = 'Symbol', repetitions: str | None = None)[source]

Bases: ConfiguredBaseModel

A symbol is a terminal or non-terminal symbol

type: Literal['Symbol']
repetitions: str | None
class semdsl.datamodel.semdsl_model.Terminal(*, type: Literal['Terminal'] = 'Terminal', repetitions: str | None = None, value: str | None = None)[source]

Bases: Symbol

A terminal symbol is a symbol that represents a literal token

value: str | None
type: Literal['Terminal']
repetitions: str | None
class semdsl.datamodel.semdsl_model.NonTerminal(*, type: Literal['NonTerminal'] = 'NonTerminal', repetitions: str | None = None, name: str | None = None, source_class: str | None = None, source_slot: str | None = None)[source]

Bases: Symbol

A non-terminal symbol is a symbol that represents a non-terminal

name: str | None
source_class: str | None
source_slot: str | None
type: Literal['NonTerminal']
repetitions: str | None