Bisonc++ is highly comparable to the program bison++, written by Alain Coetmeur: all properly-written bison++ grammars ought to be convertible to bisonc++ grammars requiring very little or no modifications. Anyone familiar with bison++ or its precursor, bison, should quickly be able to use bisonc++ as well. Bisonc++ generates C++ code, rather than C code, and so a fair knowledge of the C++ programming language is required before bisonc++ can profitably be used.
This manual closely resembles bison(1)'s userguide. In fact, many sections
of that manual were copied straight into this manual. With bisonc++ distributions
(both the full source distribution and the binary .deb
distributions)
bison's orginal manual is included in both PostScript and (converted
from the texi
format) HTML
format. Where necessary sections of the
original manual were adapted to bisonc++'s characteristics. Some sections were
removed, and some new sections were added to the current manual. Expect
upgrades of the manual to appear without further notice. Upgrades will be
announced in the manual's title.
The current manual starts with tutorial chapters that explain the basic concepts of using bisonc++ and use three examples illustrating some of the core issues of LALR(1) grammars, each example building on the previous example (where available). If you don't know bisonc++, bison++ or bison, start by reading these chapters. Reference chapters follow describing specific aspects of bisonc++ in detail.
Bisonc++ was designed and built by Frank B. Brokken. The program's first version was constructed between November 2004 and May 2005.
Tokens__
into Tokens_
and changing Meta__
into Meta_
.
The complete list of affected names is:
DebugMode_, ErrorRecovery_, Return_, Tag_, Tokens_
PARSE_ABORT_, PARSE_ACCEPT_, UNEXPECTED_TOKEN_, sizeofTag_
Meta_, PI_, STYPE_
clearin_, errorRecovery_, errorVerbose_, executeAction_, lex_, lookup_, nextCycle_, nextToken_, popToken_, pop_, print_, pushToken_, push_, recovery_, redoToken_, reduce_, savedToken_, shift_, stackSize_, startRecovery_, state_, token_, top_, vs_,
d_acceptedTokens_, d_actionCases_, d_debug_, d_nErrors_, d_requiredTokens_, d_val_, idOfTag_, s_nErrors_
parse()
-related
members in the generated parser class were modified. The names of all
accessible members in parserbase.h
and parser.h
now end in a
trailing underscore character. Predefined members in parser.ih
no
longer have trailing underscores, and can be redefined (but must be
available). The traditional error(char const *)
member in fact never
uses its argument (and bisonc++ only passes the default "Syntax error"
argument). Its prototype now no longer defines a parameter. Here's an
overview of modified member names/signatures:
Before 6.00.00 Starting with 6.00.00 void error(char const *)
void error()
void exceptionHandler_(...)
void exceptionHandler(...)
void errorRecovery()
void errorRecovery_()
void executeAction(int)
void executeAction_(int)
void nextToken()
void nextToken_()
added: void nextCycle_()
remove: int lookup(bool)
When re-generating parsers generated by bisonc++ before version 6.00.00, the signatures of the above functions in the file parser.h must be hand-modified to reflect the above changes. In addition, the implementations of error and exceptionHandler (default implementations were provided in parser.ih) must be adapted to their new signatures.
skeletons/binsonc++.h
that until the #undef
instruction the parser class name will be read as the parser's base class
name.
Starting with version 6.03.00 assignment to polymorphic semantic values is not anymore implemented through templates. The main reason is that inferred types may not be defined as a polymorphic semantic value type. Refer to section 4.6.1 for details.
--prompt
(%prompt
): when debug-code
is active, the generated parser shows a ?-prompt at each cycle when
processing its input (which should not be provided on the standard input
stream).
--thread-safe
can now also be specified as a
directive (%thread-safe
).