[antlr-interest] bug in java.g?

SainTiss saintiss at arklinux.org
Tue Feb 3 16:21:30 PST 2004


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

On Tuesday 03 February 2004 21:03, Terence Parr wrote:
> On Feb 3, 2004, at 11:55 AM, SainTiss wrote:
> > -----BEGIN PGP SIGNED MESSAGE-----
> > Hash: SHA1
> >
> > Hi,
> >
> > when parsing a file containing nothing but the following line:
> >
> > m = (TEST) d;
> >
> > I get the following exception:
> >
> > parser exception: emp.java:1:1: unexpected token: m
> > emp.java:1:1: unexpected token: m
> >         at JavaRecognizer.statement(JavaRecognizer.java:2058)
> >         at Main.parseFile(Main.java:81)
> >         at Main.doFile(Main.java:54)
> >         at Main.main(Main.java:24)
> >
> > I'm calling the "statement()" method from the JavaRecognizer, so the
> > file
> > should be valid.
> > What's more, if I add a word (e.g. "smdfjmkj") on a line after the
> > statement
> > in the file, the parser does *not* throw the exception...
> >
> > Is there an explanation for this?
>
> Howdy.
>
> Yes, statement is not a "start symbol" EOF cannot follow it normally.
> YOu must make a rule liek this:
>
> stat_entry : stat ;

That doesn't seem to solve the problem... Still the exact same exception...

>
> not called by anybody so ANTLR does the right thing.  Then invoke the
> grammar from stat_entry.
>
> The second problem you have is that you told antlr to match a
> statement, not two.  It ignores what it doesn't care.  It did theone
> statement and returned :)

I told it to match one statement indeed, but the problem is that it does *not* 
seem to ignore everything else... With this input:
m = (TEST) n;
there is one statement, but the parser crashes.
With this input:
m = (TEST) n;
tessmklj
The parser successfully parses the first statement, and does not crash... So 
that does look quite odd, no?

Thanks,

Hans

>
> :)
>
> Terence
> --
> Professor Comp. Sci., University of San Francisco
> Creator, ANTLR Parser Generator, http://www.antlr.org
> Co-founder, http://www.jguru.com
> Co-founder, http://www.knowspam.net enjoy email again!
> Co-founder, http://www.peerscope.com pure link sharing
>
>
>
>
>
>
> Yahoo! Groups Links
>
> To visit your group on the web, go to:
>  http://groups.yahoo.com/group/antlr-interest/
>
> To unsubscribe from this group, send an email to:
>  antlr-interest-unsubscribe at yahoogroups.com
>
> Your use of Yahoo! Groups is subject to:
>  http://docs.yahoo.com/info/terms/

- -- 
Ark Linux - Linux for the Masses (http://arklinux.org)

Capitalism: 
You don't have any cows. The bank will not lend you money to buy cows, 
because you don't have any cows to put up as collateral.

Representative Democracy:
You have two cows. Your neighbors pick someone to tell you who gets the milk. 

In a world without walls and fences, who needs windows and gates?

Hans Schippers
2LIC INF
UA 2003-2004
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)

iD8DBQFAIDsKXlnUYIbmLOQRAq8XAJ4wHBT8Zez8Y4DG87GzcDDFJ/KZzACfVgOa
vNSImcKmljS2kvCE9CZ/3mA=
=0gAe
-----END PGP SIGNATURE-----


 

Yahoo! Groups Links

To visit your group on the web, go to:
 http://groups.yahoo.com/group/antlr-interest/

To unsubscribe from this group, send an email to:
 antlr-interest-unsubscribe at yahoogroups.com

Your use of Yahoo! Groups is subject to:
 http://docs.yahoo.com/info/terms/ 




More information about the antlr-interest mailing list