[antlr-interest] Common prefixes

Arnar Birgisson arnarb at oddi.is
Tue Sep 7 09:13:44 PDT 2004

Hi there..

I would do this by multiplexing several lexers. One main lexer that
reads in the first char and then switches to the appropriate sub-lexer
(on for each line format) who spits out tokens for that line and pops
itself of the stack when it sees end-of-line, so that the main lexer
picks up from there.


>>> jes_quintana at yahoo.com 7.9.2004 15:43:32 >>>
I spent some time looking for a way to solve this but I failed. I'll 
appreciate some advice.

I want to parse lines of text. The lines include all kinds of words, 
numbers, expressions etc.

I need to distinguish the lines according the first letter of the 
first word. This letter determines the format of the rest of the 
line. Identifying the first character will allow to use the correct 
set of tokens.

The problem is that these first letters that identify the line 
format, can appear any place else in the lines. My standard word 
token includes these characters as well. This causes ambiguities and 
parsing errors.

Mline p1 p2 p3 p4 a=12 g=34 sdf sdf
Rline p1 p2 asd=23 sdf 
Yline p1 p2 

How do you suggest I approach this problem?

Yahoo! Groups Links


Yahoo! Groups Links

<*> To visit your group on the web, go to:

<*> To unsubscribe from this group, send an email to:
    antlr-interest-unsubscribe at yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:

More information about the antlr-interest mailing list