Re:Mochi – Dynamically-typed language for functional and act...
by breuleux on Sunday December 14, 2014 @09:51PM
(#8750481)
I know that variable names in Python's AST can be any string, so for instance you could declare and use a variable named "+a-b$ $$?", even though that's not valid Python code. That's pretty minor, though, so I'm curious if there's anything more significant.
Re:Mochi – Dynamically-typed language for functional and act...
by Foxboron on Monday December 15, 2014 @12:42AM
(#8750823)
We got this very "problem" in Hy. AST allows for several characters as Names, where python does not.
A great example is with gensym, here we will make an ast.Name node with a prefix ":", if you run astor over this, you produce AST containing that very character. What happens if you try run this Python code? Syntax error. There is also a few other cases i can't think off right now.
I believe this is incorrect. Can you show an example of a valid abstract syntax tree that could not be represented in the grammar of the original language?