[antlr-interest] ANTLR-Parser to deliver the lookahead

Terence Parr parrt at cs.usfca.edu
Fri Nov 11 16:59:49 PST 2011


Hi. I believe there is some limited support for asking for FIRST or FOLLOW sets. there is no easy way to do this, but if you want to do it on a rule-based granularity, you can always look at the follow sets that are passed into each rule. the sets contain the tokens that can follow the rule reference in the invoking rule but without falling off the end of that rule.  Hmm… even that is not perfect.  Well, if you can wait for v4, there is a function that simply gives you the right answer at any moment.
Ter
On Nov 8, 2011, at 2:38 AM, Seibert, Andreas wrote:

> Dear Prof. Dr. Parr,
>  
> my name is Andreas Seibert, I am working for the Fraunhofer Institute for Communication, Information Processing and Ergonomics (FKIE) near Bonn (Germany).
> At the moment we are developing a graphical user interface for smartphones which are supposed to be used with an existing platform for crises management.
> This GUI should support crises forces to communicate and to cooperate.
> For a better understanding: In Germany there are several forces involved in crises management,
> e.g., forces for search and rescue, forces for technical support, fire department, police and guidance.
>  
> Our system works with an ANTLR-grammar and we are having some difficulties solving the following problem so that we would be very grateful for your help.
>  
> The mobile GUI communicates with the base system. For that reason it is necessary for our ANTLR-Parser to deliver always the lookahead for the next input possible to the GUI.
> In order for us to do something similar to auto-completion (i.e. showing all possible next tokens for an incomplete input sentence), we need to have the lookahead for an erroneous input.
>  
> At now, we see two options:
>  
> First, we might modify the ANTLR-Parser. That, however, would be a One-Way-Ticket because when we modify the grammar we would need to do this also for the Parser.
>  
> Second, we might modify the Compiler so that it compiles the Parser to always provide the lookahead. 
>  
> My questions are
> 1.     Is it possible to modify the Compiler as indicated in the second option?
> 2.     Has anyone already done such a modification so that we can use his or her results?
> 3.       Can you give us some advice where to do these modifications?
>  
> It would be very kind if you can give us some hints or answers about those questions 
> and we would highly appreciate that.
>  
> Sincerely yours,
>  
>  
> Andreas Seibert
>  
> Informationstechnik für Führungssysteme (ITF)
> Fraunhofer-Institut für Kommunikation, Informationsverarbeitung und Ergonomie (FKIE)
>  
> Information Technology for Command and Control
> Fraunhofer Institute for Communication, Information Processing and Ergonomics
>  
> Neuenahrer Straße 20 | 53343 Wachtberg | Germany
> Tel.: +49 (0)228 9435-0
> andreas.seibert at fkie.fraunhofer.de
> http://www.fkie.fraunhofer.de
>  
>  



More information about the antlr-interest mailing list