astero.python.emit¶
A Python expression emitter whose brackets come from the declared precedence table rather than from the templates.
astero.python.emit ¶
A Python expression emitter, with brackets derived rather than written.
The templates say what each production looks like. None of them says when a
subexpression needs brackets: child asks needs_parens with the declared
precedence, and that is the only place the question is answered.
The oracle is a round trip. Emit an expression, parse the result, and compare
the trees. tests/b_integration/test_emit_roundtrip.py runs it over every
expression in the standard library.
child ¶
Emit node in a position of binding power outer, bracketing if needed.
The one place brackets are decided. Every template calls this and none of them knows the rule.