MCPcopy
hub / github.com/fluentpython/example-code-2e / repl

Function repl

18-with-match/lispy/py3.9/lis.py:118–125  ·  view source on GitHub ↗

A prompt-read-eval-print loop.

(prompt: str = 'lis.py> ')

Source from the content-addressed store, hash-verified

116################ Interaction: A REPL
117
118def repl(prompt: str = 'lis.py> ') -> NoReturn:
119 "A prompt-read-eval-print loop."
120 global_env = Environment({}, standard_env())
121 while True:
122 ast = parse(input(prompt))
123 val = evaluate(ast, global_env)
124 if val is not None:
125 print(lispstr(val))
126
127def lispstr(exp: object) -> str:
128 "Convert a Python object back into a Lisp-readable string."

Callers 1

mainFunction · 0.70

Calls 5

EnvironmentClass · 0.70
standard_envFunction · 0.70
parseFunction · 0.70
evaluateFunction · 0.70
lispstrFunction · 0.70

Tested by

no test coverage detected