Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

better location tracking #22

Open
GoogleCodeExporter opened this issue Apr 20, 2015 · 1 comment
Open

better location tracking #22

GoogleCodeExporter opened this issue Apr 20, 2015 · 1 comment

Comments

@GoogleCodeExporter
Copy link

It should be possible to parse a string and know for each terminal and
non-terminal which substring it matched. This will be useful for
edit-and-verify reloaded.

Original issue reported on code.google.com by radugrig...@gmail.com on 31 Jul 2009 at 7:05

@GoogleCodeExporter
Copy link
Author

Here is a possible design to improve edit and verify.

Some AST nodes have children and some do not. Some AST nodes are produced 
during 
parsing and some during transforming. AST nodes...
 * without children and created by the parser have a location computed by the parser;
 * with children have a location that is computed from their children locations;
 * without children and created by a transformer have a location that is computed 
from the locations of their 'motivating nodes'.

AST nodes should not be distinguished on the basis of their location. In 
particular, 
if whitespace is modified in the input file, then the parser must reuse the 
*same* 
AST and update the location information. If the location information is kept 
into an 
augmented binary tree then it is updated in Theta(lg n) time.

If the derived location information is cached, then some of the cached values 
must be 
removed when the raw location information changes. It is probably simpler and 
just as 
fast to recompute the derived location information every time.


Original comment by radugrig...@gmail.com on 21 Feb 2010 at 8:44

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant