home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Interactive Guide
/
c-cplusplus-interactive-guide.iso
/
c_ref
/
csource4
/
285_01
/
bisoninf.1
< prev
next >
Wrap
Text File
|
1990-07-10
|
51KB
|
1,228 lines
Info file bison.info, produced by Makeinfo, -*- Text -*- from input
file bison.texinfo.
This file documents the Bison parser generator.
Copyright (C) 1988 Free Software Foundation, Inc.
Permission is granted to make and distribute verbatim copies of this
manual provided the copyright notice and this permission notice are
preserved on all copies.
Permission is granted to copy and distribute modified versions of
this manual under the conditions for verbatim copying, provided also
that the sections entitled ``Bison General Public License'' and
``Conditions for Using Bison'' are included exactly as in the
original, and provided that the entire resulting derived work is
distributed under the terms of a permission notice identical to this
one.
Permission is granted to copy and distribute translations of this
manual into another language, under the above conditions for modified
versions, except that the text of the translations of the sections
entitled ``Bison General Public License'' and ``Conditions for Using
Bison'' must be approved for accuracy by the Foundation.
File: bison.info, Node: Top, Next: Introduction, Prev: (DIR), Up: (DIR)
* Menu:
* Introduction::
* Conditions::
* Copying:: The Bison General Public License says
how you can copy and share Bison
Tutorial sections:
* Concepts:: Basic concepts for understanding Bison.
* Examples:: Three simple explained examples of using Bison.
Reference sections:
* Grammar File:: Writing Bison declarations and rules.
* Interface:: C-language interface to the parser function `yyparse'.
* Algorithm:: How the Bison parser works at run-time.
* Error Recovery:: Writing rules for error recovery.
* Debugging:: Debugging Bison parsers that parse wrong.
* Invocation:: How to run Bison (to produce the parser source file).
* Table of Symbols:: All the keywords of the Bison language are explained.
* Glossary:: Basic concepts are explained.
* Index:: Cross-references to the text.
File: bison.info, Node: Introduction, Next: Conditions, Prev: Top, Up: Top
Introduction
************
"Bison" is a general-purpose parser generator which converts a
grammar description into a C program to parse that grammar. Once you
are proficient with Bison, you may use it to develop a wide range of
language parsers, from those used in simple desk calculators to
complex programming languages.
Bison is upward compatible with Yacc: all properly-written Yacc
grammars ought to work with Bison with no change. Anyone familiar
with Yacc should be able to use Bison with little trouble. You need
to be fluent in C programming in order to use Bison or to understand
this manual.
We begin with tutorial chapters that explain the basic concepts of
using Bison and show three explained examples, each building on the
last. If you don't know Bison or Yacc, start by reading these
chapters. Reference chapters follow which describe specific aspects
of Bison in detail.
Bison was basically written by Robert Corbett, and made
Yacc-compatible by Richard Stallman.
File: bison.info, Node: Conditions, Next: Copying, Prev: Introduction, Up: Top
Conditions for Using Bison
**************************
Bison grammars can be used only in programs that are free software.
This is in contrast to what happens with the GNU C compiler and the
other GNU programming tools.
The reason Bison is special is that the output of the Bison
utility--the Bison parser file--contains a verbatim copy of a sizable
piece of Bison, which is the code for the `yyparse' function. (The
actions from your grammar are inserted into this function at one
point, but the rest of the function is not changed.)
As a result, the Bison parser file is covered by the same copying
conditions that cover Bison itself and the rest of the GNU system:
any program containing it has to be distributed under the standard
GNU copying conditions.
Occasionally people who would like to use Bison to develop
proprietary programs complain about this.
We don't particularly sympathize with their complaints. The purpose
of the GNU project is to promote the right to share software and the
practice of sharing software; it is a means of changing society. The
people who complain are planning to be uncooperative toward the rest
of the world; why should they deserve our help in doing so?
However, it's possible that a change in these conditions might
encourage computer companies to use and distribute the GNU system.
If so, then we might decide to change the terms on `yyparse' as a
matter of the strategy of promoting the right to share. Such a
change would be irrevocable. Since we stand by the copying
permissions we have announced, we cannot withdraw them once given.
We mustn't make an irrevocable change hastily. We have to wait until
there is a complete GNU system and there has been time to learn how
this issue affects its reception.
File: bison.info, Node: Copying, Next: Concepts, Prev: Conditions, Up: Top
Bison General Public License
****************************
(Clarified 11 Feb 1988)
The license agreements of most software companies keep you at the
mercy of those companies. By contrast, our general public license is
intended to give everyone the right to share Bison. To make sure
that you get the rights we want you to have, we need to make
restrictions that forbid anyone to deny you these rights or to ask
you to surrender the rights. Hence this license agreement.
Specifically, we want to make sure that you have the right to give
away copies of Bison, that you receive source code or else can get it
if you want it, that you can change Bison or use pieces of it in new
free programs, and that you know you can do these things.
To make sure that everyone has such rights, we have to forbid you to
deprive anyone else of these rights. For example, if you distribute
copies of Bison, you must give the recipients all the rights that you
have. You must make sure that they, too, receive or can get the
source code. And you must tell them their rights.
Also, for our own protection, we must make certain that everyone
finds out that there is no warranty for Bison. If Bison is modified
by someone else and passed on, we want its recipients to know that
what they have is not what we distributed, so that any problems
introduced by others will not reflect on our reputation.
Therefore we (Richard Stallman and the Free Software Foundation,
Inc.) make the following terms which say what you must do to be
allowed to distribute or change Bison.
Copying Policies
================
1. You may copy and distribute verbatim copies of Bison source code
as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy a valid
copyright notice ``Copyright (C) 1988 Free Software Foundation,
Inc.'' (or with whatever year is appropriate); keep intact the
notices on all files that refer to this License Agreement and to
the absence of any warranty; and give any other recipients of
the Bison program a copy of this License Agreement along with
the program. You may charge a distribution fee for the physical
act of transferring a copy.
2. You may modify your copy or copies of Bison or any portion of
it, and copy and distribute such modifications under the terms
of Paragraph 1 above, provided that you also do the following:
* cause the modified files to carry prominent notices stating
that you changed the files and the date of any change; and
* cause the whole of any work that you distribute or publish,
that in whole or in part contains or is a derivative of
Bison or any part thereof, to be licensed at no charge to
all third parties on terms identical to those contained in
this License Agreement (except that you may choo