[antlr-interest] Parsing length-prefixed strings...
Douglas Mayle
dmayle at dmayle.com
Wed Sep 27 09:14:25 PDT 2006
I was hoping someone here might be able to point me in the right
direction. I've read most of the FAQ, and the document, and I still
haven't got an idea where to head. In the language I'm parsing a have a
a token stream that includes integers and characters. However, my
string literals, rather than being bounded on both sides, have an
opening character, a two digit length, and then that many characters. I
can't figure out how to match this fixed length stream with a parser. A
string might look like:
;05Hello
or:
;06World!
So I might have
print;05Helloprint;06World!
Now, this isn't the actual language, but the principal is the same, I
can't capture the string with the lexer, and I know I have to do it with
the parser, but I'm not sure how...
Douglas Mayle
More information about the antlr-interest
mailing list