ANTLR parsers normally work in a single direction - they get an input
document and return some information related to it (e.g. the parse tree). Is
it possible to create, using the same grammar, a generator that will work in
the opposite direction - get the information and return the original
document?

To illustrate what I mean, here is a simple grammar, with a single rule:

question returns [String issue]
    :   'What are your salary demands?' {$issue="Salary";}
    |   'What would you like as your job description?' {$issue="Job
Description";}
    |   'Do you demand a company car?' {$issue="Leased Car";}
    ;

If I create a parser from this grammar, run it on a stream that contains "What
are your salary demands?", and call its question() method, it will return
"Salary".

I would like to be able to do the opposite - send "Salary" as input, and get
"What are your salary demands?" as output, but use the same grammar for both
tasks.

Is this possible with ANTLR?

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 il-antlr-inter...@googlegroups.com.
To unsubscribe from this group, send email to 
il-antlr-interest+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en.

Reply via email to