> This leaves us with a few options: 5. Reuse/Abuse Num(object) for arbitrary constants. AFAICT, this should work out of the box. > 1. A new AST expr node for constant values for types other than Str/Num > > I imagine this to be something like Const(PyObject* v), which is > effectively translated to a "LOAD_CONST v" by the compiler. This trades > the purity of the AST for a little practicality. A "Const" node has no > real source representation, it would exist solely for the purpose of > injecting PyObject constants into the AST. I think this is the way to go. It doesn't violate purity: it is an *abstract* syntax, meaning that there doesn't need to be a 1:1 relationship to source syntax. However, it is still possible to reproduce source code from this Const node. I also don't worry about Jython conflicts. The grammar has a version number precisely so that you can refer to a specific version if you need to. Regards, Martin
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4