Here's the output of yacc2html invoked on its own grammar. If you want to test it yourself, you're welcome to a gzipped tarfile of the betarelease.
The version was updated Jan 5th, 1999. Thanks to everybody who reported bugs with the source and the site.
<pre>
</pre> preformatted
quoting, but references to nonterminals are linked to their
definition, references to tokens are linked (by default) to
an outside lex file, references to token types (usually
enclosed in angle brackets) can be linked to their %union
definition, and the whole grammar acquires a HTML header and
footer.
Further commandline options allow to strip all C code from the output, to link arbitrary tokens and types to arbitrary URLs (uniform resource locators), and to write two input files suitable for processing with sed(1) which can be used to turn a lex specification into a HTML file and to add links to the yacc hypertext to arbitrary other HTML documents.
The yacc specification is read from standard input, or from a file given as a command line argument; the HTML result is written to standard output.
list: foo? bar+ (baz|quux) ';'even though yacc itself would not understand, or misinterpret, them.
<a name="nonterminal"> anchor.
The generated nonterminal names
are affected by the N option; see below. There can be multiple defining rules for a nonterminal; only the first is
anchored. If a nonterminal occurs outside of a rule that
defines it, it is tagged with an <a href="#nonterminal">
reference to the first defining rule. Nonterminals in rules
that define them are not tagged by default; this behavior is
toggled by the -r (recursivenonterminals) option.
Symbols that appear behind a yacc `%token'
declaration are
considered to be terminals. By default, terminals are
tagged with an reference
to their first defining rule in an external lexfile:
<a href="lexfile.html#terminal">.
The -t option makes yacc2html link terminals
to their %token
declaration rather than to an external file.
The -i option suppresses linking of terminals altogether.
-f filename option, can be written using the
-L output
and
Y output options.
The first of these turns an input file for lex into HTML
with anchors suitable for
referencing from the converted yacc input file. The second
turns occurances of nonterminals in arbitrary input text
into references to the corresponding anchor in the converted
yacc input file.
Thus, given lex and yacc input files grammar.l and
grammar.y, the two steps for turning them into HTML files
are
% yacc2html -L script.sed grammar.y > grammar-y.html % sed -f script.sed grammar.l > grammar-l.html
%{ ... %} sections, { ... }
action statements, and trailing code after the second
%% from the HTML file. (The Clike comments within the
yacc code are still written; I consider them part of
the specification, not of the the C implementation.)
<title>...</title> HTML element)
be title.
If this option is not present, html2yacc defaults to the input
file name, or *standard input* if input is read from
standard input.
&, <, >, and ",
and turns the first appearance of every word that
yacc2html recognized as a terminal into an anchor.
-b option
if specified, or the input file name without a suffix;
%b-l.html");
-Nyacc-%s.
%token
declaration, rather than to the lex file.
-b option
if specified, or
the input file name without a suffix;
-l option if specified, or
the defaulted HTML lex file name ("%b-
l.html");
-y option if specified, or
the defaulted HTML yacc file name ("%b-
y.html").
-T%l#token-%s.
%union definition at the start of the grammar,
if such a definition exists. Normally, token type
references remain unlinked.
%b-y.html.