REPL, global, and local scoping

adam.preble at gmail.com adam.preble at gmail.com
Thu Mar 21 23:34:45 EDT 2019


On Tuesday, March 19, 2019 at 9:49:48 PM UTC-5, Chris Angelico wrote:
> I would recommend parsing in two broad steps, as CPython does:
> 
> 1) Take the source code and turn it into an abstract syntax tree
> (AST). This conceptualizes the behaviour of the code more-or-less the
> way the programmer wrote it.
> 
> 2) Implement the AST in byte-code.

You are totally right. It's not getting me here, but I am running into a problem using ANTLR's visitors to deal with what kind of storage opcode to use when running into an assignment. I only roughly pondered it in my head but never really looked at the AST Python was generating for clues.

But, you see, my cat is hungry and I have to, you know, ... take care of him. A lot. For awhile. Yeah. ;)



More information about the Python-list mailing list