help-bison
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Generating a friendly grammar document for users from the Bison i nput


From: Reinstein, Shlomo
Subject: Generating a friendly grammar document for users from the Bison i nput
Date: Mon, 5 Aug 2002 11:33:56 +0300

Hi,

I have a simple language which is parsed by flex & bison. I want to avoid
maintaining a document that describes the grammar of the language to the
users. Is there a tool that knows how to generate a friendly grammar
document from the input files to flex & bison?

Basically, this tool should find out what the grammar is from the bison
input file, replace "simple" tokens with the input that generates them, and
showing how "complex" tokens are derived, e.g., the output should be
something like:
        Grammar:
                DECLARATION:            ID = NUMBER
                                |       include FILENAME
                .... other grammar rules ...
        Tokens:
                ID:             [a-zA-Z][a-zA-Z0-9_]*
                NUMBER: [0-9]*
                FILENAME:       <how a filename is derived>
                .... other tokens ...
And, of course, the tool should be able to add comments to the grammar from
comments written inside the bison input, perhaps with a special mark for the
tool to recognize, like javadoc does for Java, etc.
Such a tool would be very helpful; when I change the grammar, I can run the
tool and get an up-to-date friendly document, rather than making changes to
both the bison input and the friendly document.

Thanks,
Shlomo




reply via email to

[Prev in Thread] Current Thread [Next in Thread]