[antlr-interest] Strange code generation for Fortran
Olivier Dragon
dragonoe at mcmaster.ca
Wed Jul 27 07:53:02 PDT 2005
On Wed, Jul 27, 2005 at 04:56:52PM +0400, Alexey Demakov wrote:
> In optlabel rule when the type of the next token LA(1) is LABEL
> we build AST node and match LABEL token. optrule execution done.
> If LA(1) is not in follow set of optlabel rule (EOS, LITERAL_* etc)
> we already have syntax error and can throw exception.
> If LA(1) is in follow set of optlabel we don't match next token!
> But simply return from optlabel.
So you are saying that if LA(1) is not a LABEL, then the parser tries to
match the possible tokens that may follow an optlabel? Shouldn't that be
left to the next rule (wholeStatement | endStatement) to decide if
there's a syntax error? I guess that was a design decision...
I found where the problem was. The rule assignmentStatement didn't
contain the form `NAME = expression'.
> About token buffer. I suppose you miss that tokens in array can start not from 0
> but from index specified in some other field (don't remember exactly its name).
> In debugger it looks like LT(1) is not equal to array[0] element. :)
Right. Thanks for pointing it out :o) Forgot my basic algorithms there
for a second.
Thank you very much for your help.
-Olivier
--
__-/| ? ? |\-__
__--/ / \ (^^) / \ \--__
_-/ / / /\ / ( ) /\ \ \ \-_
/ / / / / ( ^^ ~ \ \ \ \ \
/ Oli Dragon ( dragonoe at mcmaster.ca \
/ B.Eng. Sfwr ( ) \ \ \ \
/ / / /__--_ ( ) __--__\ \ \ \
| / / _/ \_ \_ \_ \ \ |
\/ / _/ \_ \_ \_ \ \/
\_/ / -\_\ \ \_/
\/ ) \/
*~
___--<***************>--___
[http://dragon.homelinux.org]
~~~--<***************>--~~~
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://www.antlr.org/pipermail/antlr-interest/attachments/20050727/4b542121/attachment.bin
More information about the antlr-interest
mailing list