[antlr-interest] How to scan (or filter) with a CFG grammar?

Georgios Petasis petasisg at yahoo.gr
Mon Apr 4 01:25:01 PDT 2005


Dear list members,

I want to build a "filter" (like unix sed) but by using a grammar.
I have seen in the examples of the distribution, that there
are some "filter" examples, but they seem to only use
the lexer. (I have understood that the lexer is also
an LL(k) parser, but I don't know how to use it :-))

I have tried also to read the documentation, but I am still
confused. What I want to do is convert a parser into a
matcher. For example, if I take the grammar for
the "calc" example, how can I modify it to locate
expressions in free text, instead of giving expressions
to get whether they are grammatical or not?
Can this be done? Are only grammar changes needed,
or do I have to modify the code that calls the parser
accordingly? (I am using C++ as the target language).

Are there any examples of such a use I can see?

Kind regards,

George Petasis



More information about the antlr-interest mailing list