Grace - Parser Generator (Daughter of Gray)

Grace provides two extensions to the Gray parser generator that was written by Anton Ertl and is distributed with GForth. These extensions are a BNF front end and the ability to generate a standalone parser for the target language. Grace can be used in any of four modes, with or without either extension.

BNF front end

Gray requires a grammar with productions specified in a format specific to Gray, this format is similar to an extended BNF with special notation. Disadvantages of this are that a user has to learn the Gray format and that any grammars already written in BNF have to be manually converted into Gray format. The first extension is to the front end to Gray so that it will recognise a conventional extended BNF source file. Why do this? There are basically two reasons, firstly more people are familiar with standard BNF, secondly when developing a parser for a language with a published grammar, use of Grace avoids the need for manual translation of the grammar, which is, admittedly, not difficult but tedious and therefore error prone.

Standalone parser generation

Gray compiles a parser into memory and is, therefore, an on-line tool. Using the compiled parser requires the user to compile Gray, then the parser prior to running the parser. The second extension to Gray is to generate the parser as Forth source code, thus making Grace an off-line tool - generate the parser once then use it without the overheads of Gray. While these overheads are not large, particularly in the context of today’s desktop computers, this gives the user the choice of an off-line or on-line parser.

Grace version 1.0 released 22 October 2008

Download Grace

Any comments, error reports etc will be gratefully received, email Gerry Jackson.

Home