Cattle.Interpreter¶
- Subclasses:
None
Methods¶
- Inherited:
- Structs:
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
Properties¶
Name |
Type |
Flags |
Short Description |
---|---|---|---|
r/w |
Get/set interpreter’s configuration |
||
r/w |
Get/set interpreter’s program |
||
r/w |
Get/set interpreter’s tape |
Signals¶
- Inherited:
Fields¶
- Inherited:
Name |
Type |
Access |
Description |
---|---|---|---|
parent |
r |
Class Details¶
- class Cattle.Interpreter(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
Opaque data structure representing an interpreter. It should never be accessed directly.
- classmethod new()[source]¶
- Returns:
a new
Cattle.Interpreter
- Return type:
Create and initialize a new interpreter.
- feed(input)[source]¶
- Parameters:
input (
Cattle.Buffer
) – more input to be used by self
Feed self with more input.
This method is meant to be used inside an input handler assigned to self; calling it in any other context is pointless, since the input is reset each time
Cattle.Interpreter.run
() is called.
- get_configuration()[source]¶
- Returns:
configuration for self
- Return type:
Get the configuration for self. See
Cattle.Interpreter.set_configuration
().
- get_program()[source]¶
- Returns:
the program for self
- Return type:
Get the program for self. See
Cattle.Interpreter.set_program
().
- get_tape()[source]¶
- Returns:
the memory tape for self
- Return type:
Get the memory tape used by self. See
Cattle.Interpreter.set_tape
().
- set_configuration(configuration)[source]¶
- Parameters:
configuration (
Cattle.Configuration
) – configuration for self
Set the configuration for self.
The same configuration can be used for several interpreters, but modifying it after it has been assigned to an interpreter may result in undefined behaviour, and as such is discouraged.
- set_debug_handler(handler, *user_data)[source]¶
- Parameters:
handler (
Cattle.InputHandler
orNone
) – debug handler, orNone
Set the debug handler for self.
The handler will be invoked every time self needs to perform a debug action; if handler is
None
, the default debug handler will be used.
- set_input_handler(handler, *user_data)[source]¶
- Parameters:
handler (
Cattle.InputHandler
orNone
) – input handler, orNone
Set the input handler for self.
The handler will be invoked every time self needs to perform an input action; if handler is
None
, the default input handler will be used.
- set_output_handler(handler, *user_data)[source]¶
- Parameters:
handler (
Cattle.OutputHandler
orNone
) – output handler, orNone
Set the output handler for self.
The handler will be invoked every time self needs to perform an output action; if handler is
None
, the default output handler will be used.
- set_program(program)[source]¶
- Parameters:
program (
Cattle.Program
) – aCattle.Program
Set the program to be executed by self.
A single program can be shared between multiple interpreters, as long as care is taken not to modify it after it has been assigned to any of them.
- set_tape(tape)[source]¶
- Parameters:
tape (
Cattle.Tape
) – aCattle.Tape
Set the memory tape used by self.
Property Details¶
- Cattle.Interpreter.props.configuration¶
- Name:
configuration
- Type:
- Default Value:
- Flags:
Configuration used by the interpreter.
Changes to this property are not notified.
- Cattle.Interpreter.props.program¶
- Name:
program
- Type:
- Default Value:
- Flags:
Program executed by the interpreter.
Changes to this property are not notified.
- Cattle.Interpreter.props.tape¶
- Name:
tape
- Type:
- Default Value:
- Flags:
Tape used to store the data needed by the program.
Changes to this property are not notified.