[antlr-interest] ANTLR2005 workshop proceedings / photos

Terence Parr parrt at cs.usfca.edu
Tue Nov 1 18:02:58 PST 2005


On Nov 1, 2005, at 1:49 PM, shmuel siegel wrote:

> Terence Parr wrote:
>> Howdy,
>> For your enjoyment:
>> http://www.antlr.org/workshop/ANTLR2005/summary.html
>> Lots of great talks and fun was had by all!  Thanks to all of the   
>> attendees. :)  Lots of great ideas floating around!
>> Terence
> I was reading the ANTLR-v3 powerpoint presentation. The following  
> bullet
> caught my attention.
>
> "Does single token insertion or deletion if necessary to keep going"
>
> Does this imply that you transparently support the latest  
> definition for
> ECMAScript virtual semicolons? I.e., if you reach a point that the
> parser cannot consume the next token, insert a virtual semicolon  
> and try
> again.

The single token insertion works upon mismatched token; i.e., LA(1)! 
=t.  It asks if the current token LA(1) is actually something that  
can start what could follow the missing token t.  If so, it pretends  
to insert t and continues the parse.  In your case, if someone forgot  
a semicolon:

a=b
c=d;

then it would say c does not equal semicolon, but c is in fact what  
follows a semicolon; pretend to insert and continue.  So, the upshot  
is, that it might just work though you'd get a syntax error reported  
at the missing semicolon.

Ter


More information about the antlr-interest mailing list