Related articles |
---|
Partial grammars ? sriram@tcs.com (1994-06-05) |
Re: Partial grammars sperber@provence.informatik.uni-tuebingen.de (1994-06-13) |
Newsgroups: | comp.compilers |
From: | sperber@provence.informatik.uni-tuebingen.de (Michael Sperber) |
Keywords: | parse |
Organization: | Compilers Central |
References: | 94-06-056 |
Date: | Mon, 13 Jun 1994 09:14:13 GMT |
Sriram Srinivasan <sriram@tcs.com> writes:
> I wish to write a parser that needs to take an action only on some parts
> of an input file - say, only class declarations/definitions in C++ files.
I solved exactly that problem in my Master's Thesis. The program I wrote
for it (called Mørk) is a generator for partial parsers. It works
essentially like any other parser generator, but it allows leaving out
parts of a grammar. For example, to match expressions with properly
matched parentheses, Mørk essentially allows the following rule:
expression ::= @*
expression ::= openpar expression closedpar expression
In addition, it allows transformations of the input that are then fed back
into the parser. That makes it great for implementing macro
preprocessors, for example.
Mørk uses LALR(1), and implements LR-attributed grammars, thus allowing
most common uses of inherited attributes which are evaluated during
parsing. That also makes it a very powerful parser generator in general.
The program also includes a scanner generator. The whole thing is written
in Scheme. If enough people are interested in it, I might even make a
distribution version until the end of the year ... To anyone interested,
I'll gladly send a copy of my thesis.
Cheers =8-} Chipsy
--
Return to the
comp.compilers page.
Search the
comp.compilers archives again.