Skip to content

class Automaton(metaclass=ABCMeta)

An abstract base class for all automata, including Turing machines.

input_parameters: Dict[str, Any] property

Return the public attributes for this automaton.

Returns:

Type Description
Dict[str, Any]

A dictionary mapping attribute names to their values.

accepts_input(input_str)

Return True if this automaton accepts the given input.

Parameters:

Name Type Description Default
input_str str

The input string to check.

required

Returns:

Type Description
bool

True if this automaton accepts the given input; False otherwise.

copy()

Create a deep copy of the automaton.

Returns:

Type Description
Self

A deep copy of the automaton.

read_input(input_str)

Check if the given string is accepted by this automaton.

Return the automaton's final configuration if this string is valid.

Parameters:

Name Type Description Default
input_str str

The input string to check.

required

Returns:

Type Description
AutomatonStateT

The final configuration of the automaton after reading the input.

read_input_stepwise(input_str) abstractmethod

Return a generator that yields each step while reading input.

Parameters:

Name Type Description Default
input_str str

The input string to read.

required

Yields:

Type Description
Generator[Any, None, None]

A generator that yields the current configuration of the automaton after each step of reading input.

Raises:

Type Description
NotImplementedError

If this method has not been implemented by a subclass.

validate() abstractmethod

Raises an exception if this automaton is not internally consistent.

Raises:

Type Description
NotImplementedError

If this method has not been implemented by a subclass.