RE: Generalized parser without generation

Quinn Tyler Jackson <>
4 Feb 2004 21:25:26 -0500

          From comp.compilers

Related articles
Generalized parser without generation (2004-02-01)
RE: Generalized parser without generation (Quinn Tyler Jackson) (2004-02-04)
RE: Generalized parser without generation (Quinn Tyler Jackson) (2004-02-04)
RE: Generalized parser without generation (Quinn Tyler Jackson) (2004-02-08)
RE: Generalized parser without generation (Quinn Tyler Jackson) (2004-02-08)
| List of all articles for this month |

From: Quinn Tyler Jackson <>
Newsgroups: comp.compilers
Date: 4 Feb 2004 21:25:26 -0500
Organization: Compilers Central
References: 04-02-031
Keywords: parse
Posted-Date: 04 Feb 2004 21:25:25 EST

> James Moughan asked:
> > 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. 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. Does
> > anyone know if such a tool exists, and if so, can they point me in the
> > right direction?
> Meta-S grammars can be loaded at run-time, and even their
> reduction event code can be interpreted, rather than fired in
> compiled code.

I'll add that the ABN2CPP.EXE utility in the Meta-S distribution comes with
source code, and basically does what you describe as being your friend's
project's goal. From the documentation of ABN2CPP.EXE:

Syntax 3

ABN2CPP grammarfile.abn /i inputfile [/ms | /ma]

This version of the command line syntax does the following:

    * loads the .ABN format file grammarfile.abn

    * parses grammarfile.abn with the A-BNF parser

    * if sucessful, loads the file inputfile

    * if the option /ms is specified, scans inputfile for the first substring
that satisfies the grammar specified by grammarfile.abn

* if the option /ma is specified (which it is by default if neither /ms or
/ma are supplied), attempts to accept the entirety of inputfile

This version of the syntax can be used as a kind of very powerful grep
utility, or as a means of testing a grammar against a number of test input
files from the command line, which may be useful in automated regression
testing of a grammar in a build script. (If the .ABN file contains Lua code,
this version of the syntax also interprets the Lua events during the parse.)

Quinn Tyler Jackson

Post a followup to this message

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