Hello everyone!

I'd first like to say I discovered this library a few days ago and
immediately fell in love with it, so kudos to the author for a great
tool. I always thought I need to interface Prolog if I wanted to work
with grammars.

I'm constructing a simple assembler for one of my projects. So far I'm
very pleased how it works. I have already dealt with the problem I'm
having, but I had to make some small compromises. I'd like to know if
there's another way.

I'm using the trick with "t_ID" to reference my keywords (assembler
instruction mnemonics actually), which is mentioned in the manual. I
have also defined a rule for hexadecimal numbers. These two didn't
work well together. If the "t_ID" rule was the first one, the lexer
defined hexadecimal numbers starting with letters as ID (because it
couldn't find it in the dictionary and returned the default "ID"). On
the other hand, if the "t_VALUE" rule was the first one, it searched
for numbers through instruction mnemonics (for instance, "ADD" and
"ADC" are completely valid hexadecimal numbers, but the rule also
found partial numbers, like "C" in "INC"). My solution was to put "0x"
in front of each hexadecimal number and change the rule accordingly.

Now, ID rule returns whatever it finds in the dictionary or the
default value if the word is not in the dictionary. If I program the
function so that the rule returns only fund values, the default match
is discarded and parsing moves on. My question: is there a way to tell
the match is wrong for this rule and to continue parsing and try it
out with other rules which are not yet used / tried?

Thanks.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"ply-hack" 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/ply-hack?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to