Related articles |
---|
Generalized parser without generation moughanj@tcd.ie (2004-02-01) |
Re: Generalized parser without generation joachim.durchholz@web.de (Joachim Durchholz) (2004-02-04) |
Re: Generalized parser without generation derkgwen@HotPOP.com (Derk Gwen) (2004-02-04) |
Re: Generalized parser without generation jesjones@mindspring.com (Jesse Jones) (2004-02-04) |
Re: Generalized parser without generation pete@restall.net (Peter Restall) (2004-02-04) |
Re: Generalized parser without generation cfc@shell01.TheWorld.com (Chris F Clark) (2004-02-04) |
Re: Generalized parser without generation vidar@hokstad.name (2004-02-04) |
Re: Generalized parser without generation bear@sonic.net (Ray Dillinger) (2004-02-08) |
From: | vidar@hokstad.name (Vidar Hokstad) |
Newsgroups: | comp.compilers |
Date: | 4 Feb 2004 21:56:48 -0500 |
Organization: | http://groups.google.com |
References: | 04-02-031 |
Keywords: | parse |
Posted-Date: | 04 Feb 2004 21:56:48 EST |
moughanj@tcd.ie (James Moughan) wrote
> A friend of mine has been given a final year project for which his
> supervisor wants the above; that is, a program which can read in a
> description of a grammar then parse a file using it directly. Users
> must be able to add new grammars at any time without compiling. ...
I can't point you to a specific publicly available tool, but having
written tools like this myself. It's a fairly straightforward thing to
do, as you are basically creating an interpreter that is specialized
for a very small set of operations.
Personally I've built configurable parsers that used an EBNF variation
to specify the parser. Instead of generating a parser all you have to
do is execute the corresponding actions on an input stream instead.
Recursive descent for instance is trivial to do this way, as you only
build a dictionary of productions, and build parse trees for each of
the productions, and then the recursive descent is basically a matter
of descending the parse tree for the grammar until you come across
terminals and match them against the input stream.
I used it for a tool that would take an arbitrary grammar and output
an XML document representing the parse tree for further
transformation. It was quite useful as a way of quickly prototyping
source code transformation tools.
Vidar
Return to the
comp.compilers page.
Search the
comp.compilers archives again.