Mail Archives: djgpp/1997/03/19/06:20:17
This is to announce that the DJGPP port of the latest GNU Bison
release 1.25 has been uploaded to SimTel mirrors:
Binaries + docs:
ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/bsn125b.zip
Sources:
ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/bsn125s.zip
Please read the file README.dos (it's included in both zip files)
before installing or building Bison on your machine.
What is Bison? Bison is a parser generator: it converts a grammar
description into a C program--the parser--to parse that grammar. A
parser uses the grammar rules to analyse its input, and breaks it down
into syntactic groupings (in the case of C language, these might be
expressions, declarations, function definitions, etc.). A grammar
rule can have an "action" made up of C statements; each time the
parser recognizes a match for that rule, the action is executed. For
example, when parsing a C program, the actions might be the machine
code emitted by the compiler; in a desk calculator, the action
computes the value of the algebraic expression typed as input, etc.
The generated parser is full of complex macros, tables, and code of a
state machine driven by those tables, and is barely readable by
humans; but the grammar description is in the form that is easily
readable and understandable, and should be used as the real source of
the parser.
An obvious example of Bison use would be a parser that is part of
every compiler for a programming language. However, you don't need to
be a compiler expert to use Bison; there are many smaller projects
where Bison can make your task easier. Some examples, to get you
hooked:
- A desk calculator. Bison documentation describes two such
calculators: a reverse polish notation (RPN) calculator and
and infix (algebraic) notation calculator; these can serve
as good starting points for using Bison.
- A small language, such as scripting language with a small
number of commands.
- Did you ever wonder how does `touch' compute the date from
descriptions such as "a fortnight from tomorrow" or "last
Friday of next May"? Well, it uses the GNU `getdate'
function which is written as a grammar and processed by
Bison.
Sure thing, all of those projects could be programmed using the more
routine procedural techniques, but using a parser-generator such as
Bison makes the resulting program more correct, bug-free, and easier
in maintenance.
- Raw text -