symbol_types module

Custom types and corresponding strings in the language.

Used in the Logic Simulator project. Most of the modules in the project use this module either directly or indirectly.

class symbol_types.DTypeInputType(value)

Bases: symbol_types.ExtendedEnum

D-type flip-flop inputs.

CLEAR = 'CLEAR'
CLK = 'CLK'
DATA = 'DATA'
SET = 'SET'
class symbol_types.DTypeOutputType(value)

Bases: symbol_types.ExtendedEnum

D-type flip-flop outputs.

Q = 'Q'
QBAR = 'QBAR'
class symbol_types.DeviceType(value)

Bases: symbol_types.ExtendedEnum

Supported devices.

AND = 'AND'
CLOCK = 'CLOCK'
D_TYPE = 'DTYPE'
NAND = 'NAND'
NOR = 'NOR'
NOT = 'NOT'
OR = 'OR'
SWITCH = 'SWITCH'
XOR = 'XOR'
class symbol_types.ExtendedEnum(value)

Bases: enum.Enum

Subclass of default Enum with add values method.

classmethod values() list

List all the values of the Enum.

class symbol_types.ExternalSymbolType(value)

Bases: symbol_types.ExtendedEnum

User-defined symbol types.

IDENTIFIER = 'IDENTIFIER'
NUMBERS = 'NUMBERS'
class symbol_types.KeywordType(value)

Bases: symbol_types.ExtendedEnum

Language builtin keywords, used to initiate blocks.

CONNECTIONS = 'CONNECTIONS'
DEVICES = 'DEVICES'
MONITORS = 'MONITORS'
class symbol_types.OperatorType(value)

Bases: symbol_types.ExtendedEnum

Operators defined in the logic definition language.

COLON = ':'
COMMA = ','
CONNECT = '-'
DOT = '.'
EQUAL = '='
LEFT_ANGLE = '<'
RIGHT_ANGLE = '>'
SEMICOLON = ';'
class symbol_types.ReservedSymbolType

Bases: object

All built-in symbol types in the language, which are reserved.

This class is created from ReservedSymbolTypeMeta, combining all the types together.

Specify all the symbol type contexts as a class attribute list.

symbol_contexts

List of all symbol type contexts

Type

list

AND = 'AND'
CLEAR = 'CLEAR'
CLK = 'CLK'
CLOCK = 'CLOCK'
COLON = ':'
COMMA = ','
CONNECT = '-'
CONNECTIONS = 'CONNECTIONS'
DATA = 'DATA'
DEVICES = 'DEVICES'
DOT = '.'
D_TYPE = 'DTYPE'
EQUAL = '='
LEFT_ANGLE = '<'
MONITORS = 'MONITORS'
NAND = 'NAND'
NOR = 'NOR'
NOT = 'NOT'
OR = 'OR'
Q = 'Q'
QBAR = 'QBAR'
RIGHT_ANGLE = '>'
SEMICOLON = ';'
SET = 'SET'
SWITCH = 'SWITCH'
XOR = 'XOR'
symbol_contexts = [<enum 'KeywordType'>, <enum 'OperatorType'>, <enum 'DeviceType'>, <enum 'DTypeInputType'>, <enum 'DTypeOutputType'>]
class symbol_types.ReservedSymbolTypeMeta(classname, bases, dictionary)

Bases: type

Metaclass that create classes acting as wrapper around Enums.

This allows combination of several Enums, with value pointing to the original Enum entry, enabling correct comparison.

Class created have an interface similar to that of the standard Enum.

property mappings: mappingproxy

Property that returns a mapping between type value and type.

values() list

Return all the type values.