[antlr-interest] Truely, a BASIC question

Nigel Sheridan-Smith nbsherid at secsme.org.au
Mon Nov 21 22:03:49 PST 2005



> -----Original Message-----
> From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-
> bounces at antlr.org] On Behalf Of Rob Greene
> Sent: Tuesday, 22 November 2005 2:38 PM
> To: ANTLR Interest
> Subject: [antlr-interest] Truely, a BASIC question
> 
> I am most definitely new to ANTLR. I'm working out a grammar file for
> a BASICish language where line endings are important. Language
> statements do not end with a colon uniformly - instead it is most
> likely a newline that separates statements. I haven't discovered any
> tutorials that covers this and haven't located any information in the
> documentation.
> 
> What I've tried:
> * optionally allow the colon separator - but that allows stuff like
> "goto this goto that" instead of requiring a colon/newline between
> commands ("goto this : goto that").
> * pulled newline out of the WS variable (?? terminology) in my grammar
> file and added a separator rule of "( COLON | NEWLINE )+" to require
> one or more separators and then attempt to use the rule appropriately.
> This seems to work, but I get odd errors:
> 
> line 8:15: unexpected token:
> 
> line 9:9: unexpected token:
> 
> line 10:1: unexpected token:
> 
> line 11:1: unexpected token: gosub
> 

Hi Rob,

It all looks legit to me, but maybe I am missing something.

Can you send the input file that reproduces those errors? 

Thanks,

Nigel

P.S. The line 'LT: "<"; ' might cause trouble with ANTLR look-ahead.

--
Nigel Sheridan-Smith
PhD research student

Faculty of Engineering
University of Technology, Sydney
Phone: 02 9514 7946
Fax: 02 9514 2435




More information about the antlr-interest mailing list