concepts.dsl.dsl_domain.DSLDomainBase#
- class DSLDomainBase[source]#
Bases:
object
The baseclass for the domain definition of a domain-specific language.
Methods
define_const
(dtype, value)Define a constant with the given type and value.
define_function
(function[, implementation])Define a function in the domain.
define_type
(t)Define a type in the domain.
get_function
(name)Get the function with the given name.
has_function
(name)Check whether the domain has a function with the given name.
Attributes
The name of the domain.
The types defined in the domain, as a dictionary from type names to types.
The functions defined in the domain, as a dictionary from function names to functions.
The constants defined in the domain, as a dictionary from the name to the
Value
objects.- __init__(name=None)[source]#
Initialize the domain.
- Parameters:
name (str | None) – the name of the domain. If not specified, the name of the class will be used.
- __new__(**kwargs)#
- define_const(dtype, value)[source]#
Define a constant with the given type and value.
- Parameters:
dtype (ObjectType | ValueType) – the type of the constant.
value (str) – the value of the constant. The value should be a string that is the name of the constant.
- define_type(t)[source]#
Define a type in the domain.
- Parameters:
t (ObjectType | ValueType) – the type to be defined.
- Returns:
the type that is defined.
- Return type:
- constants: Dict[str, ObjectConstant | Value]#
The constants defined in the domain, as a dictionary from the name to the
Value
objects.
- functions: Dict[str, Function]#
The functions defined in the domain, as a dictionary from function names to functions.
- types: Dict[str, ObjectType | ValueType]#
The types defined in the domain, as a dictionary from type names to types.