GNU Info

Info Node: (bison.info)Rpcalc Gen

(bison.info)Rpcalc Gen


Next: Rpcalc Compile Prev: Rpcalc Error Up: RPN Calc
Enter node , (file) or (file)node

Running Bison to Make the Parser
--------------------------------

   Before running Bison to produce a parser, we need to decide how to
arrange all the source code in one or more source files.  For such a
simple example, the easiest thing is to put everything in one file.  The
definitions of `yylex', `yyerror' and `main' go at the end, in the
"additional C code" section of the file (Note: The Overall Layout of a
Bison Grammar.).

   For a large project, you would probably have several source files,
and use `make' to arrange to recompile them.

   With all the source in a single file, you use the following command
to convert it into a parser file:

     bison FILE_NAME.y

In this example the file was called `rpcalc.y' (for "Reverse Polish
CALCulator").  Bison produces a file named `FILE_NAME.tab.c', removing
the `.y' from the original file name. The file output by Bison contains
the source code for `yyparse'.  The additional functions in the input
file (`yylex', `yyerror' and `main') are copied verbatim to the output.


automatically generated by info2www version 1.2.2.9