[antlr-interest] Multipass parsing

FranklinChen at cmu.edu FranklinChen at cmu.edu
Sun Mar 28 09:02:22 PST 2004


What's currently the best way to do multipass parsing (while retaining
all location information so that error messages are informative)?

Basically, I would like to be able to evolve a parser by starting from
recognizing and processing a coarse-grained structure and then
refining it, e.g., suppose I have a language that can be thought of at
a first cut as consisting of space-delimited tokens, and then I wish
also to parse within those tokens eventually.

Say I have a stream of text
    It was long-lived - 1810-1910 had 3+4-1.
and I wish to parse this by first splitting into 
    It
    was
    long-lived
    -
    1810-1910
    had
    3+4-1.
and refining eventually to what one might expect: a parse tree
containing words, compound words, dashes (delimiters in sentences),
durations of dates, arithmetic expressions, sentence terminator.

It seems difficult or monolithic to attempt to do this by creating
tokens in one pass and then parsing that stream of tokens.  Rather, it
seems it would be best to create token streams, which are then
manipulated to create refined token streams, etc.

Any ideas on how I should proceed?

-- 
Franklin


 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
     http://groups.yahoo.com/group/antlr-interest/

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

<*> Your use of Yahoo! Groups is subject to:
     http://docs.yahoo.com/info/terms/
 



More information about the antlr-interest mailing list