On 04/27/2011 09:08 AM, Courtney Falk wrote:
>    All:
> 
> I've been banging my head against a design problem for over a week now, 
> and I thought I'd finally ask for help.
> 
> I have a fuzzy parser in place that breaks a stream up into tokens based 
> on whitespace and punctuation, preserving both.  All other characters 
> are grouped together into tokens.  So: "Gratuitous reply?" might yield 
> something like: "Gratuitous" WS "reply" QUESTION_MARK.
> 
> Here's my problem!  I want to then take all the secondary tokens (i.e. 
> "Gratuitous" and "reply") and perform a second pass to see if these 
> tokens match a second set of patterns.  I'm building additional parsing 
> into these secondary rules.  They could look like:
> 
> secondary_pattern : numeral | ordinal;
> numeral returns [int i] : 'two' { $i = 2; }
> ordinal returns [int o] : 'second' { $i = 2; }
> 
> So the final result of "Second gratuitous reply?" could look like: 
> NUMERAL WS "gratuitous" WS "reply" QUESTION_MARK.
> 
> Thoughts?  Suggestions?

Are you doing a second pass over the original input text?  Or are you
writing a tree grammar to walk your already parsed AST that you
generated from your first pass?  In which case your secondary stuff
should be matching trees, and not text.

> Courtney Falk
> [email protected]
> 
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: 
> http://www.antlr.org/mailman/options/antlr-interest/your-email-address


-- 
Kevin J. Cummings
[email protected]
[email protected]
[email protected]
Registered Linux User #1232 (http://counter.li.org)

List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

-- 
You received this message because you are subscribed to the Google Groups 
"il-antlr-interest" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en.

Reply via email to