An ISO EBNF Compiler

David Starling <>
3 Apr 2004 09:07:28 -0500

          From comp.compilers

Related articles
An ISO EBNF Compiler (David Starling) (2004-04-03)
| List of all articles for this month |

From: David Starling <>
Newsgroups: comp.compilers
Date: 3 Apr 2004 09:07:28 -0500
Organization: EarthLink Inc. --
Keywords: parse
Posted-Date: 03 Apr 2004 09:07:28 EST

I have been working on a compiler for ISO EBNF. The goal is to allow
the user to define their grammar in EBNF and have the compiler figure
out what the tokens are, what belongs in the parser, and what belongs
in the scanner.

At this point, I believe the most challenging problems are behind me.
The compiler seems to work pretty well.

The reason behind this posting is that I believe this program might
actually be a little unique, but I don't really know. Any constructive
comments would be appreciated.

For those interested, more information, including example input and
output, is available at

The following is a brief description taken from the website:

Input to the compiler is an EBNF description as defined by ISO/IEC
14977:1996(E). The compiler performs a syntax check on the input script
then analyses the described grammar for ambiguities. Warning messages
are emitted by the compiler when ambiguities are encountered and
appropriate comments are inserted into the compiler output files.

The output of the compiler is a set of C++ source files for a scanner
and parser for the target grammar. The output scanner includes an
infinite look-ahead function. Optionally, the output files may include
syntactic error messages, error recovery, and user defined embedded
source code. Also, as an option, the scanner and parser will work with
strings instead of files. This is useful when implementing ASCII based
communications protocols.

Ideally no extension to the ISO standard would be required in the input.
    Technically, extensions are required to describe non-printable
characters and case-sensitivity of the target grammar. Practical
considerations demand extensions to identify comments and comment
nesting. Also, for improved readability, the compiler allows arbitrary
section headings in the input script.

Individual EBNF syntax rules are implemented as C++ functions. The
compiler provides a means to define formal and passed parameters, as
well as return type for these functions. In addition, there are
extensions to specify namespace, class and function names.

Options are available as command-line arguments and all options and
extensions may be embedded in the input script via the EBNF Special
Sequence mechanism.

Post a followup to this message

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