If you define a sum type like
expr = Unary(expr e) | Binary(expr left, expr right)
Then you will get three pieces of generated code:
expr_e.Unary
if node.tag == expr_e.Unary
expr.Unary()
node = expr.Unary(child)
expr__Unary()
expr_t
isinstance(node, expr_t)
The implementation is here, with some more notes in the README.
https://github.com/oilshell/oil/tree/master/asdl
For conceptual background, see blog posts tagged #ASDL or the original Zephyr technical report.
There was an error while loading. Please reload this page.