On Apr 11, 4:36 am, Joep Suijs <[email protected]> wrote:
>
> The good news is the parser can read the 16f877 device file, process &
> dump it and the output is almost compilable.
>

That is great news!

> The general rule of the lex analyser is: if it starts with a letter,
> it is an identifier. If it starts with a number, it is an constant. So
> by the time it reaches the parser, these parameters are already
> converted into more then one token. For now, the parser accepts this
> and the next level of code has to deal with this, but this is a bit of
> a hack. Don't know if this is my limited knowledge of altlr or a quirk
> in the JAL language...

I ran into this also, I don't recall whether in Antlr or perhaps one
of the other parsing libraries I tried, before Antlr.  I see it as a
sort of quirk of JAL, but there will be many others, so don't worry
about hacks--  right now we are just trying to deal with syntax--
later we will work on semantics. I recommend just keep moving forward
-- Try to get some of the 'blink the led' samples from JALLIB to run
all the way through.

>
> Something else is the result of the parser: it seems to provide a
> 'flat tree' with 5252 nodes while I would expect to find the knowledge
> on the structure provided by the grammar, so a tree and (also) encoded
> tokens.
>

Right, the multi-level structured tree is one of the main advantages
of Antrl  (in addition to Python output, but you'll figure that out
eventually I hope. :-) )

I am not sure, but I think we'll have to add some more statements
mixed in with the grammar to accomplish the tree structure.
Personally I was thinking to wait until we have all of the syntax done
correctly, since the extra code makes the grammar harder to read and
edit.  But it is quite possible that I am confused about all of this,
so go ahead.  Have you looked at some of the small grammar examples?
I know it can be a little confusing to sort out the old 'obsolete'
Antlr examples for the more recent ones.  Scott Stanchfield (javadude)
has some nice, fairly recent Antlr tutorials: 
http://javadude.com/articles/antlr3xtut/

By the way, here are my Antrl bookmarks, in case you're interested:
http://delicious.com/ab4yd10/antlr

Thank you!

William

-- 
You received this message because you are subscribed to the Google Groups 
"jallib" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/jallib?hl=en.

Reply via email to