Re: Generalized parser without generation

Joachim Durchholz <joachim.durchholz@web.de>
4 Feb 2004 21:42:36 -0500

          From comp.compilers

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)
| List of all articles for this month |

From: Joachim Durchholz <joachim.durchholz@web.de>
Newsgroups: comp.compilers
Date: 4 Feb 2004 21:42:36 -0500
Organization: Oberberg Online Infosysteme
References: 04-02-031
Keywords: parse
Posted-Date: 04 Feb 2004 21:42:36 EST

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.


If "at any time" means "between parser runs", your friend should take
a look into GLR parsing.


> He has been told that this should be easy to find on the net, but
> this doesn't seem to be the case, and I certainly don't believe it.


Well, things are easy to find if you already know the right questions
- the tutor obviously knows the right questions :-)


> Does anyone know if such a tool exists, and if so, can they point me
> in the right direction?


Your friend could use bison, or Accent. bison has a GLR mode (by
default, it's just LALR). Accent is a GLR parser. These parsers do
have a "compile" step, i.e. they convert the textual grammar into some
data structure and write that out to disk. If the tutor considers that
"compilation", then wrap or modify the tool so that the output goes to
a memory area, and wrap/modify the parsing engine so that it takes
that memory area as its input. Hmm... bison generates C code... which
definitely qualifies as "needs compilation". I'm not sure what would
need to be done to modify bison in the above manner... might be very
simple or very complicated.


I'm not sure whether using one of these tools would be considered
cheating; maybe the tutor wants your friend to write another GLR
parser. Several papers on the subject have been recommended in recent
threads; search the newsgroup archives for keywords like "GLR",
"Tomita", "Earley", and "Generalized LR".


Regards,
Jo
--
Currently looking for a new job.


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.