Gray is a parser generator that is distributed with GForth. It requires a grammar with productions specified in a format specific to Gray. 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. BNF2Gray is a tool that converts an extended BNF format file to a Gray format file, including any embedded actions and comments.
Why use this tool, why not write a grammar in Gray format directly? 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 BNF2Gray avoids the need for manual translation of the grammar, which is, admittedly, not difficult but tedious and therefore error prone.
As well as providing a translation tool BNF2Gray, together with a couple of examples taken from the Gray distribution, demonstrates how LexGen and Gray can work together.
BNF2Gray version 1.0 released 24 April 2008, includes a user guide
Download BNF2Gray
Any comments, error reports etc will be gratefully received, email Gerry Jackson.