[antlr-interest] Concept Problem with recognizing Tokens
Jeff Skaanland
kjz at cypress.com
Mon Apr 30 09:54:19 PDT 2007
Hopefully this isn't just something I've been overlooking in my searches
but....
I'm processing a type of assembly language and am running into a problem.
Outside of Labels, there is a set amount of vocabulary for the language
which I defined as tokens (MAC = "mac"; ALU = "alu"; ...).
Problem I face:
When I intentionally put an error into the input stream, for
example use 'Mcdonalds' as command, instead of saying "found MCDONALDS,
expected MAC" it reports "found 'c', expected 'a'. To fix this, I wished to
process every word into a token, but then I can't figure out how to take a
token, INSTRUCTION, and then check to see if it's actually a MAC token or
ALU token and, if not, spit out "Found MCDONALDS, expected RUTHS_CHRIS" (Or
expected MAC again...)
Thanks for setting me straight,
JT
More information about the antlr-interest
mailing list