On Saturday, November 23, 2019 at 4:46:08 AM UTC-6, Edward K. Ream wrote:
>
> Neither the results list nor the Linker class is needed! This is a 
> stunning collapse in complexity.
>

To summarize recent work:

The project creates the absolute minimum of variable length data structures:

- The token list, created by python's tokenizer module.

- The parse tree, created by python's ast module.

- The node stack.  This stack saves and restores the node being visited. 
This stack is essential.  It ensures that the *python* call stack contains 
a bounded number of entries, about 10 max.

So the project makes the absolute minimal demands on the GC.  Moreover, the 
project is extremely fast. It takes less time to create two-way links 
between the token list and the parse tree than it takes to create the token 
list and the parse tree!

*Summary of the summary*

The only significant global data structures are those mentioned above.

There is now only a single generator. This generator traverses the parse 
tree without exploding python's call stack.

Syncing tokens to parse tree nodes involves stepping an integer index 
through the token list using "peek" and "advance" functions.  At least two 
separate syncing operations are required:

- The do_If visitor uses peek and advance to determine whether to generate 
'if' or 'elif' tokens.

- The upcoming tog.sync method will use peek and advance to associate 
significant tokens to their respective parse tree nodes.

All "peek" and "advance" functions will be local to their respective 
methods.

The only "products" of this project are the two-way links themselves.

Edward

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/leo-editor/f05c8055-5747-4fef-ac78-8a249b200f10%40googlegroups.com.

Reply via email to