|How about incremental parser! [message #1091729]
||Wed, 21 August 2013 22:44
| Rodrigo Antonio
Registered: June 2010
Location: São Paulo - Brasil
I Finally finish my editor. Thanks a lot for help.
But I have a little performace problem.
In my editor, every time I type a key, my parser is called(AbstractSourceParser) and I call ANTLR Parser. That's ok, but, there are many sources with 20 thousand lines of code.
I know that has a lot of lines in source isn't a good ideia, but we have many legacy sources.
I would like to do incremental parser, like JDT.
Has DLTK support for that?
|Re: How about incremental parser! [message #1092717 is a reply to message #1091729]
||Fri, 23 August 2013 05:55
| Alex Panchenko
Registered: July 2009
The parser from the editor is usually called with a small delay (0.5
second) to refresh the module structure (e.g. Outline), this operation
is called "reconcile".
As I understand, when you edit a file, only that single file should be
Actually JDT has no incremental parser (or probably you mean something
different). It uses hand-written parser which is way faster than ANTLR
generated and can work in 2 passes - first extract classes and
functions, then (when needed) go deeper and parse each statement and
build full AST. For example, when refreshing java file structure
(Outline), only the 1st step is enough.
If your language grammar allows such an optimization - you can try
implementing this approach. Otherwise the only way is
profiling/optimizing the current parser/validations, and delaying some
operations if possible.
If files are always big and parser can't be optimized then the only
alternative could be disabling the reconciler at all.
Hope this helps.
Powered by FUDForum
. Page generated in 0.02893 seconds