[antlr-interest] newbie: tokens and lexer rules
JConner at ssp-uk.com
JConner at ssp-uk.com
Wed Aug 3 02:45:35 PDT 2005
Prashant,
It's the 2000+ line fgl.g grammer here -
http://www.antlr.org/grammar/1073355410988/fgl.g - if you want to see it in
full. It works - it's just my modification outlined earlier that doesn't.
Yes - the tokens are defined in the lexer just below the class definition
in the tokens { .. } block - eg:
tokens {
ABSOLUTE = "absolute" ;
AFTER = "after" ;
<more>
DAY = "day" ;
<more>
MONTH = "MONTH" ;
<etc>
So it seems to me that I can use tokens in parser rules but not lexer rules
- this just doesn't seem right at all... I must be doing something wrong -
but I don't know what.
John
|---------+---------------------------------->
| | "Prashant Deva" |
| | <prashant.deva at gmail.co|
| | m> |
| | Sent by: |
| | <antlr-interest-bounces|
| | @antlr.org> |
| | |
| | |
| | 02/08/2005 17:59 |
| | Please respond to |
| | "Prashant Deva" |
| | |
|---------+---------------------------------->
>------------------------------------------------------------------------------------------------------------------------------|
| |
| To: <JConner at ssp-uk.com> |
| cc: <antlr-interest at antlr.org> |
| Subject: Re: [antlr-interest] newbie: tokens and lexer rules |
>------------------------------------------------------------------------------------------------------------------------------|
JConner,
Show us a bit more more of ur grammar and then maybe i can tell the
problem.
Are the DAY, YEAR,etc defined as tokens in the lexer?
PRASHANT
On 8/2/05, JConner at ssp-uk.com <JConner at ssp-uk.com> wrote:
>
> ??? this seems to be completely unrelated to the question I asked...
>
> At any rate, if you want to use java, you can't really do without the
.java
> and .class files. You could bundle everything up into a jar file if you
> wanted to have a single file for distribution/execution. Perhaps you
want
> the C version of antlr.
>
> John
>
>
>
> |---------+---------------------------------->
> | | "Sarayooth |
> | | Chittratanawat" |
> | | <sarayooth at gmail.com> |
> | | Sent by: |
> | | <antlr-interest-bounces|
> | | @antlr.org> |
> | | |
> | | |
> | | 02/08/2005 15:25 |
> | | Please respond to |
> | | "Sarayooth |
> | | Chittratanawat" |
> | | |
> |---------+---------------------------------->
> >
------------------------------------------------------------------------------------------------------------------------------|
> |
|
> | To: <antlr-interest at antlr.org>
|
> | cc:
|
> | Subject: Re: [antlr-interest] newbie: tokens and lexer rules
|
> >
------------------------------------------------------------------------------------------------------------------------------|
>
>
>
>
> Hi,
>
> Basically, to create the parser. I did the following.
> 1. Use Antlr.tool to generate java class
> 2. Create Main Java class to invoke those parser/lexer.
>
> Anybody know how to generate the parser from the grammar file without
> create the java class file.
>
> Thanks
>
>
>
>
>
More information about the antlr-interest
mailing list