[antlr-interest] [comp.compilers.tools.pccts] Re: Is there a run-time parsing facility
sarkar_soumen
sarkar_soumen at yahoo.com
Wed May 7 11:44:37 PDT 2003
>>From a dynamic grammar/automation end-user point of view I
have the following "use cases":
1. I am receiving a text string. I just supply a correct
grammar file. The text string passes or fails. If the
text string fails, I get pointer to text string which
fails showing corresponding parser/lexer rule.
2. If I supply a wrong grammar file, I get an exception
showing where in grammar file the error occurs.
3. Validation of text string does not cause unbound loop.
Probably max-loop is configurable.
4. If I provide grammar rule, I get text fragment for a valid
text string. In other words I retrive text fragments by
parser/lexer rules. For example I say give me the substrings
corresponding to SQL DELETE statements.
Implementation details should be hidden. As I understand a parser
generator provides computational service by which a program
understands text by systematically breaking it by parser/lexer
rules. I just would like to avail this service without any
compile time/typing commitment. If I require I am willing to
do type commitment in the sense of dynamically using ANTLR types
but NO compile time commitment. I do not wish to use any generated
types (only type commitment is in terms of predefined ANTLR
types).
This may be difficult to do. I just wanted to clarify end user
requirements on dynamic grammar/automation computational service.
Regarding performance, this kind implementation may be horribly slow
today but may not be in future.
Thanks,
Soumen Sarkar.
--- In antlr-interest at yahoogroups.com, Ric Klaren <klaren at c...>
wrote:
> Hi,
>
> On Wed, May 07, 2003 at 09:44:45AM -0000, micheal_jor wrote:
> > The exchange below from the pccts newsgroup properly belongs
here...
> >
> > I'd just like to add that the technique Kunle describes applies
to
> > Java as well.
> >
> > Not sure about how it can be done with C++ in the general case,
Ric?.
> > Monty?
>
> You could hack something together that does this I guess. Dynamic
loading
> works pretty ok on unix, yet you need a working compiler set, some
way to
> specify the right libraries and stuff for the loaded parts.
>
> Best would probably be to rewrite a bit and convert the switch
statements
> and contents to tables with char ranges and function pointers to
the
> actions (bit of a simplified description this). These then could
be loaded
> on runtime. Parser would then degenerate to a driver for these
tables.
>
> I guess it's doable but not with the time I have to spent on antlr
atm (and
> then I'm not even mentioning d*mn MSVC)
>
> Cheers,
>
> Ric
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
More information about the antlr-interest
mailing list