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

Function parse

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

Read a Scheme expression from a string.

(program: str)

Source from the content-addressed store, hash-verified

23################ Parsing: parse, tokenize, and read_from_tokens
24
25def parse(program: str) -> Expression:
26 "Read a Scheme expression from a string."
27 return read_from_tokens(tokenize(program))
28
29def tokenize(s: str) -> list[str]:
30 "Convert a string into a list of tokens."

Callers 15

test_parseFunction · 0.90
test_evaluateFunction · 0.90
test_evaluate_variableFunction · 0.90
test_evaluate_literalFunction · 0.90
test_evaluate_quoteFunction · 0.90
test_evaluate_if_trueFunction · 0.90
test_evaluate_if_falseFunction · 0.90
test_defineFunction · 0.90
test_lambdaFunction · 0.90
test_beginFunction · 0.90

Calls 2

read_from_tokensFunction · 0.70
tokenizeFunction · 0.70

Tested by 15

test_parseFunction · 0.72
test_evaluateFunction · 0.72
test_evaluate_variableFunction · 0.72
test_evaluate_literalFunction · 0.72
test_evaluate_quoteFunction · 0.72
test_evaluate_if_trueFunction · 0.72
test_evaluate_if_falseFunction · 0.72
test_defineFunction · 0.72
test_lambdaFunction · 0.72
test_beginFunction · 0.72