[antlr-interest] Lexer grammar in AntlrWorks 1.4.3

Jim Idle jimi at temporal-wave.com
Thu Mar 1 12:01:26 PST 2012


I don't think that ANTLR works can run a lexer only grammar - it needs a
minimum parser to invoke it I think.

Jim

> -----Original Message-----
> From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-
> bounces at antlr.org] On Behalf Of Daniela da Cruz
> Sent: Thursday, March 01, 2012 11:14 AM
> To: Stefan Mätje
> Cc: antlr-interest
> Subject: Re: [antlr-interest] Lexer grammar in AntlrWorks 1.4.3
>
> Hi Stefan,
>
> I have named the file that contains the lexer grammar as testRE.g.
> Exactly as I do with combined grammars.
> Are you able to run the file attached with success in AntlrWorks?
>
> thanks
> daniela
>
> On Thu, Mar 1, 2012 at 18:47, Stefan Mätje < Stefan.Maetje at esd-
> electronics.com> wrote:
>
> > Hi,
> >
> > it seems to me that you have either the lexer grammar not named
> > properly or perhaps not saved with the same name as it is given in
> > your lexer grammar
> > ("testRE") below.
> >
> > AntlrWorks runs the compiler himself but has given the compiler the
> > name "null.java". The name string internal of AntlrWorks seemed to be
> > a null reference -> null+".java". I would have expected
> "testRE.java".
> >
> > Same accounts for the error message of the compiler for
> __Test__.java.
> > Id was missing because of empty lexer name ...
> >
> >
> > Am 01.03.2012 16:08:59 schrieb(en) Daniela da Cruz:
> > > Hi.
> > >
> > > I have been creating a very simple lexer in AntlrWorks but when
> > > trying to run it I got the following errors:
> > >
> > > [15:01:29] javac: file not found:
> > > C:\Users\Utilizador\Desktop\output\null.java
> >
> > Bad file name from null reference?   ^^^^
> >
> > > [15:01:29] Usage: javac <options> <source files> [15:01:29] use
> > > -help for a list of possible options [15:01:31]
> > > C:\Users\Utilizador\Desktop\output\__Test__.java:12:
> > > <identifier> expected
> > > [15:01:31]  g = new (tokens, 49100, null);
> > > [15:01:31]         ^
> >
> > Missing lexer class  ^^^^ name.
> >
> > > [15:01:31] 1 error
> > >
> > > It seems that is looking for the parser file that usually exists on
> > > a combined grammar.
> > > Was anyone able to run a lexer grammar in AntlrWorks?
> > >
> > > My lexer was something like:
> > >
> > > ---------------------------------------------------
> > > lexer grammar testRE;
> > >
> > > ID: '0'..'9'+ ;
> > > ---------------------------------------------------
> >
> > This worked for me in AntlrWorks 1.4.3
> >
> > Regards,
> >        Stefan
> >
> >
> >


More information about the antlr-interest mailing list