Engine

Internal documentation for the amalgam.engine module.

class amalgam.engine.Engine[source]

Class that serves as the frontend for parsing and running programs.

environment

An environment.Environment instance containing the built-in functions and a reference to the engine.Engine instance wrapped within a amalgams.Internal, accessible through the ~engine~ key.

Type

environment.Environment

_interpret(text: str, source: str = '<unknown>')amalgam.amalgams.Amalgam[source]

Parses and runs a text from a source.

Internal-facing method intended for use within amalgam.primordials.

interpret(text: str, source: str = '<unknown>', file: IO = <_io.TextIOWrapper name='<stdout>' mode='w' encoding='UTF-8'>)None[source]

Parses and runs a text from a source.

User-facing method intended for use within amalgam.cli. Prints the result to sys.stdout unless specified. Handles pretty-printing of amalgams.Notifications.

repl(*, prompt: str = '> ', prompt_cont: str = '| ')None[source]

Runs a REPL session that supports multi-line input.

Parameters
  • prompt (str) – The style of the prompt on regular lines.

  • prompt_cont (str) – The style of the prompt on continued lines.