[antlr-interest] Extracting autocompletion rules from antlr grammar
Bo Ba
bo-ba at mail.ru
Fri Nov 14 09:06:37 PST 2008
Hello,
Since autocompletion is not yet supported by ANTLR (http://groups.google.com/group/il-antlr-interest/browse_thread/thread/7c6d05a35046854d), I am thinking of implementing this simple reverse engineering approach.
1. Take a programm, which is complete in terms of the grammar.
2. Parse it in antlr parser.
3. During parsing of this "complete program", every current token type will get a set of token types, which can follow this current token.
4. As user types his program, the latter will be parsed on every key stroke (incrementally or not), and a current token will be extracted, which then will be used to get a corresponding set of possible predictions.
5. Optionally, the predictions will be filtered by their semantic validity, before presented to the user.
Am I overlooking something obvious feature of ANTLR, which could simplify this procedure? Specifically, are items 1 to 3 above the best way to obtain the raw predictions for every token type?
Thanks.
V
More information about the antlr-interest
mailing list