[antlr-interest] Parsing length-prefixed strings...

Terence Parr parrt at cs.usfca.edu
Wed Sep 27 09:46:05 PDT 2006


Hi, PADS by Kathleen Fisher is better suited to parsing this kind of  
data:

http://portal.acm.org/citation.cfm? 
id=1065046&dl=ACM&coll=&CFID=15151515&CFTOKEN=6184618

Terence
On Sep 27, 2006, at 9:14 AM, Douglas Mayle wrote:

> 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