bisonc++-6.09.01/atdollar/ 0000775 0001750 0001750 00000000000 14771271012 014064 5 ustar frank frank bisonc++-6.09.01/atdollar/setrefpatterns.cc 0000664 0001750 0001750 00000000710 14700504612 017437 0 ustar frank frank #include "atdollar.ih"
// refDD, // _$$
// refDn, // _$nr
// refD_, // _$-nr
void AtDollar::setRefPatterns() // text[0] == '_'
{
switch (d_text[2])
{
case '$':
d_pattern = refDD;
return;
default:
d_pattern = refDn;
break;
case '-':
d_pattern = refD_;
break;
}
d_nr = stol(d_text.substr(2));
}
bisonc++-6.09.01/atdollar/atdollar.f 0000664 0001750 0001750 00000001123 14700504612 016027 0 ustar frank frank inline AtDollar::Pattern AtDollar::pattern() const
{
return d_pattern;
}
inline int AtDollar::nr() const
{
return d_nr;
}
inline bool AtDollar::refByScanner() const
{
return d_refByScanner;
}
inline size_t AtDollar::pos() const
{
return d_pos;
}
inline size_t AtDollar::length() const
{
return d_length;
}
inline size_t AtDollar::lineNr() const
{
return d_lineNr;
}
inline std::string const &AtDollar::text() const
{
return d_text;
}
inline std::string const &AtDollar::tag() const
{
return d_tag;
}
bisonc++-6.09.01/atdollar/settagnr.cc 0000664 0001750 0001750 00000000326 14700504612 016220 0 ustar frank frank #include "atdollar.ih"
void AtDollar::setTagNr(size_t begin) // idx beyond <
{
size_t end = d_text.find('>');
d_tag = d_text.substr(begin, end - begin);
d_nr = stol(d_text.substr(end + 1));
}
bisonc++-6.09.01/atdollar/stackelement.cc 0000664 0001750 0001750 00000000427 14700504612 017052 0 ustar frank frank #include "atdollar.ih"
bool AtDollar::stackElement() const
{
switch (d_pattern)
{
case AA:
case DD:
case refDD:
case DDm:
case DDp:
case DDpar:
return false;
default:
return true;
}
}
bisonc++-6.09.01/atdollar/setdollarpatterns.cc 0000664 0001750 0001750 00000001474 14700504612 020150 0 ustar frank frank #include "atdollar.ih"
// DD, // $$
// DDm, // $$.
// DDp, // $$->
// DDpar, // $$(
//
// Dn, // $nr
// Dnm, // $nr.
// Dnp, // $nr->
//
// D_, // $-nr
// D_m, // $-nr.
// D_p, // $-nr->
//
// Dt_, // $-nr
// Dt_m, // $-nr.
// Dt_p, // $-nr->
void AtDollar::setDollarPatterns() // text[0] == '$'
{
switch (d_text[1])
{
case '$':
setDollarDollarPatterns();
return;
default:
setNumberPatterns();
return;
case '<':
setTagPatterns();
return;
}
}
bisonc++-6.09.01/atdollar/setdollardollarpatterns.cc 0000664 0001750 0001750 00000000771 14700504612 021345 0 ustar frank frank #include "atdollar.ih"
// DD, // $$
// DDm, // $$.
// DDp, // $$->
// DDpar, // $$(
void AtDollar::setDollarDollarPatterns()
{
switch (d_text.back())
{
case '$':
d_pattern = DD;
return;
case '.':
d_pattern = DDm;
return;
case '>':
d_pattern = DDp;
return;
case '(':
d_pattern = DDpar;
return;
}
}
bisonc++-6.09.01/atdollar/atdollar1.cc 0000664 0001750 0001750 00000001517 14700504612 016257 0 ustar frank frank #include "atdollar.ih"
AtDollar::AtDollar(size_t blockPos, size_t lineNr, std::string const &text,
bool refByScanner)
:
d_pos(blockPos),
d_lineNr(lineNr),
d_text(text),
d_length(text.length()),
d_refByScanner(refByScanner)
{
switch (text[0])
{
case '$':
setDollarPatterns();
return;
case '_':
setRefPatterns();
return;
case '@':
setAtPatterns();
return;
}
}
// // ${NR}, ${NR}. or @{NR}
//
//AtDollar::AtDollar(Type type,
// size_t blockPos, size_t lineNr, std::string const &text,
// int nr)
//:
// d_type(type),
// d_lineNr(lineNr),
// d_pos(blockPos),
// d_length(text.length()),
// d_text(text),
// d_nr(nr)
//{
// suffixAndMember();
//}
bisonc++-6.09.01/atdollar/setnumberpatterns.cc 0000664 0001750 0001750 00000001130 14700504612 020150 0 ustar frank frank #include "atdollar.ih"
// Dn, // $nr
// Dnm, // $nr.
// Dnp, // $nr->
//
// D_, // $-nr
// D_m, // $-nr.
// D_p, // $-nr->
void AtDollar::setNumberPatterns()
{
d_nr = stol(d_text.substr(1));
switch (d_text.back())
{
default:
d_pattern = d_nr > 0 ? Dn : D_;
return;
case '.':
d_pattern = d_nr > 0 ? Dnm : D_m;
return;
case '>':
d_pattern = d_nr > 0 ? Dnp : D_p;
return;
}
}
bisonc++-6.09.01/atdollar/setatpatterns.cc 0000664 0001750 0001750 00000000330 14700504612 017265 0 ustar frank frank #include "atdollar.ih"
void AtDollar::setAtPatterns() // text[0] == '@'
{
if (d_text[1] == '@')
d_pattern = AA;
else
{
d_pattern = An;
d_nr = stol(d_text.substr(1));
}
}
bisonc++-6.09.01/atdollar/atdollar.ih 0000664 0001750 0001750 00000000126 14700504612 016204 0 ustar frank frank #include "atdollar.h"
#include
#ifndef SPCH_
using namespace std;
#endif
bisonc++-6.09.01/atdollar/operatorinsert.cc 0000664 0001750 0001750 00000001050 14700504612 017444 0 ustar frank frank #include "atdollar.ih"
std::ostream &operator<<(std::ostream &out, AtDollar const &atd)
{
out << "At line " << atd.d_lineNr << ", block pos. " << atd.d_pos <<
", length: " << atd.d_length << ": `" <<
atd.text() << "' (Pattern = " << atd.d_pattern << ')';
if (atd.d_tag.length())
out << "; <" << atd.d_tag << '>';
if (atd.d_nr == numeric_limits::max())
out << " $";
else
out << ' ' << atd.d_nr;
if (atd.d_refByScanner)
out << " (ref. by scanner)";
return out;
}
bisonc++-6.09.01/atdollar/settagpatterns.cc 0000664 0001750 0001750 00000000664 14700504612 017446 0 ustar frank frank #include "atdollar.ih"
// Dt_, // $-nr
// Dt_m, // $-nr.
// Dt_p, // $-nr->
void AtDollar::setTagPatterns()
{
setTagNr(2);
switch (d_text.back())
{
default:
d_pattern = Dt_;
return;
case '.':
d_pattern = Dt_m;
return;
case '>':
d_pattern = Dt_p;
return;
}
}
bisonc++-6.09.01/atdollar/frame 0000664 0001750 0001750 00000000047 14700504612 015077 0 ustar frank frank #include "atdollar.ih"
AtDollar::
{
}
bisonc++-6.09.01/atdollar/atdollar.h 0000664 0001750 0001750 00000005563 14700504612 016045 0 ustar frank frank #ifndef INCLUDED_ATDOLLAR_
#define INCLUDED_ATDOLLAR_
#include
#include
#include
class AtDollar
{
friend std::ostream &operator<<(std::ostream &out, AtDollar const &atd);
public:
// Pattern is determined by the constructor
// Update stackElement if another $$ or @@ element is added
enum Pattern // A: at, D represents $, ref: (), _: -nr, n: nr
{ // m (= member): . p (= pointer) -> t:
// par (open parenthesis)
AA, // @@
An, // @nr
DD, // $$
refDD, // _$$
DDm, // $$.
DDp, // $$->
Dn, // $nr
refDn, // _$nr
Dnm, // $nr.
Dnp, // $nr->
D_, // $-nr
refD_, // _$-nr
D_m, // $-nr.
D_p, // $-nr->
Dt_, // $-nr
Dt_m, // $-nr.
Dt_p, // $-nr->
DDpar, // $$(
};
private:
size_t d_pos;
size_t d_lineNr;
std::string d_text;
size_t d_length;
Pattern d_pattern;
std::string d_tag;
bool d_refByScanner; // scanner.assignment substututed
// $$ ($nr) by _$$ (_$nr)
// $$ or @@ if numeric_limits::max()
int d_nr = std::numeric_limits::max();
public:
AtDollar() = default; // only used by std::vector in Block
AtDollar(size_t blockPos, size_t lineNr, std::string const &text,
bool refByScanner);
Pattern pattern() const;
int nr() const; // nr used in $nr constructions
std::string const &text() const;// the matched text
std::string const &tag() const; // ID in $.. constructions
size_t pos() const; // offset inside the block
size_t length() const; // matched text length
size_t lineNr() const; // line nr in the grammar file
bool refByScanner() const; // ref. inserted scanner.assignment()
bool stackElement() const; // referring to an element in the
// stack, so not $$ or @@
private:
void setTagNr(size_t idx); // idx beyond <
void setAtPatterns(); // text[0] == '@'
void setRefPatterns(); // text[0] == '_'
void setDollarPatterns(); // text[0] == '$'
void setDollarDollarPatterns();
void setTagPatterns();
void setNumberPatterns();
};
#include "atdollar.f"
#endif
bisonc++-6.09.01/bisonc++.xref 0000664 0001750 0001750 00000343161 14700504612 014560 0 ustar frank frank oxref by Frank B. Brokken (f.b.brokken@rug.nl)
oxref V 2.01.00 2012-2023
CREATED Sun, 07 Apr 2024 19:04:56 +0000
OXREF ARGUMENTS: -t main -r replace -fxs tmp/main.o tmp/libmodules.a
----------------------------------------------------------------------
CROSS REFERENCE LISTING:
accept(Options::PathType, char const*)
Full name: Options::accept(Options::PathType, char const*)
Source: accept.cc
Used By:
assign.cc: Options::assign(std::string*, Options::PathType, char const*)
actionCases(std::ostream&) const
Full name: Generator::actionCases(std::ostream&) const
Source: actioncases.cc
Used By:
data.cc: GLOBALS data.cc 28data.o
addElement(Symbol*)
Full name: Rules::addElement(Symbol*)
Source: addelement.cc
Used By:
augmentgrammar.cc: Rules::augmentGrammar(Symbol*)
handleproductionelement.cc: Parser::handleProductionElement(Meta_::SType&)
handleproductionelements.cc: Parser::handleProductionElements(Meta_::SType&, Meta_::SType const&)
nestedblock.cc: Parser::nestedBlock(Block&)
addIncludeQuotes(std::string&)
Full name: Options::addIncludeQuotes(std::string&)
Source: addincludequotes.cc
Used By:
setquotedstrings.cc: Options::setQuotedStrings()
addKernelItem(StateItem const&)
Full name: State::addKernelItem(StateItem const&)
Source: addkernelitem.cc
Used By:
addstate.cc: State::addState(std::vector const&)
initialstate.cc: State::initialState()
addNext(Symbol const*, unsigned long)
Full name: State::addNext(Symbol const*, unsigned long)
Source: addnext.cc
Used By:
notreducible.cc: State::notReducible(unsigned long)
addPolymorphic(std::string const&, std::string const&)
Full name: Parser::addPolymorphic(std::string const&, std::string const&)
Source: addpolymorphic.cc
Used By:
parse.cc: Parser::executeAction_(int)
addProduction(unsigned long)
Full name: Rules::addProduction(unsigned long)
Source: addproduction.cc
Used By:
augmentgrammar.cc: Rules::augmentGrammar(Symbol*)
openrule.cc: Parser::openRule(std::string const&)
parse.cc: Parser::executeAction_(int)
addProductions(Symbol const*)
Full name: State::addProductions(Symbol const*)
Source: addproductions.cc
Used By:
addnext.cc: State::addNext(Symbol const*, unsigned long)
addState(std::vector const&)
Full name: State::addState(std::vector const&)
Source: addstate.cc
Used By:
nextstate.cc: State::nextState(Next&)
addToKernel(std::vector&, Symbol const*, unsigned long)
Full name: Next::addToKernel(std::vector&, Symbol const*, unsigned long)
Source: addtokernel.cc
Used By:
notreducible.cc: State::notReducible(unsigned long)
allStates()
Full name: State::allStates()
Source: allstates.cc
Used By:
main.cc: main
assign(std::string*, Options::PathType, char const*)
Full name: Options::assign(std::string*, Options::PathType, char const*)
Source: assign.cc
Used By:
parse.cc: Parser::executeAction_(int)
assignment()
Full name: Scanner::assignment()
Source: assignment.cc
Used By:
lex.cc: Scanner::executeAction_(unsigned long)
assignNonTerminalNumbers()
Full name: Rules::assignNonTerminalNumbers()
Source: assignnonterminalnumbers.cc
Used By:
main.cc: main
atClassname() const
Full name: Generator::atClassname() const
Source: atclassname.cc
Used By:
data.cc: GLOBALS data.cc 28data.o
atDollar(unsigned long, std::string const&, bool, bool)
Full name: Block::atDollar(unsigned long, std::string const&, bool, bool)
Source: atdollar.cc
Used By:
assignment.cc: Scanner::assignment()
lex.cc: Scanner::executeAction_(unsigned long)
AtDollar(unsigned long, unsigned long, std::string const&, bool)
Full name: AtDollar::AtDollar(unsigned long, unsigned long, std::string const&, bool)
Source: atdollar1.cc
Used By:
atdollar.cc: Block::atDollar(unsigned long, std::string const&, bool, bool)
atElse(bool&) const
Full name: Generator::atElse(bool&) const
Source: atelse.cc
Used By:
data.cc: GLOBALS data.cc 28data.o
atEnd(bool&) const
Full name: Generator::atEnd(bool&) const
Source: atend.cc
Used By:
data.cc: GLOBALS data.cc 28data.o
atLtype() const
Full name: Generator::atLtype() const
Source: atltype.cc
Used By:
data.cc: GLOBALS data.cc 28data.o
atMatchedTextFunction() const
Full name: Generator::atMatchedTextFunction() const
Source: atmatchedtextfunction.cc
Used By:
data.cc: GLOBALS data.cc 28data.o
atNameSpacedClassname() const
Full name: Generator::atNameSpacedClassname() const
Source: atnamespacedclassname.cc
Used By:
data.cc: GLOBALS data.cc 28data.o
atTokenFunction() const
Full name: Generator::atTokenFunction() const
Source: attokenfunction.cc
Used By:
data.cc: GLOBALS data.cc 28data.o
augmentGrammar(Symbol*)
Full name: Rules::augmentGrammar(Symbol*)
Source: augmentgrammar.cc
Used By:
cleanup.cc: Parser::cleanup()
baseClass(std::ostream&) const
Full name: Generator::baseClass(std::ostream&) const
Source: baseclass.cc
Used By:
data.cc: GLOBALS data.cc 28data.o
baseClassCode(std::ostream&) const
Full name: Generator::baseClassCode(std::ostream&) const
Source: baseclasscode.cc
Used By:
data.cc: GLOBALS data.cc 28data.o
baseClassHeader() const
Full name: Generator::baseClassHeader() const
Source: baseclassheader.cc
Used By:
main.cc: main
baseclassHeaderName() const
Full name: Options::baseclassHeaderName() const
Source: baseclassheadername.cc
Used By:
conflicts.cc: Generator::conflicts() const
becomesDerivable(Production const*)
Full name: Grammar::becomesDerivable(Production const*)
Source: becomesderivable.cc
Used By:
derivable.cc: Grammar::derivable(Symbol const*)
beyondDotIsNonTerminal() const
Full name: Item::beyondDotIsNonTerminal() const
Source: beyonddotisnonterminal.cc
Used By:
distributelasetof.cc: State::distributeLAsetOf(StateItem&)
blkAssign(std::string const&, Production const&)
Full name: Parser::blkAssign(std::string const&, Production const&)
Source: blkassign.cc
Used By:
blkassignw.cc: Parser::blkAssignW(std::string const&, Production const&)
blkcheck.cc: Parser::blkCheck(std::string const&, Production const&)
data.cc: GLOBALS data.cc 2data.o
blkAssignW(std::string const&, Production const&)
Full name: Parser::blkAssignW(std::string const&, Production const&)
Source: blkassignw.cc
Used By:
blkcheckw.cc: Parser::blkCheckW(std::string const&, Production const&)
data.cc: GLOBALS data.cc 2data.o
blkCheck(std::string const&, Production const&)
Full name: Parser::blkCheck(std::string const&, Production const&)
Source: blkcheck.cc
Used By:
data.cc: GLOBALS data.cc 2data.o
blkCheckW(std::string const&, Production const&)
Full name: Parser::blkCheckW(std::string const&, Production const&)
Source: blkcheckw.cc
Used By:
data.cc: GLOBALS data.cc 2data.o
blkDirect(std::string const&, Production const&)
Full name: Parser::blkDirect(std::string const&, Production const&)
Source: blkdirect.cc
Used By:
blkdirectw.cc: Parser::blkDirectW(std::string const&, Production const&)
data.cc: GLOBALS data.cc 2data.o
blkDirectW(std::string const&, Production const&)
Full name: Parser::blkDirectW(std::string const&, Production const&)
Source: blkdirectw.cc
Used By:
data.cc: GLOBALS data.cc 2data.o
blkErr(std::string const&, Production const&)
Full name: Parser::blkErr(std::string const&, Production const&)
Source: blkerr.cc
Used By:
blkcheck.cc: Parser::blkCheck(std::string const&, Production const&)
blkcheckw.cc: Parser::blkCheckW(std::string const&, Production const&)
data.cc: GLOBALS data.cc 2data.o
blkNop(std::string const&, Production const&)
Full name: Parser::blkNop(std::string const&, Production const&)
Source: blknop.cc
Used By:
data.cc: GLOBALS data.cc 2data.o
blkNopW(std::string const&, Production const&)
Full name: Parser::blkNopW(std::string const&, Production const&)
Source: blknopw.cc
Used By:
data.cc: GLOBALS data.cc 2data.o
blkSTYPE(std::string const&, Production const&)
Full name: Parser::blkSTYPE(std::string const&, Production const&)
Source: blkstype.cc
Used By:
blkstypew.cc: Parser::blkSTYPEW(std::string const&, Production const&)
data.cc: GLOBALS data.cc 2data.o
blkSTYPEW(std::string const&, Production const&)
Full name: Parser::blkSTYPEW(std::string const&, Production const&)
Source: blkstypew.cc
Used By:
data.cc: GLOBALS data.cc 2data.o
bolAt(std::string&, bool&) const
Full name: Generator::bolAt(std::string&, bool&) const
Source: bolat.cc
Used By:
insert2.cc: Generator::insert(std::ostream&, unsigned long, char const*) const
buildKernel(std::vector*, std::vector const&)
Full name: Next::buildKernel(std::vector*, std::vector const&)
Source: buildkernel.cc
Used By:
nextstate.cc: State::nextState(Next&)
canonicalQuote()
Full name: Scanner::canonicalQuote()
Source: canonicalquote.cc
Used By:
parse.cc: Parser::executeAction_(int)
setprecedence.cc: Parser::setPrecedence(unsigned long)
useterminal.cc: Parser::useTerminal()
checkConflicts()
Full name: State::checkConflicts()
Source: checkconflicts.cc
Used By:
define.cc: State::define(Rules const&)
checkEndOfRawString()
Full name: Scanner::checkEndOfRawString()
Source: checkendofrawstring.cc
Used By:
lex.cc: Scanner::executeAction_(unsigned long)
checkField(std::string const&)
Full name: Parser::checkField(std::string const&)
Source: checkfield.cc
Used By:
parse.cc: Parser::executeAction_(int)
checkFirstType()
Full name: Parser::checkFirstType()
Source: checkfirsttype.cc
Used By:
handleproductionelement.cc: Parser::handleProductionElement(Meta_::SType&)
parse.cc: Parser::executeAction_(int)
checkRemoved(std::ostream&) const
Full name: Next::checkRemoved(std::ostream&) const
Source: checkremoved.cc
Used By:
transition.cc: Next::transition(std::ostream&) const
transitionkernel.cc: Next::transitionKernel(std::ostream&) const
checkZeroNumber()
Full name: Scanner::checkZeroNumber()
Source: checkzeronumber.cc
Used By:
hexadecimal.cc: Scanner::hexadecimal()
octal.cc: Scanner::octal()
classH(std::ostream&) const
Full name: Generator::classH(std::ostream&) const
Source: classh.cc
Used By:
data.cc: GLOBALS data.cc 28data.o
classHeader() const
Full name: Generator::classHeader() const
Source: classheader.cc
Used By:
main.cc: main
classIH(std::ostream&) const
Full name: Generator::classIH(std::ostream&) const
Source: classih.cc
Used By:
data.cc: GLOBALS data.cc 28data.o
cleanDir(std::string&, bool)
Full name: Options::cleanDir(std::string&, bool)
Source: cleandir.cc
Used By:
setbasicstrings.cc: Options::setBasicStrings()
cleanup()
Full name: Parser::cleanup()
Source: cleanup.cc
Used By:
main.cc: main
clear()
Full name: Block::clear()
Source: clear.cc
Used By:
expectrules.cc: Parser::expectRules()
open.cc: Block::open(unsigned long, std::string const&)
close()
Full name: Block::close()
Source: close.cc
Used By:
lex.cc: Scanner::executeAction_(unsigned long)
comparePrecedence(Symbol const*, Symbol const*)
Full name: Terminal::comparePrecedence(Symbol const*, Symbol const*)
Source: compareprecedence.cc
Used By:
comparereductions.cc: RRConflict::compareReductions(unsigned long*, unsigned long)
solvebyprecedence.cc: Next::solveByPrecedence(Symbol const*) const
compareReductions(unsigned long*, unsigned long)
Full name: RRConflict::compareReductions(unsigned long*, unsigned long)
Source: comparereductions.cc
Used By:
visitreduction.cc: RRConflict::visitReduction(unsigned long)
computeLAsets()
Full name: State::computeLAsets()
Source: computelasets.cc
Used By:
determinelasets.cc: State::determineLAsets()
conflicts() const
Full name: Generator::conflicts() const
Source: conflicts.cc
Used By:
main.cc: main
construct()
Full name: State::construct()
Source: construct.cc
Used By:
define.cc: State::define(Rules const&)
containsKernelItem(Item const&, unsigned long, std::vector const&)
Full name: StateItem::containsKernelItem(Item const&, unsigned long, std::vector const&)
Source: containskernelitem.cc
Used By:
haskernel.cc: State::hasKernel(std::vector const&) const
debug(std::ostream&) const
Full name: Generator::debug(std::ostream&) const
Source: debug.cc
Used By:
data.cc: GLOBALS data.cc 28data.o
debugDecl(std::ostream&) const
Full name: Generator::debugDecl(std::ostream&) const
Source: debugdecl.cc
Used By:
data.cc: GLOBALS data.cc 28data.o
debugFunctions(std::ostream&) const
Full name: Generator::debugFunctions(std::ostream&) const
Source: debugfunctions.cc
Used By:
data.cc: GLOBALS data.cc 28data.o
debugIncludes(std::ostream&) const
Full name: Generator::debugIncludes(std::ostream&) const
Source: debugincludes.cc
Used By:
data.cc: GLOBALS data.cc 28data.o
debugLookup(std::ostream&) const
Full name: Generator::debugLookup(std::ostream&) const
Source: debuglookup.cc
Used By:
data.cc: GLOBALS data.cc 28data.o
defaultPolymorphicAction(Production const&)
Full name: Parser::defaultPolymorphicAction(Production const&)
Source: defaultpolymorphicaction.cc
Used By:
checkfirsttype.cc: Parser::checkFirstType()
define(Rules const&)
Full name: State::define(Rules const&)
Source: define.cc
Used By:
main.cc: main
defineNonTerminal(std::string const&, std::string const&)
Full name: Parser::defineNonTerminal(std::string const&, std::string const&)
Source: definenonterminal.cc
Used By:
nestedblock.cc: Parser::nestedBlock(Block&)
defineTerminal(std::string const&, Symbol::Type)
Full name: Parser::defineTerminal(std::string const&, Symbol::Type)
Source: defineterminal.cc
Used By:
definetokenname.cc: Parser::defineTokenName(std::string const&, bool)
parse.cc: Parser::executeAction_(int)
defineTokenName(std::string const&, bool)
Full name: Parser::defineTokenName(std::string const&, bool)
Source: definetokenname.cc
Used By:
parse.cc: Parser::executeAction_(int)
derivable(Symbol const*)
Full name: Grammar::derivable(Symbol const*)
Source: derivable.cc
Used By:
becomesderivable.cc: Grammar::becomesDerivable(Production const*)
derivesentence.cc: Grammar::deriveSentence()
deriveSentence()
Full name: Grammar::deriveSentence()
Source: derivesentence.cc
Used By:
main.cc: main
determineFirst()
Full name: Rules::determineFirst()
Source: determinefirst.cc
Used By:
main.cc: main
determineLAsets()
Full name: State::determineLAsets()
Source: determinelasets.cc
Used By:
define.cc: State::define(Rules const&)
distributeLAsetOf(StateItem&)
Full name: State::distributeLAsetOf(StateItem&)
Source: distributelasetof.cc
Used By:
computelasets.cc: State::computeLAsets()
dval(int, Block&, AtDollar const&)
Full name: Parser::dval(int, Block&, AtDollar const&)
Source: dval.cc
Used By:
data.cc: GLOBALS data.cc 2data.o
dvalMem(int, Block&, AtDollar const&)
Full name: Parser::dvalMem(int, Block&, AtDollar const&)
Source: dvalmem.cc
Used By:
data.cc: GLOBALS data.cc 2data.o
dvalPar(int, Block&, AtDollar const&)
Full name: Parser::dvalPar(int, Block&, AtDollar const&)
Source: dvalpar.cc
Used By:
data.cc: GLOBALS data.cc 2data.o
dvalPoly(int, Block&, AtDollar const&)
Full name: Parser::dvalPoly(int, Block&, AtDollar const&)
Source: dvalpoly.cc
Used By:
data.cc: GLOBALS data.cc 2data.o
dvalPolyMem(int, Block&, AtDollar const&)
Full name: Parser::dvalPolyMem(int, Block&, AtDollar const&)
Source: dvalpolymem.cc
Used By:
data.cc: GLOBALS data.cc 2data.o
dvalPolyPar(int, Block&, AtDollar const&)
Full name: Parser::dvalPolyPar(int, Block&, AtDollar const&)
Source: dvalpolypar.cc
Used By:
data.cc: GLOBALS data.cc 2data.o
dvalPolyPtr(int, Block&, AtDollar const&)
Full name: Parser::dvalPolyPtr(int, Block&, AtDollar const&)
Source: dvalpolyptr.cc
Used By:
data.cc: GLOBALS data.cc 2data.o
dvalPolyReplace(bool, Block&, AtDollar const&, char const*)
Full name: Parser::dvalPolyReplace(bool, Block&, AtDollar const&, char const*)
Source: dvalpolyreplace.cc
Used By:
dvalpoly.cc: Parser::dvalPoly(int, Block&, AtDollar const&)
dvalpolymem.cc: Parser::dvalPolyMem(int, Block&, AtDollar const&)
dvalpolyptr.cc: Parser::dvalPolyPtr(int, Block&, AtDollar const&)
dvalPtr(int, Block&, AtDollar const&)
Full name: Parser::dvalPtr(int, Block&, AtDollar const&)
Source: dvalptr.cc
Used By:
data.cc: GLOBALS data.cc 2data.o
dvalRefUnion(int, Block&, AtDollar const&)
Full name: Parser::dvalRefUnion(int, Block&, AtDollar const&)
Source: dvalrefunion.cc
Used By:
data.cc: GLOBALS data.cc 2data.o
dvalReplace(bool, Block&, AtDollar const&, char const*)
Full name: Parser::dvalReplace(bool, Block&, AtDollar const&, char const*)
Source: dvalreplace.cc
Used By:
dval.cc: Parser::dval(int, Block&, AtDollar const&)
dvalmem.cc: Parser::dvalMem(int, Block&, AtDollar const&)
dvalpar.cc: Parser::dvalPar(int, Block&, AtDollar const&)
dvalptr.cc: Parser::dvalPtr(int, Block&, AtDollar const&)
dvalrefunion.cc: Parser::dvalRefUnion(int, Block&, AtDollar const&)
dvalunionpar.cc: Parser::dvalUnionPar(int, Block&, AtDollar const&)
dvalUnion(int, Block&, AtDollar const&)
Full name: Parser::dvalUnion(int, Block&, AtDollar const&)
Source: dvalunion.cc
Used By:
data.cc: GLOBALS data.cc 2data.o
dvalUnionMem(int, Block&, AtDollar const&)
Full name: Parser::dvalUnionMem(int, Block&, AtDollar const&)
Source: dvalunionmem.cc
Used By:
data.cc: GLOBALS data.cc 2data.o
dvalUnionPar(int, Block&, AtDollar const&)
Full name: Parser::dvalUnionPar(int, Block&, AtDollar const&)
Source: dvalunionpar.cc
Used By:
data.cc: GLOBALS data.cc 2data.o
dvalUnionPtr(int, Block&, AtDollar const&)
Full name: Parser::dvalUnionPtr(int, Block&, AtDollar const&)
Source: dvalunionptr.cc
Used By:
data.cc: GLOBALS data.cc 2data.o
dvalUnionReplace(bool, Block&, AtDollar const&, char const*)
Full name: Parser::dvalUnionReplace(bool, Block&, AtDollar const&, char const*)
Source: dvalunionreplace.cc
Used By:
dvalrefunion.cc: Parser::dvalRefUnion(int, Block&, AtDollar const&)
dvalunion.cc: Parser::dvalUnion(int, Block&, AtDollar const&)
dvalunionmem.cc: Parser::dvalUnionMem(int, Block&, AtDollar const&)
dvalunionptr.cc: Parser::dvalUnionPtr(int, Block&, AtDollar const&)
enlargeLA(LookaheadSet const&)
Full name: StateItem::enlargeLA(LookaheadSet const&)
Source: enlargela.cc
Used By:
distributelasetof.cc: State::distributeLAsetOf(StateItem&)
inspecttransitions.cc: State::inspectTransitions(std::set>&)
eoln()
Full name: Scanner::eoln()
Source: eoln.cc
Used By:
lex.cc: Scanner::executeAction_(unsigned long)
errExisting(std::string const&, std::string const&, std::string const&) const
Full name: Generator::errExisting(std::string const&, std::string const&, std::string const&) const
Source: errexisting.cc
Used By:
conflicts.cc: Generator::conflicts() const
errIndexTooLarge(AtDollar const&, int) const
Full name: Parser::errIndexTooLarge(AtDollar const&, int) const
Source: errindextoolarge.cc
Used By:
substituteblock.cc: Parser::substituteBlock(int, Block&)
errNoTag(int, Block&, AtDollar const&)
Full name: Parser::errNoTag(int, Block&, AtDollar const&)
Source: errnotag.cc
Used By:
data.cc: GLOBALS data.cc 2data.o
errNoUnionPtr(AtDollar const&)
Full name: Parser::errNoUnionPtr(AtDollar const&)
Source: errnounionptr.cc
Used By:
dvalunionreplace.cc: Parser::dvalUnionReplace(bool, Block&, AtDollar const&, char const*)
svsunionreplace.cc: Parser::svsUnionReplace(int, Block&, AtDollar const&, char const*)
error()
Full name: Parser::error()
Source: error.cc
Used By:
parse.cc: Parser::errorRecovery_()
errorVerbose(std::ostream&) const
Full name: Generator::errorVerbose(std::ostream&) const
Source: errorverbose.cc
Used By:
data.cc: GLOBALS data.cc 28data.o
escape()
Full name: Scanner::escape()
Source: escape.cc
Used By:
lex.cc: Scanner::executeAction_(unsigned long)
executeActionCases(std::ostream&) const
Full name: Generator::executeActionCases(std::ostream&) const
Source: executeactioncases.cc
Used By:
data.cc: GLOBALS data.cc 28data.o
existingTag(AtDollar const&) const
Full name: Parser::existingTag(AtDollar const&) const
Source: existingtag.cc
Used By:
svspolytagreplace.cc: Parser::svsPolyTagReplace(int, Block&, AtDollar const&, char const*)
expectRules()
Full name: Parser::expectRules()
Source: expectrules.cc
Used By:
parse.cc: Parser::executeAction_(int)
filename(std::string const&)
Full name: Generator::filename(std::string const&)
Source: filename.cc
Used By:
baseclass.cc: Generator::baseClass(std::ostream&) const
classh.cc: Generator::classH(std::ostream&) const
classih.cc: Generator::classIH(std::ostream&) const
filter(std::istream&, std::ostream&, bool) const
Full name: Generator::filter(std::istream&, std::ostream&, bool) const
Source: filter.cc
Used By:
baseclassheader.cc: Generator::baseClassHeader() const
classheader.cc: Generator::classHeader() const
implementationheader.cc: Generator::implementationHeader() const
parsefunction.cc: Generator::parseFunction() const
polymorphic.cc: Generator::polymorphic(std::ostream&) const
polymorphiccode.cc: Generator::polymorphicCode(std::ostream&) const
findKernel(std::vector const&) const
Full name: State::findKernel(std::vector const&) const
Source: findkernel.cc
Used By:
nextstate.cc: State::nextState(Next&)
firstBeyondDot(FirstSet*) const
Full name: Item::firstBeyondDot(FirstSet*) const
Source: firstbeyonddot.cc
Used By:
distributelasetof.cc: State::distributeLAsetOf(StateItem&)
FirstSet(Element const*)
Full name: FirstSet::FirstSet(Element const*)
Source: firstset1.cc
Used By:
terminal1.cc: Terminal::Terminal(std::string const&, Symbol::Type, unsigned long, Terminal::Association, std::string const&)
terminal2.cc: Terminal::Terminal(std::string const&, std::string const&, Symbol::Type)
g_typename
Full name: g_typename
Source: returntypespec.cc
Used By:
lex.cc: Scanner::executeAction_(unsigned long)
Generator(Rules const&, std::unordered_map&&)
Full name: Generator::Generator(Rules const&, std::unordered_map&&)
Source: generator1.cc
Used By:
main.cc: main
grep(std::string const&, std::string const&) const
Full name: Generator::grep(std::string const&, std::string const&) const
Source: grep.cc
Used By:
errexisting.cc: Generator::errExisting(std::string const&, std::string const&, std::string const&) const
handleProductionElement(Meta_::SType&)
Full name: Parser::handleProductionElement(Meta_::SType&)
Source: handleproductionelement.cc
Used By:
parse.cc: Parser::executeAction_(int)
handleProductionElements(Meta_::SType&, Meta_::SType const&)
Full name: Parser::handleProductionElements(Meta_::SType&, Meta_::SType const&)
Source: handleproductionelements.cc
Used By:
parse.cc: Parser::executeAction_(int)
handleSRconflict(Next::ConstIter const&, unsigned long)
Full name: SRConflict::handleSRconflict(Next::ConstIter const&, unsigned long)
Source: handlesrconflict.cc
Used By:
processshiftreduceconflict.cc: SRConflict::processShiftReduceConflict(Next::ConstIter const&, unsigned long)
handleXstring(unsigned long)
Full name: Scanner::handleXstring(unsigned long)
Source: handlexstring.cc
Used By:
lex.cc: Scanner::executeAction_(unsigned long)
hasKernel(std::vector const&) const
Full name: State::hasKernel(std::vector const&) const
Source: haskernel.cc
Used By:
findkernel.cc: State::findKernel(std::vector const&) const
hexadecimal()
Full name: Scanner::hexadecimal()
Source: hexadecimal.cc
Used By:
lex.cc: Scanner::executeAction_(unsigned long)
idOfTag(std::ostream&) const
Full name: Generator::idOfTag(std::ostream&) const
Source: idoftag.cc
Used By:
data.cc: GLOBALS data.cc 28data.o
idOfTag_
Full name: Meta_::idOfTag_
Source: parse.cc
Used By:
handleproductionelement.cc: GLOBALS handleproductionelement.cc 2handleproductionelement.o
handleproductionelements.cc: GLOBALS handleproductionelements.cc 2handleproductionelements.o
ifInsertStype(bool&) const
Full name: Generator::ifInsertStype(bool&) const
Source: ifinsertstype.cc
Used By:
data.cc: GLOBALS data.cc 28data.o
ifLtype(bool&) const
Full name: Generator::ifLtype(bool&) const
Source: ifltype.cc
Used By:
data.cc: GLOBALS data.cc 28data.o
ifPrintTokens(bool&) const
Full name: Generator::ifPrintTokens(bool&) const
Source: ifprinttokens.cc
Used By:
data.cc: GLOBALS data.cc 28data.o
implementationHeader() const
Full name: Generator::implementationHeader() const
Source: implementationheader.cc
Used By:
main.cc: main
indexToOffset(int, int) const
Full name: Parser::indexToOffset(int, int) const
Source: indextooffset.cc
Used By:
locel.cc: Parser::locEl(int, Block&, AtDollar const&)
svselement.cc: Parser::svsElement(int, int) const
initialState()
Full name: State::initialState()
Source: initialstate.cc
Used By:
define.cc: State::define(Rules const&)
insert(NonTerminal*)
Full name: Rules::insert(NonTerminal*)
Source: insert2.cc
Used By:
augmentgrammar.cc: Rules::augmentGrammar(Symbol*)
definenonterminal.cc: Parser::defineNonTerminal(std::string const&, std::string const&)
requirenonterminal.cc: Parser::requireNonTerminal(std::string const&)
usesymbol.cc: Parser::useSymbol()
insert(std::ostream&) const
Full name: Generator::insert(std::ostream&) const
Source: insert.cc
Used By:
filter.cc: Generator::filter(std::istream&, std::ostream&, bool) const
insert(std::ostream&) const
Full name: SRConflict::insert(std::ostream&) const
Source: insert.cc
Used By:
insertext.cc: State::insertExt(std::ostream&) const
insertstd.cc: State::insertStd(std::ostream&) const
insert(std::ostream&) const
Full name: LookaheadSet::insert(std::ostream&) const
Source: insert.cc
Used By:
operatorinsert.cc: operator<<(std::ostream&, LookaheadSet const&)
insert(std::ostream&) const
Full name: RRConflict::insert(std::ostream&) const
Source: insert.cc
Used By:
insertext.cc: State::insertExt(std::ostream&) const
insertstd.cc: State::insertStd(std::ostream&) const
insert(std::ostream&) const
Full name: FirstSet::insert(std::ostream&) const
Source: oinsert.cc
Used By:
showfirst.cc: GLOBALS showfirst.cc 12showfirst.o
insertext.cc: GLOBALS insertext.cc 25insertext.o
insert(std::ostream&) const
Full name: NonTerminal::insert(std::ostream&) const
Source: v.cc
Used By:
destructor.cc: NonTerminal::~NonTerminal()
insert(std::ostream&, Production const*) const
Full name: Item::insert(std::ostream&, Production const*) const
Source: insert.cc
Used By:
plainitem.cc: Item::plainItem(std::ostream&) const
pnrdotitem.cc: Item::pNrDotItem(std::ostream&) const
insert(std::ostream&, unsigned long, char const*) const
Full name: Generator::insert(std::ostream&, unsigned long, char const*) const
Source: insert2.cc
Used By:
debugdecl.cc: Generator::debugDecl(std::ostream&) const
debugfunctions.cc: Generator::debugFunctions(std::ostream&) const
debugincludes.cc: Generator::debugIncludes(std::ostream&) const
debuglookup.cc: Generator::debugLookup(std::ostream&) const
lex.cc: Generator::lex(std::ostream&) const
ltype.cc: Generator::ltype(std::ostream&) const
ltypedata.cc: Generator::ltypeData(std::ostream&) const
print.cc: Generator::print(std::ostream&) const
undefparser.cc: Generator::undefparser(std::ostream&) const
insert(std::vector const&) const
Full name: Writer::insert(std::vector const&) const
Source: insert.cc
Used By:
tokens.cc: Generator::tokens(std::ostream&) const
insert(Terminal*, std::string const&)
Full name: Rules::insert(Terminal*, std::string const&)
Source: insert1.cc
Used By:
defineterminal.cc: Parser::defineTerminal(std::string const&, Symbol::Type)
predefine.cc: Parser::predefine(Terminal const*)
useterminal.cc: Parser::useTerminal()
insertAction(Production const*, std::ostream&, bool, unsigned long)
Full name: Production::insertAction(Production const*, std::ostream&, bool, unsigned long)
Source: insertaction.cc
Used By:
actioncases.cc: Generator::actionCases(std::ostream&) const
insertExt(std::ostream&) const
Full name: State::insertExt(std::ostream&) const
Source: insertext.cc
Used By:
allstates.cc: State::allStates()
define.cc: State::define(Rules const&)
insertStd(std::ostream&) const
Full name: State::insertStd(std::ostream&) const
Source: insertstd.cc
Used By:
define.cc: State::define(Rules const&)
insertToken(Terminal const*, unsigned long&, std::ostream&)
Full name: Writer::insertToken(Terminal const*, unsigned long&, std::ostream&)
Source: inserttoken.cc
Used By:
insert.cc: Writer::insert(std::vector const&) const
insName(std::ostream&) const
Full name: NonTerminal::insName(std::ostream&) const
Source: insname.cc
Used By:
showfirst.cc: GLOBALS showfirst.cc 12showfirst.o
insertext.cc: GLOBALS insertext.cc 25insertext.o
inspect()
Full name: SRConflict::inspect()
Source: inspect.cc
Used By:
checkconflicts.cc: State::checkConflicts()
inspect()
Full name: RRConflict::inspect()
Source: inspect.cc
Used By:
checkconflicts.cc: State::checkConflicts()
inspectTransitions(std::set>&)
Full name: State::inspectTransitions(std::set>&)
Source: inspecttransitions.cc
Used By:
determinelasets.cc: State::determineLAsets()
installAction(Block&)
Full name: Parser::installAction(Block&)
Source: installaction.cc
Used By:
handleproductionelement.cc: Parser::handleProductionElement(Meta_::SType&)
installDefaultAction(Production const&, std::string const&)
Full name: Parser::installDefaultAction(Production const&, std::string const&)
Source: installdefaultaction.cc
Used By:
blkassign.cc: Parser::blkAssign(std::string const&, Production const&)
blkdirect.cc: Parser::blkDirect(std::string const&, Production const&)
blkstype.cc: Parser::blkSTYPE(std::string const&, Production const&)
checkfirsttype.cc: Parser::checkFirstType()
instance()
Full name: Options::instance()
Source: instance.cc
Used By:
generator1.cc: Generator::Generator(Rules const&, std::unordered_map&&)
parser1.cc: Parser::Parser(Rules&)
intersection(LookaheadSet const&) const
Full name: LookaheadSet::intersection(LookaheadSet const&) const
Source: intersection.cc
Used By:
comparereductions.cc: RRConflict::compareReductions(unsigned long*, unsigned long)
isDerivable(Production const*)
Full name: Grammar::isDerivable(Production const*)
Source: isderivable.cc
Used By:
derivable.cc: Grammar::derivable(Symbol const*)
isFirstStypeDefinition() const
Full name: Options::isFirstStypeDefinition() const
Source: isfirststypedef.cc
Used By:
setpolymorphicdecl.cc: Options::setPolymorphicDecl()
setstype.cc: Options::setStype()
setuniondecl.cc: Options::setUnionDecl(std::string const&)
Item()
Full name: Item::Item()
Source: item0.cc
Used By:
stateitem1.cc: StateItem::StateItem()
Item(Item const*, unsigned long)
Full name: Item::Item(Item const*, unsigned long)
Source: item2.cc
Used By:
buildkernel.cc: Next::buildKernel(std::vector*, std::vector const&)
Item(Production const*)
Full name: Item::Item(Production const*)
Source: item1.cc
Used By:
addproductions.cc: State::addProductions(Symbol const*)
initialstate.cc: State::initialState()
itemContext(std::ostream&) const
Full name: StateItem::itemContext(std::ostream&) const
Source: itemcontext.cc
Used By:
insertext.cc: State::insertExt(std::ostream&) const
key(std::ostream&) const
Full name: Generator::key(std::ostream&) const
Source: key.cc
Used By:
actioncases.cc: Generator::actionCases(std::ostream&) const
baseclass.cc: Generator::baseClass(std::ostream&) const
baseclasscode.cc: Generator::baseClassCode(std::ostream&) const
classh.cc: Generator::classH(std::ostream&) const
classih.cc: Generator::classIH(std::ostream&) const
debug.cc: Generator::debug(std::ostream&) const
debugdecl.cc: Generator::debugDecl(std::ostream&) const
debugfunctions.cc: Generator::debugFunctions(std::ostream&) const
debugincludes.cc: Generator::debugIncludes(std::ostream&) const
debuglookup.cc: Generator::debugLookup(std::ostream&) const
errorverbose.cc: Generator::errorVerbose(std::ostream&) const
executeactioncases.cc: Generator::executeActionCases(std::ostream&) const
idoftag.cc: Generator::idOfTag(std::ostream&) const
lex.cc: Generator::lex(std::ostream&) const
ltype.cc: Generator::ltype(std::ostream&) const
ltypeclear.cc: Generator::ltypeClear(std::ostream&) const
ltypedata.cc: Generator::ltypeData(std::ostream&) const
ltypepop.cc: Generator::ltypePop(std::ostream&) const
ltypepush.cc: Generator::ltypePush(std::ostream&) const
ltyperesize.cc: Generator::ltypeResize(std::ostream&) const
ltypestack.cc: Generator::ltypeStack(std::ostream&) const
namespaceclose.cc: Generator::namespaceClose(std::ostream&) const
namespaceopen.cc: Generator::namespaceOpen(std::ostream&) const
namespaceuse.cc: Generator::namespaceUse(std::ostream&) const
parserbase.cc: Generator::parserBase(std::ostream&) const
polyincludes.cc: Generator::polyIncludes(std::ostream&) const
polymorphic.cc: Generator::polymorphic(std::ostream&) const
polymorphiccode.cc: Generator::polymorphicCode(std::ostream&) const
polymorphicopassigndecl.cc: Generator::polymorphicOpAssignDecl(std::ostream&) const
polymorphicopassignimpl.cc: Generator::polymorphicOpAssignImpl(std::ostream&) const
polymorphicspecializations.cc: Generator::polymorphicSpecializations(std::ostream&) const
preincludes.cc: Generator::preIncludes(std::ostream&) const
print.cc: Generator::print(std::ostream&) const
prompt.cc: Generator::prompt(std::ostream&) const
scannerh.cc: Generator::scannerH(std::ostream&) const
scannerobject.cc: Generator::scannerObject(std::ostream&) const
staticdata.cc: Generator::staticData(std::ostream&) const
stype.cc: Generator::stype(std::ostream&) const
tokens.cc: Generator::tokens(std::ostream&) const
undefparser.cc: Generator::undefparser(std::ostream&) const
warntagmismatches.cc: Generator::warnTagMismatches(std::ostream&) const
lex(std::ostream&) const
Full name: Generator::lex(std::ostream&) const
Source: lex.cc
Used By:
data.cc: GLOBALS data.cc 28data.o
lex_()
Full name: Scanner::lex_()
Source: lex.cc
Used By:
parse.cc: ParserBase::popToken_()
loc(int, Block&, AtDollar const&)
Full name: Parser::loc(int, Block&, AtDollar const&)
Source: loc.cc
Used By:
data.cc: GLOBALS data.cc 2data.o
locEl(int, Block&, AtDollar const&)
Full name: Parser::locEl(int, Block&, AtDollar const&)
Source: locel.cc
Used By:
data.cc: GLOBALS data.cc 2data.o
LookaheadSet(LookaheadSet const&)
Full name: LookaheadSet::LookaheadSet(LookaheadSet const&)
Source: lookaheadset3.cc
Used By:
rrdata1.cc: RRData::RRData(LookaheadSet)
comparereductions.cc: GLOBALS comparereductions.cc 20comparereductions.o
visitreduction.cc: SRConflict::visitReduction(unsigned long)
addkernelitem.cc: GLOBALS addkernelitem.cc 25addkernelitem.o
addproductions.cc: GLOBALS addproductions.cc 25addproductions.o
LookaheadSet(LookaheadSet::EndStatus)
Full name: LookaheadSet::LookaheadSet(LookaheadSet::EndStatus)
Source: lookaheadset1.cc
Used By:
stateitem1.cc: StateItem::StateItem()
stateitem2.cc: StateItem::StateItem(Item const&)
distributelasetof.cc: State::distributeLAsetOf(StateItem&)
initialstate.cc: State::initialState()
lookup(std::string const&)
Full name: Symtab::lookup(std::string const&)
Source: lookup.cc
Used By:
cleanup.cc: Parser::cleanup()
definenonterminal.cc: Parser::defineNonTerminal(std::string const&, std::string const&)
defineterminal.cc: Parser::defineTerminal(std::string const&, Symbol::Type)
requirenonterminal.cc: Parser::requireNonTerminal(std::string const&)
setprecedence.cc: Parser::setPrecedence(unsigned long)
usesymbol.cc: Parser::useSymbol()
useterminal.cc: Parser::useTerminal()
ltype(std::ostream&) const
Full name: Generator::ltype(std::ostream&) const
Source: ltype.cc
Used By:
data.cc: GLOBALS data.cc 28data.o
ltypeClear(std::ostream&) const
Full name: Generator::ltypeClear(std::ostream&) const
Source: ltypeclear.cc
Used By:
data.cc: GLOBALS data.cc 28data.o
ltypeData(std::ostream&) const
Full name: Generator::ltypeData(std::ostream&) const
Source: ltypedata.cc
Used By:
data.cc: GLOBALS data.cc 28data.o
ltypePop(std::ostream&) const
Full name: Generator::ltypePop(std::ostream&) const
Source: ltypepop.cc
Used By:
data.cc: GLOBALS data.cc 28data.o
ltypePush(std::ostream&) const
Full name: Generator::ltypePush(std::ostream&) const
Source: ltypepush.cc
Used By:
data.cc: GLOBALS data.cc 28data.o
ltypeResize(std::ostream&) const
Full name: Generator::ltypeResize(std::ostream&) const
Source: ltyperesize.cc
Used By:
data.cc: GLOBALS data.cc 28data.o
ltypeStack(std::ostream&) const
Full name: Generator::ltypeStack(std::ostream&) const
Source: ltypestack.cc
Used By:
data.cc: GLOBALS data.cc 28data.o
multiCharQuote()
Full name: Scanner::multiCharQuote()
Source: multicharquote.cc
Used By:
lex.cc: Scanner::executeAction_(unsigned long)
multiplyDefined(Symbol const*)
Full name: Parser::multiplyDefined(Symbol const*)
Source: multiplydefined.cc
Used By:
definenonterminal.cc: Parser::defineNonTerminal(std::string const&, std::string const&)
defineterminal.cc: Parser::defineTerminal(std::string const&, Symbol::Type)
requirenonterminal.cc: Parser::requireNonTerminal(std::string const&)
useterminal.cc: Parser::useTerminal()
nameOrValue(std::ostream&) const
Full name: Terminal::nameOrValue(std::ostream&) const
Source: nameorvalue.cc
Used By:
reductionsymbol.cc: Writer::reductionSymbol(Element const*, unsigned long, FBB::Table&)
transition.cc: Writer::transition(Next const&, FBB::Table&)
namespaceClose(std::ostream&) const
Full name: Generator::namespaceClose(std::ostream&) const
Source: namespaceclose.cc
Used By:
data.cc: GLOBALS data.cc 28data.o
namespaceOpen(std::ostream&) const
Full name: Generator::namespaceOpen(std::ostream&) const
Source: namespaceopen.cc
Used By:
data.cc: GLOBALS data.cc 28data.o
namespaceUse(std::ostream&) const
Full name: Generator::namespaceUse(std::ostream&) const
Source: namespaceuse.cc
Used By:
data.cc: GLOBALS data.cc 28data.o
nestedBlock(Block&)
Full name: Parser::nestedBlock(Block&)
Source: nestedblock.cc
Used By:
handleproductionelements.cc: Parser::handleProductionElements(Meta_::SType&, Meta_::SType const&)
newRule(NonTerminal*, std::string const&, unsigned long)
Full name: Rules::newRule(NonTerminal*, std::string const&, unsigned long)
Source: newrule.cc
Used By:
augmentgrammar.cc: Rules::augmentGrammar(Symbol*)
openrule.cc: Parser::openRule(std::string const&)
newState()
Full name: State::newState()
Source: newstate.cc
Used By:
addstate.cc: State::addState(std::vector const&)
initialstate.cc: State::initialState()
Next(Symbol const*, unsigned long)
Full name: Next::Next(Symbol const*, unsigned long)
Source: next2.cc
Used By:
addnext.cc: State::addNext(Symbol const*, unsigned long)
nextFind(Symbol const*) const
Full name: State::nextFind(Symbol const*) const
Source: nextfindfrom.cc
Used By:
nexton.cc: State::nextOn(Symbol const*) const
notreducible.cc: State::notReducible(unsigned long)
nextHiddenName()
Full name: Parser::nextHiddenName()
Source: nexthiddenname.cc
Used By:
nestedblock.cc: Parser::nestedBlock(Block&)
nextState(Next&)
Full name: State::nextState(Next&)
Source: nextstate.cc
Used By:
construct.cc: State::construct()
NonTerminal(std::string const&, std::string const&, Symbol::Type)
Full name: NonTerminal::NonTerminal(std::string const&, std::string const&, Symbol::Type)
Source: nonterminal1.cc
Used By:
augmentgrammar.cc: Rules::augmentGrammar(Symbol*)
definenonterminal.cc: Parser::defineNonTerminal(std::string const&, std::string const&)
requirenonterminal.cc: Parser::requireNonTerminal(std::string const&)
usesymbol.cc: Parser::useSymbol()
nonTerminalSymbol(NonTerminal const*, std::ostream&)
Full name: Writer::nonTerminalSymbol(NonTerminal const*, std::ostream&)
Source: nonterminalsymbol.cc
Used By:
symbolicnames.cc: Writer::symbolicNames() const
notokens(std::ostream&) const
Full name: Generator::notokens(std::ostream&) const
Source: notokens.cc
Used By:
data.cc: GLOBALS data.cc 28data.o
notReducible(unsigned long)
Full name: State::notReducible(unsigned long)
Source: notreducible.cc
Used By:
setitems.cc: State::setItems()
octal()
Full name: Scanner::octal()
Source: octal.cc
Used By:
lex.cc: Scanner::executeAction_(unsigned long)
open(unsigned long, std::string const&)
Full name: Block::open(unsigned long, std::string const&)
Source: open.cc
Used By:
lex.cc: Scanner::executeAction_(unsigned long)
installdefaultaction.cc: Parser::installDefaultAction(Production const&, std::string const&)
openRule(std::string const&)
Full name: Parser::openRule(std::string const&)
Source: openrule.cc
Used By:
parse.cc: Parser::executeAction_(int)
operator()(std::string const&)
Full name: Block::operator()(std::string const&)
Source: opfuncharp.cc
Used By:
lex.cc: Scanner::executeAction_(unsigned long)
operator+=(FirstSet const&)
Full name: FirstSet::operator+=(FirstSet const&)
Source: operatorplusis1.cc
Used By:
setfirst.cc: NonTerminal::setFirst(NonTerminal*)
operatorplusis.cc: LookaheadSet::operator+=(LookaheadSet const&)
operatorplusis2.cc: LookaheadSet::operator+=(FirstSet const&)
firstbeyonddot.cc: Item::firstBeyondDot(FirstSet*) const
operator+=(LookaheadSet const&)
Full name: LookaheadSet::operator+=(LookaheadSet const&)
Source: operatorplusis.cc
Used By:
enlargela.cc: StateItem::enlargeLA(LookaheadSet const&)
distributelasetof.cc: State::distributeLAsetOf(StateItem&)
operator+=(std::set> const&)
Full name: FirstSet::operator+=(std::set> const&)
Source: operatorplusis2.cc
Used By:
operatorplusis1.cc: FirstSet::operator+=(FirstSet const&)
operator-=(LookaheadSet const&)
Full name: LookaheadSet::operator-=(LookaheadSet const&)
Source: operatorsubis.cc
Used By:
removeconflicts.cc: RRConflict::removeConflicts(std::vector&)
operator-=(Symbol const*)
Full name: LookaheadSet::operator-=(Symbol const*)
Source: operatorsubis2.cc
Used By:
removereductions.cc: SRConflict::removeReductions(std::vector&)
operator<<(std::ostream&, AtDollar const&)
Full name: operator<<(std::ostream&, AtDollar const&)
Source: operatorinsert.cc
Used By:
operatorinsert.cc: operator<<(std::ostream&, Block const&)
operator<<(std::ostream&, LookaheadSet const&)
Full name: operator<<(std::ostream&, LookaheadSet const&)
Source: operatorinsert.cc
Used By:
itemcontext.cc: StateItem::itemContext(std::ostream&) const
insert.cc: RRConflict::insert(std::ostream&) const
operator==(Item const&) const
Full name: Item::operator==(Item const&) const
Source: operatorequal.cc
Used By:
containskernelitem.cc: StateItem::containsKernelItem(Item const&, unsigned long, std::vector const&)
operator>=(LookaheadSet const&) const
Full name: LookaheadSet::operator>=(LookaheadSet const&) const
Source: operatorgreaterequal.cc
Used By:
enlargela.cc: StateItem::enlargeLA(LookaheadSet const&)
Options()
Full name: Options::Options()
Source: options1.cc
Used By:
instance.cc: Options::instance()
parse()
Full name: Parser::parse()
Source: parse.cc
Used By:
main.cc: main
parseFunction() const
Full name: Generator::parseFunction() const
Source: parsefunction.cc
Used By:
main.cc: main
Parser(Rules&)
Full name: Parser::Parser(Rules&)
Source: parser1.cc
Used By:
main.cc: main
ParserBase()
Full name: ParserBase::ParserBase()
Source: parse.cc
Used By:
parser1.cc: Parser::Parser(Rules&)
parserBase(std::ostream&) const
Full name: Generator::parserBase(std::ostream&) const
Source: parserbase.cc
Used By:
data.cc: GLOBALS data.cc 28data.o
plainItem(std::ostream&) const
Full name: StateItem::plainItem(std::ostream&) const
Source: plainitem.cc
Used By:
data.cc: GLOBALS data.cc 19data.o
plainItem(std::ostream&) const
Full name: Item::plainItem(std::ostream&) const
Source: plainitem.cc
Used By:
data.cc: GLOBALS data.cc 15data.o
plainWarnings()
Full name: Global::plainWarnings()
Source: plainwarnings.cc
Used By:
setaccessorvariables.cc: Options::setAccessorVariables()
pNrDotItem(std::ostream&) const
Full name: Item::pNrDotItem(std::ostream&) const
Source: pnrdotitem.cc
Used By:
insertext.cc: State::insertExt(std::ostream&) const
polyIncludes(std::ostream&) const
Full name: Generator::polyIncludes(std::ostream&) const
Source: polyincludes.cc
Used By:
data.cc: GLOBALS data.cc 28data.o
polymorphic(std::ostream&) const
Full name: Generator::polymorphic(std::ostream&) const
Source: polymorphic.cc
Used By:
data.cc: GLOBALS data.cc 28data.o
polymorphicCode(std::ostream&) const
Full name: Generator::polymorphicCode(std::ostream&) const
Source: polymorphiccode.cc
Used By:
data.cc: GLOBALS data.cc 28data.o
polymorphicOpAssignDecl(std::ostream&) const
Full name: Generator::polymorphicOpAssignDecl(std::ostream&) const
Source: polymorphicopassigndecl.cc
Used By:
data.cc: GLOBALS data.cc 28data.o
polymorphicOpAssignImpl(std::ostream&) const
Full name: Generator::polymorphicOpAssignImpl(std::ostream&) const
Source: polymorphicopassignimpl.cc
Used By:
data.cc: GLOBALS data.cc 28data.o
polymorphicSpecializations(std::ostream&) const
Full name: Generator::polymorphicSpecializations(std::ostream&) const
Source: polymorphicspecializations.cc
Used By:
data.cc: GLOBALS data.cc 28data.o
popStream()
Full name: ScannerBase::popStream()
Source: lex.cc
Used By:
popstream.cc: Scanner::popStream()
popStream()
Full name: Scanner::popStream()
Source: popstream.cc
Used By:
lex.cc: Scanner::lex_()
predefine(Terminal const*)
Full name: Parser::predefine(Terminal const*)
Source: predefine.cc
Used By:
parser1.cc: Parser::Parser(Rules&)
preIncludes(std::ostream&) const
Full name: Generator::preIncludes(std::ostream&) const
Source: preincludes.cc
Used By:
data.cc: GLOBALS data.cc 28data.o
print(std::ostream&) const
Full name: Generator::print(std::ostream&) const
Source: print.cc
Used By:
data.cc: GLOBALS data.cc 28data.o
processShiftReduceConflict(Next::ConstIter const&, unsigned long)
Full name: SRConflict::processShiftReduceConflict(Next::ConstIter const&, unsigned long)
Source: processshiftreduceconflict.cc
Used By:
visitreduction.cc: SRConflict::visitReduction(unsigned long)
Production(Symbol const*, unsigned long)
Full name: Production::Production(Symbol const*, unsigned long)
Source: production1.cc
Used By:
addproduction.cc: Rules::addProduction(unsigned long)
sethiddenaction.cc: Rules::setHiddenAction(Block const&)
productionInfo(Production const*, std::ostream&)
Full name: Writer::productionInfo(Production const*, std::ostream&)
Source: productioninfo.cc
Used By:
productions.cc: Writer::productions() const
productions() const
Full name: Writer::productions() const
Source: productions.cc
Used By:
staticdata.cc: Generator::staticData(std::ostream&) const
prompt(std::ostream&) const
Full name: Generator::prompt(std::ostream&) const
Source: prompt.cc
Used By:
data.cc: GLOBALS data.cc 28data.o
pushStream(std::string const&)
Full name: ScannerBase::pushStream(std::string const&)
Source: lex.cc
Used By:
handlexstring.cc: Scanner::handleXstring(unsigned long)
quotedName(std::ostream&) const
Full name: Terminal::quotedName(std::ostream&) const
Source: quotedname.cc
Used By:
setprecedence.cc: Rules::setPrecedence(Terminal const*)
rawString()
Full name: Scanner::rawString()
Source: handlerawstring.cc
Used By:
lex.cc: Scanner::executeAction_(unsigned long)
redo(unsigned long)
Full name: ScannerBase::redo(unsigned long)
Source: lex.cc
Used By:
handlexstring.cc: Scanner::handleXstring(unsigned long)
reduction(FBB::Table&, StateItem const&)
Full name: Writer::reduction(FBB::Table&, StateItem const&)
Source: reduction.cc
Used By:
reductions.cc: Writer::reductions(FBB::Table&, State const&)
reductions(FBB::Table&, State const&)
Full name: Writer::reductions(FBB::Table&, State const&)
Source: reductions.cc
Used By:
srtable.cc: Writer::srTable(State const*, FBB::Table&, std::ostream&)
reductionSymbol(Element const*, unsigned long, FBB::Table&)
Full name: Writer::reductionSymbol(Element const*, unsigned long, FBB::Table&)
Source: reductionsymbol.cc
Used By:
reduction.cc: Writer::reduction(FBB::Table&, StateItem const&)
releasePolymorphic()
Full name: Parser::releasePolymorphic()
Source: releasepolymorphic.cc
Used By:
main.cc: main
removeConflicts(std::vector&)
Full name: RRConflict::removeConflicts(std::vector&)
Source: removeconflicts.cc
Used By:
checkconflicts.cc: State::checkConflicts()
removeReductions(std::vector&)
Full name: SRConflict::removeReductions(std::vector&)
Source: removereductions.cc
Used By:
checkconflicts.cc: State::checkConflicts()
removeShift(RmShift const&, std::vector&, unsigned long*)
Full name: Next::removeShift(RmShift const&, std::vector&, unsigned long*)
Source: removeshift.cc
Used By:
removeshifts.cc: SRConflict::removeShifts(std::vector&)
removeShifts(std::vector&)
Full name: SRConflict::removeShifts(std::vector&)
Source: removeshifts.cc
Used By:
checkconflicts.cc: State::checkConflicts()
replace(std::string&, char, std::string const&)
Full name: Generator::replace(std::string&, char, std::string const&)
Source: replace.cc
Used By:
conflicts.cc: Generator::conflicts() const
replaceBaseFlag(std::string&) const
Full name: Generator::replaceBaseFlag(std::string&) const
Source: replacebaseflag.cc
Used By:
filter.cc: Generator::filter(std::istream&, std::ostream&, bool) const
insert2.cc: Generator::insert(std::ostream&, unsigned long, char const*) const
requireNonTerminal(std::string const&)
Full name: Parser::requireNonTerminal(std::string const&)
Source: requirenonterminal.cc
Used By:
openrule.cc: Parser::openRule(std::string const&)
reRead(std::string const&, unsigned long)
Full name: ScannerBase::Input::reRead(std::string const&, unsigned long)
Source: lex.cc
Used By:
assignment.cc: Scanner::assignment()
returntypespec.cc: Scanner::returnTypeSpec()
returnQuoted(void (Scanner::*)())
Full name: Scanner::returnQuoted(void (Scanner::*)())
Source: returnquoted.cc
Used By:
lex.cc: Scanner::executeAction_(unsigned long)
returnTypeSpec()
Full name: Scanner::returnTypeSpec()
Source: returntypespec.cc
Used By:
lex.cc: Scanner::executeAction_(unsigned long)
RmReduction(unsigned long, unsigned long, Symbol const*, bool)
Full name: RmReduction::RmReduction(unsigned long, unsigned long, Symbol const*, bool)
Source: rmreduction1.cc
Used By:
handlesrconflict.cc: SRConflict::handleSRconflict(Next::ConstIter const&, unsigned long)
RmShift(unsigned long, bool)
Full name: RmShift::RmShift(unsigned long, bool)
Source: rmshift1.cc
Used By:
handlesrconflict.cc: SRConflict::handleSRconflict(Next::ConstIter const&, unsigned long)
RRConflict(std::vector const&, std::vector const&)
Full name: RRConflict::RRConflict(std::vector const&, std::vector const&)
Source: rrconflict1.cc
Used By:
state1.cc: State::State(unsigned long)
RRData(LookaheadSet)
Full name: RRData::RRData(LookaheadSet)
Source: rrdata1.cc
Used By:
comparereductions.cc: RRConflict::compareReductions(unsigned long*, unsigned long)
s_acceptProductionNr
Full name: Rules::s_acceptProductionNr
Source: data.cc
Used By:
augmentgrammar.cc: Rules::augmentGrammar(Symbol*)
s_acceptState
Full name: State::s_acceptState
Source: data.cc
Used By:
define.cc: State::define(Rules const&)
srtable.cc: Writer::srTable(State const*, FBB::Table&, std::ostream&)
s_at
Full name: Generator::s_at
Source: data.cc
Used By:
replaceatkey.cc: Generator::replaceAtKey(std::string&, unsigned long) const
replacebaseflag.cc: Generator::replaceBaseFlag(std::string&) const
s_atBol
Full name: Generator::s_atBol
Source: data.cc
Used By:
bolat.cc: Generator::bolAt(std::string&, bool&) const
s_atFlag
Full name: Generator::s_atFlag
Source: data.cc
Used By:
replacebaseflag.cc: Generator::replaceBaseFlag(std::string&) const
s_autoTypeLabel
Full name: Parser::s_autoTypeLabel
Source: data.cc
Used By:
warnautotag.cc: Parser::warnAutoTag(bool, AtDollar const&) const
s_counter
Full name: NonTerminal::s_counter
Source: data.cc
Used By:
setfirst.cc: NonTerminal::setFirst(NonTerminal*)
determinefirst.cc: Rules::determineFirst()
s_debug_
Full name: ScannerBase::s_debug_
Source: lex.cc
Used By:
checkendofrawstring.cc: Scanner::checkEndOfRawString()
eoln.cc: Scanner::eoln()
handlerawstring.cc: Scanner::rawString()
handlexstring.cc: Scanner::handleXstring(unsigned long)
returnquoted.cc: Scanner::returnQuoted(void (Scanner::*)())
returntypespec.cc: Scanner::returnTypeSpec()
parse.cc: Parser::executeAction_(int)
s_defaultAction
Full name: Parser::s_defaultAction
Source: data.cc
Used By:
defaultpolymorphicaction.cc: Parser::defaultPolymorphicAction(Production const&)
s_defaultBaseClassSkeleton
Full name: Options::s_defaultBaseClassSkeleton
Source: data.cc
Used By:
setskeletons.cc: Options::setSkeletons()
s_defaultClassName
Full name: Options::s_defaultClassName
Source: data.cc
Used By:
setbasicstrings.cc: Options::setBasicStrings()
s_defaultClassSkeleton
Full name: Options::s_defaultClassSkeleton
Source: data.cc
Used By:
setskeletons.cc: Options::setSkeletons()
s_defaultImplementationSkeleton
Full name: Options::s_defaultImplementationSkeleton
Source: data.cc
Used By:
setskeletons.cc: Options::setSkeletons()
s_defaultParsefunSkeleton
Full name: Options::s_defaultParsefunSkeleton
Source: data.cc
Used By:
setskeletons.cc: Options::setSkeletons()
s_defaultParsefunSource
Full name: Options::s_defaultParsefunSource
Source: data.cc
Used By:
setpathstrings.cc: Options::setPathStrings()
s_defaultPolymorphicCodeSkeleton
Full name: Options::s_defaultPolymorphicCodeSkeleton
Source: data.cc
Used By:
setskeletons.cc: Options::setSkeletons()
s_defaultPolymorphicSkeleton
Full name: Options::s_defaultPolymorphicSkeleton
Source: data.cc
Used By:
setskeletons.cc: Options::setSkeletons()
s_defaultScannerClassName
Full name: Options::s_defaultScannerClassName
Source: data.cc
Used By:
setbasicstrings.cc: Options::setBasicStrings()
s_defaultScannerMatchedTextFunction
Full name: Options::s_defaultScannerMatchedTextFunction
Source: data.cc
Used By:
setbasicstrings.cc: Options::setBasicStrings()
s_defaultScannerTokenFunction
Full name: Options::s_defaultScannerTokenFunction
Source: data.cc
Used By:
setbasicstrings.cc: Options::setBasicStrings()
s_defaultSkeletonDirectory
Full name: Options::s_defaultSkeletonDirectory
Source: data.cc
Used By:
setbasicstrings.cc: Options::setBasicStrings()
s_defaultStackExpansion
Full name: Options::s_defaultStackExpansion
Source: data.cc
Used By:
setaccessorvariables.cc: Options::setAccessorVariables()
setstackexpansion.cc: Options::setStackExpansion(unsigned long)
staticdata.cc: Generator::staticData(std::ostream&) const
s_defaultTokenClass
Full name: Options::s_defaultTokenClass
Source: data.cc
Used By:
setquotedstrings.cc: Options::setQuotedStrings()
s_dfaBase_
Full name: ScannerBase::s_dfaBase_
Source: lex.cc
Used By:
checkendofrawstring.cc: Scanner::checkEndOfRawString()
eoln.cc: Scanner::eoln()
handlerawstring.cc: Scanner::rawString()
handlexstring.cc: Scanner::handleXstring(unsigned long)
returnquoted.cc: Scanner::returnQuoted(void (Scanner::*)())
returntypespec.cc: Scanner::returnTypeSpec()
parse.cc: Parser::executeAction_(int)
s_eofTerminal
Full name: Rules::s_eofTerminal
Source: data.cc
Used By:
operatorsubis2.cc: LookaheadSet::operator-=(Symbol const*)
reduction.cc: Writer::reduction(FBB::Table&, StateItem const&)
srtable.cc: Writer::srTable(State const*, FBB::Table&, std::ostream&)
selectsymbolic.cc: Generator::selectSymbolic(Terminal const*, std::vector&)
parser1.cc: Parser::Parser(Rules&)
s_errorTerminal
Full name: Rules::s_errorTerminal
Source: data.cc
Used By:
notreducible.cc: State::notReducible(unsigned long)
parser1.cc: Parser::Parser(Rules&)
s_fileName
Full name: Production::s_fileName
Source: data.cc
Used By:
showconflicts.cc: RRConflict::showConflicts(Rules const&) const
showconflicts.cc: SRConflict::showConflicts(Rules const&) const
installdefaultaction.cc: Parser::installDefaultAction(Production const&, std::string const&)
production1.cc: Production::Production(Symbol const*, unsigned long)
storeFilename.cc: Production::storeFilename(std::string const&)
s_hiddenName
Full name: Parser::s_hiddenName
Source: data.cc
Used By:
nexthiddenname.cc: Parser::nextHiddenName()
s_insert
Full name: Generator::s_insert
Source: data.cc
Used By:
insert.cc: Generator::insert(std::ostream&) const
s_insert
Full name: State::s_insert
Source: data.cc
Used By:
allstates.cc: State::allStates()
define.cc: State::define(Rules const&)
s_insertPtr
Full name: Next::s_insertPtr
Source: data.cc
Used By:
insertext.cc: State::insertExt(std::ostream&) const
insertstd.cc: State::insertStd(std::ostream&) const
s_insertPtr
Full name: NonTerminal::s_insertPtr
Source: data.cc
Used By:
v.cc: NonTerminal::insert(std::ostream&) const
showfirst.cc: Rules::showFirst() const
insert.cc: Item::insert(std::ostream&, Production const*) const
transitionkernel.cc: Next::transitionKernel(std::ostream&) const
insertext.cc: State::insertExt(std::ostream&) const
reductionsymbol.cc: Writer::reductionSymbol(Element const*, unsigned long, FBB::Table&)
transition.cc: Writer::transition(Next const&, FBB::Table&)
multiplydefined.cc: Parser::multiplyDefined(Symbol const*)
s_insertPtr
Full name: Terminal::s_insertPtr
Source: data.cc
Used By:
setprecedence.cc: GLOBALS setprecedence.cc 12setprecedence.o
showfirst.cc: Rules::showFirst() const
showterminals.cc: GLOBALS showterminals.cc 12showterminals.o
showunusedrules.cc: Rules::showUnusedRules() const
showunusedterminals.cc: Rules::showUnusedTerminals() const
derivesentence.cc: GLOBALS derivesentence.cc 13derivesentence.o
insert.cc: GLOBALS insert.cc 14insert.o
insert.cc: GLOBALS insert.cc 15insert.o
transition.cc: GLOBALS transition.cc 23transition.o
transitionkernel.cc: GLOBALS transitionkernel.cc 23transitionkernel.o
insert.cc: GLOBALS insert.cc 24insert.o
showconflicts.cc: GLOBALS showconflicts.cc 24showconflicts.o
insertext.cc: State::insertExt(std::ostream&) const
inserttoken.cc: GLOBALS inserttoken.cc 26inserttoken.o
reductionsymbol.cc: Writer::reductionSymbol(Element const*, unsigned long, FBB::Table&)
srtable.cc: GLOBALS srtable.cc 26srtable.o
terminalsymbol.cc: GLOBALS terminalsymbol.cc 26terminalsymbol.o
transition.cc: Writer::transition(Next const&, FBB::Table&)
filter.cc: Generator::filter(std::istream&, std::ostream&, bool) const
multiplydefined.cc: GLOBALS multiplydefined.cc 2multiplydefined.o
oinsert.cc: GLOBALS oinsert.cc 6oinsert.o
destructor.cc: GLOBALS destructor.cc 8destructor.o
setvalue.cc: GLOBALS setvalue.cc 8setvalue.o
unused.cc: GLOBALS unused.cc 8unused.o
standard.cc: GLOBALS standard.cc 9standard.o
s_insertPtr
Full name: StateItem::s_insertPtr
Source: data.cc
Used By:
insertext.cc: State::insertExt(std::ostream&) const
insertstd.cc: State::insertStd(std::ostream&) const
s_insertPtr
Full name: Item::s_insertPtr
Source: data.cc
Used By:
itemcontext.cc: StateItem::itemContext(std::ostream&) const
plainitem.cc: StateItem::plainItem(std::ostream&) const
insertext.cc: State::insertExt(std::ostream&) const
s_lastLineNr
Full name: Rules::s_lastLineNr
Source: data.cc
Used By:
addproduction.cc: Rules::addProduction(unsigned long)
newrule.cc: Rules::newRule(NonTerminal*, std::string const&, unsigned long)
sethiddenaction.cc: Rules::setHiddenAction(Block const&)
s_locationValue
Full name: Parser::s_locationValue
Source: data.cc
Used By:
loc.cc: Parser::loc(int, Block&, AtDollar const&)
s_locationValueStack
Full name: Parser::s_locationValueStack
Source: data.cc
Used By:
locel.cc: Parser::locEl(int, Block&, AtDollar const&)
s_maxValue
Full name: Terminal::s_maxValue
Source: data.cc
Used By:
assignnonterminalnumbers.cc: Rules::assignNonTerminalNumbers()
terminal1.cc: Terminal::Terminal(std::string const&, Symbol::Type, unsigned long, Terminal::Association, std::string const&)
s_nConflicts
Full name: SRConflict::s_nConflicts
Source: data.cc
Used By:
handlesrconflict.cc: SRConflict::handleSRconflict(Next::ConstIter const&, unsigned long)
define.cc: State::define(Rules const&)
s_nConflicts
Full name: RRConflict::s_nConflicts
Source: data.cc
Used By:
comparereductions.cc: RRConflict::compareReductions(unsigned long*, unsigned long)
define.cc: State::define(Rules const&)
s_nExpectedConflicts
Full name: Rules::s_nExpectedConflicts
Source: data.cc
Used By:
define.cc: State::define(Rules const&)
parse.cc: Parser::executeAction_(int)
s_nHidden
Full name: Parser::s_nHidden
Source: data.cc
Used By:
nexthiddenname.cc: Parser::nextHiddenName()
s_nr
Full name: Production::s_nr
Source: data.cc
Used By:
production1.cc: Production::Production(Symbol const*, unsigned long)
s_number
Full name: NonTerminal::s_number
Source: data.cc
Used By:
assignnonterminalnumbers.cc: Rules::assignNonTerminalNumbers()
s_options
Full name: Options::s_options
Source: data.cc
Used By:
instance.cc: Options::instance()
s_out_
Full name: ScannerBase::s_out_
Source: lex.cc
Used By:
checkendofrawstring.cc: Scanner::checkEndOfRawString()
eoln.cc: Scanner::eoln()
handlerawstring.cc: Scanner::rawString()
handlexstring.cc: Scanner::handleXstring(unsigned long)
returnquoted.cc: Scanner::returnQuoted(void (Scanner::*)())
returntypespec.cc: Scanner::returnTypeSpec()
parse.cc: Parser::executeAction_(int)
s_polymorphic
Full name: Parser::s_polymorphic
Source: data.cc
Used By:
setpolymorphicdecl.cc: Parser::setPolymorphicDecl()
s_precedence
Full name: Terminal::s_precedence
Source: data.cc
Used By:
expectrules.cc: Parser::expectRules()
parse.cc: Parser::executeAction_(int)
terminal1.cc: Terminal::Terminal(std::string const&, Symbol::Type, unsigned long, Terminal::Association, std::string const&)
terminal2.cc: Terminal::Terminal(std::string const&, std::string const&, Symbol::Type)
s_semanticValue
Full name: Parser::s_semanticValue
Source: data.cc
Used By:
dvalpolypar.cc: Parser::dvalPolyPar(int, Block&, AtDollar const&)
dvalpolyreplace.cc: Parser::dvalPolyReplace(bool, Block&, AtDollar const&, char const*)
dvalreplace.cc: Parser::dvalReplace(bool, Block&, AtDollar const&, char const*)
dvalunionreplace.cc: Parser::dvalUnionReplace(bool, Block&, AtDollar const&, char const*)
installdefaultaction.cc: Parser::installDefaultAction(Production const&, std::string const&)
s_semanticValueStack
Full name: Parser::s_semanticValueStack
Source: data.cc
Used By:
svselement.cc: Parser::svsElement(int, int) const
s_single
Full name: Parser::s_single
Source: data.cc
Used By:
parser1.cc: Parser::Parser(Rules&)
s_startProduction
Full name: Production::s_startProduction
Source: data.cc
Used By:
main.cc: main
initialstate.cc: State::initialState()
s_startSymbol
Full name: Rules::s_startSymbol
Source: data.cc
Used By:
augmentgrammar.cc: Rules::augmentGrammar(Symbol*)
derivesentence.cc: Grammar::deriveSentence()
s_state
Full name: State::s_state
Source: data.cc
Used By:
allstates.cc: State::allStates()
define.cc: State::define(Rules const&)
determinelasets.cc: State::determineLAsets()
findkernel.cc: State::findKernel(std::vector const&) const
inspecttransitions.cc: State::inspectTransitions(std::set>&)
newstate.cc: State::newState()
nextstate.cc: State::nextState(Next&)
srtables.cc: Writer::srTables() const
statesarray.cc: Writer::statesArray() const
s_stateName
Full name: StateType::s_stateName
Source: data.cc
Used By:
srtable.cc: Writer::srTable(State const*, FBB::Table&, std::ostream&)
s_stype
Full name: Parser::s_stype
Source: data.cc
Used By:
blkstype.cc: Parser::blkSTYPE(std::string const&, Production const&)
checkfield.cc: Parser::checkField(std::string const&)
svspolyreplace.cc: Parser::svsPolyReplace(int, Block&, AtDollar const&, char const*)
typeindex.cc: Parser::typeIndex(std::string const&)
s_threadConst
Full name: Writer::s_threadConst
Source: data.cc
Used By:
srtable.cc: Writer::srTable(State const*, FBB::Table&, std::ostream&)
statesarray.cc: Writer::statesArray() const
writer0.cc: Writer::Writer(std::string const&, Rules const&)
s_undefined
Full name: NonTerminal::s_undefined
Source: data.cc
Used By:
undefined.cc: NonTerminal::undefined(NonTerminal const*)
showunusednonterminals.cc: Rules::showUnusedNonTerminals() const
s_undefined
Full name: Parser::s_undefined
Source: data.cc
Used By:
blkerr.cc: Parser::blkErr(std::string const&, Production const&)
s_union
Full name: Parser::s_union
Source: data.cc
Used By:
setuniondecl.cc: Parser::setUnionDecl()
s_unused
Full name: NonTerminal::s_unused
Source: data.cc
Used By:
unused.cc: NonTerminal::unused(NonTerminal const*)
showunusednonterminals.cc: Rules::showUnusedNonTerminals() const
s_unused
Full name: Production::s_unused
Source: data.cc
Used By:
showunusedrules.cc: Rules::showUnusedRules() const
unused.cc: Production::unused(Production const*)
s_value
Full name: Terminal::s_value
Source: data.cc
Used By:
setvalue.cc: Terminal::setValue(unsigned long)
terminal1.cc: Terminal::Terminal(std::string const&, Symbol::Type, unsigned long, Terminal::Association, std::string const&)
s_value
Full name: Options::s_value
Source: data.cc
Used By:
valueof.cc: Options::valueOf(std::string const&, Options::Value, unsigned int)
s_valueSet
Full name: Terminal::s_valueSet
Source: data.cc
Used By:
setunique.cc: Terminal::setUnique(unsigned long)
setvalue.cc: Terminal::setValue(unsigned long)
s_yylex
Full name: Options::s_yylex
Source: data.cc
Used By:
setbasicstrings.cc: Options::setBasicStrings()
s_YYText
Full name: Options::s_YYText
Source: data.cc
Used By:
setbasicstrings.cc: Options::setBasicStrings()
Scanner(std::string const&)
Full name: Scanner::Scanner(std::string const&)
Source: scanner1.cc
Used By:
parser1.cc: Parser::Parser(Rules&)
ScannerBase(std::string const&, std::string const&, bool)
Full name: ScannerBase::ScannerBase(std::string const&, std::string const&, bool)
Source: lex.cc
Used By:
scanner1.cc: Scanner::Scanner(std::string const&)
scannerH(std::ostream&) const
Full name: Generator::scannerH(std::ostream&) const
Source: scannerh.cc
Used By:
data.cc: GLOBALS data.cc 28data.o
scannerObject(std::ostream&) const
Full name: Generator::scannerObject(std::ostream&) const
Source: scannerobject.cc
Used By:
data.cc: GLOBALS data.cc 28data.o
selectSymbolic(Terminal const*, std::vector&)
Full name: Generator::selectSymbolic(Terminal const*, std::vector&)
Source: selectsymbolic.cc
Used By:
tokens.cc: Generator::tokens(std::ostream&) const
setAccessorVariables()
Full name: Options::setAccessorVariables()
Source: setaccessorvariables.cc
Used By:
cleanup.cc: Parser::cleanup()
setAction(Block const&, bool)
Full name: Rules::setAction(Block const&, bool)
Source: setaction.cc
Used By:
installaction.cc: Parser::installAction(Block&)
installdefaultaction.cc: Parser::installDefaultAction(Production const&, std::string const&)
setAtPatterns()
Full name: AtDollar::setAtPatterns()
Source: setatpatterns.cc
Used By:
atdollar1.cc: AtDollar::AtDollar(unsigned long, unsigned long, std::string const&, bool)
setBasicStrings()
Full name: Options::setBasicStrings()
Source: setbasicstrings.cc
Used By:
setaccessorvariables.cc: Options::setAccessorVariables()
setBooleans()
Full name: Options::setBooleans()
Source: setbooleans.cc
Used By:
setaccessorvariables.cc: Options::setAccessorVariables()
setConstructorChecks(std::string const&, std::string const&, unsigned long)
Full name: Options::setConstructorChecks(std::string const&, std::string const&, unsigned long)
Source: setconstructorchecks.cc
Used By:
parse.cc: Parser::executeAction_(int)
setDebug(bool)
Full name: ParserBase::setDebug(bool)
Source: parse.cc
Used By:
parser1.cc: Parser::Parser(Rules&)
setDebug(bool)
Full name: ScannerBase::setDebug(bool)
Source: lex.cc
Used By:
parser1.cc: Parser::Parser(Rules&)
setDefaultAction(std::string const&, std::string const&, unsigned long)
Full name: Options::setDefaultAction(std::string const&, std::string const&, unsigned long)
Source: setdefaultaction.cc
Used By:
setparsingoptions.cc: Options::setParsingOptions()
expectrules.cc: Parser::expectRules()
parse.cc: Parser::executeAction_(int)
setDollarDollarPatterns()
Full name: AtDollar::setDollarDollarPatterns()
Source: setdollardollarpatterns.cc
Used By:
setdollarpatterns.cc: AtDollar::setDollarPatterns()
setDollarPatterns()
Full name: AtDollar::setDollarPatterns()
Source: setdollarpatterns.cc
Used By:
atdollar1.cc: AtDollar::AtDollar(unsigned long, unsigned long, std::string const&, bool)
setFirst(NonTerminal*)
Full name: NonTerminal::setFirst(NonTerminal*)
Source: setfirst.cc
Used By:
determinefirst.cc: Rules::determineFirst()
setHiddenAction(Block const&)
Full name: Rules::setHiddenAction(Block const&)
Source: sethiddenaction.cc
Used By:
nestedblock.cc: Parser::nestedBlock(Block&)
setIdx(RRData::Keep, unsigned long, unsigned long)
Full name: RRData::setIdx(RRData::Keep, unsigned long, unsigned long)
Source: setidx.cc
Used By:
comparereductions.cc: RRConflict::compareReductions(unsigned long*, unsigned long)
setItems()
Full name: State::setItems()
Source: setitems.cc
Used By:
construct.cc: State::construct()
setLineNrs() const
Full name: Scanner::setLineNrs() const
Source: setlinenrs.cc
Used By:
eoln.cc: Scanner::eoln()
handlexstring.cc: Scanner::handleXstring(unsigned long)
lex.cc: Scanner::executeAction_(unsigned long)
settags.cc: Scanner::setTags() const
setLocationDecl(std::string const&)
Full name: Options::setLocationDecl(std::string const&)
Source: setlocationdecl.cc
Used By:
parse.cc: Parser::executeAction_(int)
setLtype()
Full name: Options::setLtype()
Source: setltype.cc
Used By:
parse.cc: Parser::executeAction_(int)
setNonTerminalTypes()
Full name: Rules::setNonTerminalTypes()
Source: setnonterminaltypes.cc
Used By:
expectrules.cc: Parser::expectRules()
setNumberPatterns()
Full name: AtDollar::setNumberPatterns()
Source: setnumberpatterns.cc
Used By:
setdollarpatterns.cc: AtDollar::setDollarPatterns()
setOpt(std::string*, char const*, std::string const&)
Full name: Options::setOpt(std::string*, char const*, std::string const&)
Source: setopt.cc
Used By:
setbasicstrings.cc: Options::setBasicStrings()
setParsingOptions()
Full name: Options::setParsingOptions()
Source: setparsingoptions.cc
Used By:
expectrules.cc: Parser::expectRules()
setPath(std::string*, int, std::string const&, char const*, char const*)
Full name: Options::setPath(std::string*, int, std::string const&, char const*, char const*)
Source: setpath2.cc
Used By:
setpathstrings.cc: Options::setPathStrings()
setPathStrings()
Full name: Options::setPathStrings()
Source: setpathstrings.cc
Used By:
setaccessorvariables.cc: Options::setAccessorVariables()
setPolymorphicDecl()
Full name: Parser::setPolymorphicDecl()
Source: setpolymorphicdecl.cc
Used By:
parse.cc: Parser::executeAction_(int)
setPolymorphicDecl()
Full name: Options::setPolymorphicDecl()
Source: setpolymorphicdecl.cc
Used By:
setpolymorphicdecl.cc: Parser::setPolymorphicDecl()
setPrecedence(Terminal const*)
Full name: Rules::setPrecedence(Terminal const*)
Source: setprecedence.cc
Used By:
setprecedence.cc: Parser::setPrecedence(unsigned long)
setPrecedence(Terminal const*)
Full name: Production::setPrecedence(Terminal const*)
Source: setprecedence.cc
Used By:
setprecedence.cc: Rules::setPrecedence(Terminal const*)
updateprecedence.cc: Rules::updatePrecedence(Production*)
setPrecedence(unsigned long)
Full name: Parser::setPrecedence(unsigned long)
Source: setprecedence.cc
Used By:
parse.cc: Parser::executeAction_(int)
setPrintTokens()
Full name: Options::setPrintTokens()
Source: setprinttokens.cc
Used By:
parse.cc: Parser::executeAction_(int)
setQuotedStrings()
Full name: Options::setQuotedStrings()
Source: setquotedstrings.cc
Used By:
setaccessorvariables.cc: Options::setAccessorVariables()
setRefPatterns()
Full name: AtDollar::setRefPatterns()
Source: setrefpatterns.cc
Used By:
atdollar1.cc: AtDollar::AtDollar(unsigned long, unsigned long, std::string const&, bool)
setRequiredTokens(unsigned long)
Full name: Options::setRequiredTokens(unsigned long)
Source: setrequiredtokens.cc
Used By:
parse.cc: Parser::executeAction_(int)
setSkeletons()
Full name: Options::setSkeletons()
Source: setskeletons.cc
Used By:
setaccessorvariables.cc: Options::setAccessorVariables()
setStackExpansion(unsigned long)
Full name: Options::setStackExpansion(unsigned long)
Source: setstackexpansion.cc
Used By:
parse.cc: Parser::executeAction_(int)
setStart()
Full name: Parser::setStart()
Source: setstart.cc
Used By:
parse.cc: Parser::executeAction_(int)
setStype()
Full name: Options::setStype()
Source: setstype.cc
Used By:
parse.cc: Parser::executeAction_(int)
setTagMismatches(std::string const&, std::string const&, unsigned long)
Full name: Options::setTagMismatches(std::string const&, std::string const&, unsigned long)
Source: settagmismatches.cc
Used By:
setparsingoptions.cc: Options::setParsingOptions()
parse.cc: Parser::executeAction_(int)
setTagNr(unsigned long)
Full name: AtDollar::setTagNr(unsigned long)
Source: settagnr.cc
Used By:
settagpatterns.cc: AtDollar::setTagPatterns()
setTagPatterns()
Full name: AtDollar::setTagPatterns()
Source: settagpatterns.cc
Used By:
setdollarpatterns.cc: AtDollar::setDollarPatterns()
setTags() const
Full name: Scanner::setTags() const
Source: settags.cc
Used By:
handlexstring.cc: Scanner::handleXstring(unsigned long)
popstream.cc: Scanner::popStream()
scanner1.cc: Scanner::Scanner(std::string const&)
setUnionDecl()
Full name: Parser::setUnionDecl()
Source: setuniondecl.cc
Used By:
parse.cc: Parser::executeAction_(int)
setUnionDecl(std::string const&)
Full name: Options::setUnionDecl(std::string const&)
Source: setuniondecl.cc
Used By:
setuniondecl.cc: Parser::setUnionDecl()
setUnique(unsigned long)
Full name: Terminal::setUnique(unsigned long)
Source: setunique.cc
Used By:
setvalue.cc: Terminal::setValue(unsigned long)
setValue(unsigned long)
Full name: Terminal::setValue(unsigned long)
Source: setvalue.cc
Used By:
definetokenname.cc: Parser::defineTokenName(std::string const&, bool)
setVerbosity()
Full name: Options::setVerbosity()
Source: setverbosity.cc
Used By:
cleanup.cc: Parser::cleanup()
showConflicts(Rules const&) const
Full name: SRConflict::showConflicts(Rules const&) const
Source: showconflicts.cc
Used By:
define.cc: State::define(Rules const&)
showConflicts(Rules const&) const
Full name: RRConflict::showConflicts(Rules const&) const
Source: showconflicts.cc
Used By:
define.cc: State::define(Rules const&)
showFilenames() const
Full name: Options::showFilenames() const
Source: showfilenames.cc
Used By:
cleanup.cc: Parser::cleanup()
showFirst() const
Full name: Rules::showFirst() const
Source: showfirst.cc
Used By:
main.cc: main
showRules() const
Full name: Rules::showRules() const
Source: showrules.cc
Used By:
main.cc: main
showTerminals() const
Full name: Rules::showTerminals() const
Source: showterminals.cc
Used By:
main.cc: main
showUnusedNonTerminals() const
Full name: Rules::showUnusedNonTerminals() const
Source: showunusednonterminals.cc
Used By:
main.cc: main
showUnusedRules() const
Full name: Rules::showUnusedRules() const
Source: showunusedrules.cc
Used By:
main.cc: main
showUnusedTerminals() const
Full name: Rules::showUnusedTerminals() const
Source: showunusedterminals.cc
Used By:
main.cc: main
solveByAssociation() const
Full name: Next::solveByAssociation() const
Source: solvebyassociation.cc
Used By:
handlesrconflict.cc: SRConflict::handleSRconflict(Next::ConstIter const&, unsigned long)
solveByPrecedence(Symbol const*) const
Full name: Next::solveByPrecedence(Symbol const*) const
Source: solvebyprecedence.cc
Used By:
handlesrconflict.cc: SRConflict::handleSRconflict(Next::ConstIter const&, unsigned long)
SRConflict(std::vector const&, std::vector const&, std::vector const&)
Full name: SRConflict::SRConflict(std::vector const&, std::vector const&, std::vector const&)
Source: srconflict1.cc
Used By:
state1.cc: State::State(unsigned long)
srTable(State const*, FBB::Table&, std::ostream&)
Full name: Writer::srTable(State const*, FBB::Table&, std::ostream&)
Source: srtable.cc
Used By:
srtables.cc: Writer::srTables() const
srTables() const
Full name: Writer::srTables() const
Source: srtables.cc
Used By:
staticdata.cc: Generator::staticData(std::ostream&) const
stackElement() const
Full name: AtDollar::stackElement() const
Source: stackelement.cc
Used By:
errindextoolarge.cc: Parser::errIndexTooLarge(AtDollar const&, int) const
standard(std::ostream&) const
Full name: Production::standard(std::ostream&) const
Source: standard.cc
Used By:
showrules.cc: Rules::showRules() const
productioninfo.cc: Writer::productionInfo(Production const*, std::ostream&)
blkassignw.cc: Parser::blkAssignW(std::string const&, Production const&)
blkdirectw.cc: Parser::blkDirectW(std::string const&, Production const&)
blkerr.cc: Parser::blkErr(std::string const&, Production const&)
blknopw.cc: Parser::blkNopW(std::string const&, Production const&)
blkstypew.cc: Parser::blkSTYPEW(std::string const&, Production const&)
errindextoolarge.cc: Parser::errIndexTooLarge(AtDollar const&, int) const
stdemsg.cc: Parser::stdEmsg(AtDollar const&) const
stdwmsg.cc: Parser::stdWmsg(AtDollar const&) const
warndefaultaction.cc: Parser::warnDefaultAction(Production const&)
warnmissingsemval.cc: Parser::warnMissingSemval() const
unused.cc: Production::unused(Production const*)
State(unsigned long)
Full name: State::State(unsigned long)
Source: state1.cc
Used By:
newstate.cc: State::newState()
StateItem(Item const&)
Full name: StateItem::StateItem(Item const&)
Source: stateitem2.cc
Used By:
addproductions.cc: State::addProductions(Symbol const*)
addstate.cc: State::addState(std::vector const&)
initialstate.cc: State::initialState()
statesArray() const
Full name: Writer::statesArray() const
Source: statesarray.cc
Used By:
staticdata.cc: Generator::staticData(std::ostream&) const
staticData(std::ostream&) const
Full name: Generator::staticData(std::ostream&) const
Source: staticdata.cc
Used By:
data.cc: GLOBALS data.cc 28data.o
stdEmsg(AtDollar const&) const
Full name: Parser::stdEmsg(AtDollar const&) const
Source: stdemsg.cc
Used By:
errnotag.cc: Parser::errNoTag(int, Block&, AtDollar const&)
errnounionptr.cc: Parser::errNoUnionPtr(AtDollar const&)
existingtag.cc: Parser::existingTag(AtDollar const&) const
stdWmsg(AtDollar const&) const
Full name: Parser::stdWmsg(AtDollar const&) const
Source: stdwmsg.cc
Used By:
warnautotag.cc: Parser::warnAutoTag(bool, AtDollar const&) const
warnnegativedollarindices.cc: Parser::warnNegativeDollarIndices(AtDollar const&) const
storeFilename(std::string const&)
Full name: Production::storeFilename(std::string const&)
Source: storeFilename.cc
Used By:
newrule.cc: Rules::newRule(NonTerminal*, std::string const&, unsigned long)
stype(std::ostream&) const
Full name: Generator::stype(std::ostream&) const
Source: stype.cc
Used By:
data.cc: GLOBALS data.cc 28data.o
sType(unsigned long) const
Full name: Rules::sType(unsigned long) const
Source: stype.cc
Used By:
svspolyreplace.cc: Parser::svsPolyReplace(int, Block&, AtDollar const&, char const*)
svsunionreplace.cc: Parser::svsUnionReplace(int, Block&, AtDollar const&, char const*)
warnautotag.cc: Parser::warnAutoTag(bool, AtDollar const&) const
substituteBlock(int, Block&)
Full name: Parser::substituteBlock(int, Block&)
Source: substituteblock.cc
Used By:
installaction.cc: Parser::installAction(Block&)
nestedblock.cc: Parser::nestedBlock(Block&)
summarizeActions()
Full name: State::summarizeActions()
Source: summarizeactions.cc
Used By:
define.cc: State::define(Rules const&)
svs(int, Block&, AtDollar const&)
Full name: Parser::svs(int, Block&, AtDollar const&)
Source: svs.cc
Used By:
data.cc: GLOBALS data.cc 2data.o
svsElement(int, int) const
Full name: Parser::svsElement(int, int) const
Source: svselement.cc
Used By:
blkassign.cc: Parser::blkAssign(std::string const&, Production const&)
blkdirect.cc: Parser::blkDirect(std::string const&, Production const&)
checkfirsttype.cc: Parser::checkFirstType()
svspolyreplace.cc: Parser::svsPolyReplace(int, Block&, AtDollar const&, char const*)
svspolytagreplace.cc: Parser::svsPolyTagReplace(int, Block&, AtDollar const&, char const*)
svsreplace.cc: Parser::svsReplace(int, Block&, AtDollar const&, char const*)
svsunionreplace.cc: Parser::svsUnionReplace(int, Block&, AtDollar const&, char const*)
svsuniontagreplace.cc: Parser::svsUnionTagReplace(int, Block&, AtDollar const&, char const*)
svsMem(int, Block&, AtDollar const&)
Full name: Parser::svsMem(int, Block&, AtDollar const&)
Source: svsmem.cc
Used By:
data.cc: GLOBALS data.cc 2data.o
svsPoly(int, Block&, AtDollar const&)
Full name: Parser::svsPoly(int, Block&, AtDollar const&)
Source: svspoly.cc
Used By:
data.cc: GLOBALS data.cc 2data.o
svsPolyMem(int, Block&, AtDollar const&)
Full name: Parser::svsPolyMem(int, Block&, AtDollar const&)
Source: svspolymem.cc
Used By:
data.cc: GLOBALS data.cc 2data.o
svsPolyPtr(int, Block&, AtDollar const&)
Full name: Parser::svsPolyPtr(int, Block&, AtDollar const&)
Source: svspolyptr.cc
Used By:
data.cc: GLOBALS data.cc 2data.o
svsPolyReplace(int, Block&, AtDollar const&, char const*)
Full name: Parser::svsPolyReplace(int, Block&, AtDollar const&, char const*)
Source: svspolyreplace.cc
Used By:
svspoly.cc: Parser::svsPoly(int, Block&, AtDollar const&)
svspolymem.cc: Parser::svsPolyMem(int, Block&, AtDollar const&)
svspolyptr.cc: Parser::svsPolyPtr(int, Block&, AtDollar const&)
svsPolyTag(int, Block&, AtDollar const&)
Full name: Parser::svsPolyTag(int, Block&, AtDollar const&)
Source: svspolytag.cc
Used By:
data.cc: GLOBALS data.cc 2data.o
svsPolyTagMem(int, Block&, AtDollar const&)
Full name: Parser::svsPolyTagMem(int, Block&, AtDollar const&)
Source: svspolytagmem.cc
Used By:
data.cc: GLOBALS data.cc 2data.o
svsPolyTagPtr(int, Block&, AtDollar const&)
Full name: Parser::svsPolyTagPtr(int, Block&, AtDollar const&)
Source: svspolytagptr.cc
Used By:
data.cc: GLOBALS data.cc 2data.o
svsPolyTagReplace(int, Block&, AtDollar const&, char const*)
Full name: Parser::svsPolyTagReplace(int, Block&, AtDollar const&, char const*)
Source: svspolytagreplace.cc
Used By:
svspolytag.cc: Parser::svsPolyTag(int, Block&, AtDollar const&)
svspolytagmem.cc: Parser::svsPolyTagMem(int, Block&, AtDollar const&)
svspolytagptr.cc: Parser::svsPolyTagPtr(int, Block&, AtDollar const&)
svsPtr(int, Block&, AtDollar const&)
Full name: Parser::svsPtr(int, Block&, AtDollar const&)
Source: svsptr.cc
Used By:
data.cc: GLOBALS data.cc 2data.o
svsRefUnion(int, Block&, AtDollar const&)
Full name: Parser::svsRefUnion(int, Block&, AtDollar const&)
Source: svsrefunion.cc
Used By:
data.cc: GLOBALS data.cc 2data.o
svsReplace(int, Block&, AtDollar const&, char const*)
Full name: Parser::svsReplace(int, Block&, AtDollar const&, char const*)
Source: svsreplace.cc
Used By:
svs.cc: Parser::svs(int, Block&, AtDollar const&)
svsmem.cc: Parser::svsMem(int, Block&, AtDollar const&)
svsptr.cc: Parser::svsPtr(int, Block&, AtDollar const&)
svsrefunion.cc: Parser::svsRefUnion(int, Block&, AtDollar const&)
svsUnion(int, Block&, AtDollar const&)
Full name: Parser::svsUnion(int, Block&, AtDollar const&)
Source: svsunion.cc
Used By:
data.cc: GLOBALS data.cc 2data.o
svsUnionMem(int, Block&, AtDollar const&)
Full name: Parser::svsUnionMem(int, Block&, AtDollar const&)
Source: svsunionmem.cc
Used By:
data.cc: GLOBALS data.cc 2data.o
svsUnionPtr(int, Block&, AtDollar const&)
Full name: Parser::svsUnionPtr(int, Block&, AtDollar const&)
Source: svsunionptr.cc
Used By:
data.cc: GLOBALS data.cc 2data.o
svsUnionReplace(int, Block&, AtDollar const&, char const*)
Full name: Parser::svsUnionReplace(int, Block&, AtDollar const&, char const*)
Source: svsunionreplace.cc
Used By:
svsrefunion.cc: Parser::svsRefUnion(int, Block&, AtDollar const&)
svsunion.cc: Parser::svsUnion(int, Block&, AtDollar const&)
svsunionmem.cc: Parser::svsUnionMem(int, Block&, AtDollar const&)
svsunionptr.cc: Parser::svsUnionPtr(int, Block&, AtDollar const&)
svsUnionTag(int, Block&, AtDollar const&)
Full name: Parser::svsUnionTag(int, Block&, AtDollar const&)
Source: svsuniontag.cc
Used By:
data.cc: GLOBALS data.cc 2data.o
svsUnionTagMem(int, Block&, AtDollar const&)
Full name: Parser::svsUnionTagMem(int, Block&, AtDollar const&)
Source: svsuniontagmem.cc
Used By:
data.cc: GLOBALS data.cc 2data.o
svsUnionTagPtr(int, Block&, AtDollar const&)
Full name: Parser::svsUnionTagPtr(int, Block&, AtDollar const&)
Source: svsuniontagptr.cc
Used By:
data.cc: GLOBALS data.cc 2data.o
svsUnionTagReplace(int, Block&, AtDollar const&, char const*)
Full name: Parser::svsUnionTagReplace(int, Block&, AtDollar const&, char const*)
Source: svsuniontagreplace.cc
Used By:
svsuniontag.cc: Parser::svsUnionTag(int, Block&, AtDollar const&)
svsuniontagmem.cc: Parser::svsUnionTagMem(int, Block&, AtDollar const&)
svsuniontagptr.cc: Parser::svsUnionTagPtr(int, Block&, AtDollar const&)
Symbol(std::string const&, Symbol::Type, std::string const&)
Full name: Symbol::Symbol(std::string const&, Symbol::Type, std::string const&)
Source: symbol1.cc
Used By:
nonterminal1.cc: NonTerminal::NonTerminal(std::string const&, std::string const&, Symbol::Type)
terminal1.cc: Terminal::Terminal(std::string const&, Symbol::Type, unsigned long, Terminal::Association, std::string const&)
terminal2.cc: Terminal::Terminal(std::string const&, std::string const&, Symbol::Type)
symbolicNames() const
Full name: Writer::symbolicNames() const
Source: symbolicnames.cc
Used By:
staticdata.cc: Generator::staticData(std::ostream&) const
t_nErrors
Full name: Meta_::t_nErrors
Source: parse.cc
Used By:
handleproductionelement.cc: GLOBALS handleproductionelement.cc 2handleproductionelement.o
handleproductionelements.cc: GLOBALS handleproductionelements.cc 2handleproductionelements.o
Terminal(std::string const&, std::string const&, Symbol::Type)
Full name: Terminal::Terminal(std::string const&, std::string const&, Symbol::Type)
Source: terminal2.cc
Used By:
data.cc: GLOBALS data.cc 12data.o
Terminal(std::string const&, Symbol::Type, unsigned long, Terminal::Association, std::string const&)
Full name: Terminal::Terminal(std::string const&, Symbol::Type, unsigned long, Terminal::Association, std::string const&)
Source: terminal1.cc
Used By:
defineterminal.cc: Parser::defineTerminal(std::string const&, Symbol::Type)
useterminal.cc: Parser::useTerminal()
terminalSymbol(Terminal const*, std::ostream&)
Full name: Writer::terminalSymbol(Terminal const*, std::ostream&)
Source: terminalsymbol.cc
Used By:
symbolicnames.cc: Writer::symbolicNames() const
termToNonterm(Symbol*, Symbol*)
Full name: Rules::termToNonterm(Symbol*, Symbol*)
Source: termtononterm.cc
Used By:
requirenonterminal.cc: Parser::requireNonTerminal(std::string const&)
tokenPath() const
Full name: Generator::tokenPath() const
Source: tokenpath.cc
Used By:
tokens.cc: Generator::tokens(std::ostream&) const
tokens(std::ostream&) const
Full name: Generator::tokens(std::ostream&) const
Source: tokens.cc
Used By:
data.cc: GLOBALS data.cc 28data.o
transition(Next const&, FBB::Table&)
Full name: Writer::transition(Next const&, FBB::Table&)
Source: transition.cc
Used By:
transitions.cc: Writer::transitions(FBB::Table&, std::vector const&)
transition(std::ostream&) const
Full name: Next::transition(std::ostream&) const
Source: transition.cc
Used By:
data.cc: GLOBALS data.cc 23data.o
transitionKernel(std::ostream&) const
Full name: Next::transitionKernel(std::ostream&) const
Source: transitionkernel.cc
Used By:
insertext.cc: State::insertExt(std::ostream&) const
transitions(FBB::Table&, std::vector const&)
Full name: Writer::transitions(FBB::Table&, std::vector const&)
Source: transitions.cc
Used By:
srtable.cc: Writer::srTable(State const*, FBB::Table&, std::ostream&)
typeIndex(std::string const&)
Full name: Parser::typeIndex(std::string const&)
Source: typeindex.cc
Used By:
defaultpolymorphicaction.cc: Parser::defaultPolymorphicAction(Production const&)
undefined(NonTerminal const*)
Full name: NonTerminal::undefined(NonTerminal const*)
Source: undefined.cc
Used By:
showunusednonterminals.cc: Rules::showUnusedNonTerminals() const
undefparser(std::ostream&) const
Full name: Generator::undefparser(std::ostream&) const
Source: undefparser.cc
Used By:
data.cc: GLOBALS data.cc 28data.o
undelimit(std::string const&)
Full name: Options::undelimit(std::string const&)
Source: undelimit.cc
Used By:
handlexstring.cc: Scanner::handleXstring(unsigned long)
cleandir.cc: Options::cleanDir(std::string&, bool)
setopt.cc: Options::setOpt(std::string*, char const*, std::string const&)
definepathname.cc: Parser::definePathname(std::string*)
unused(NonTerminal const*)
Full name: NonTerminal::unused(NonTerminal const*)
Source: unused.cc
Used By:
showunusednonterminals.cc: Rules::showUnusedNonTerminals() const
unused(Production const*)
Full name: Production::unused(Production const*)
Source: unused.cc
Used By:
showunusedrules.cc: Rules::showUnusedRules() const
unused(Terminal const*)
Full name: Terminal::unused(Terminal const*)
Source: unused.cc
Used By:
showunusedterminals.cc: Rules::showUnusedTerminals() const
updateDefaultActionLineNr()
Full name: Parser::updateDefaultActionLineNr()
Source: updatedefaultactionlinenr.cc
Used By:
parse.cc: Parser::executeAction_(int)
updateDefaultActionLineNr(unsigned long)
Full name: Rules::updateDefaultActionLineNr(unsigned long)
Source: updatedefaultactionlinenr.cc
Used By:
addproduction.cc: Rules::addProduction(unsigned long)
updatedefaultactionlinenr.cc: Parser::updateDefaultActionLineNr()
updatePrecedence(Production*)
Full name: Rules::updatePrecedence(Production*)
Source: updateprecedence.cc
Used By:
updateprecedences.cc: Rules::updatePrecedences()
updatePrecedences()
Full name: Rules::updatePrecedences()
Source: updateprecedences.cc
Used By:
main.cc: main
usage(std::string const&)
Full name: usage(std::string const&)
Source: usage.cc
Used By:
main.cc: main
useSymbol()
Full name: Parser::useSymbol()
Source: usesymbol.cc
Used By:
parse.cc: Parser::executeAction_(int)
useTerminal()
Full name: Parser::useTerminal()
Source: useterminal.cc
Used By:
parse.cc: Parser::executeAction_(int)
v_firstSet() const
Full name: NonTerminal::v_firstSet() const
Source: v.cc
Used By:
destructor.cc: NonTerminal::~NonTerminal()
v_value() const
Full name: NonTerminal::v_value() const
Source: v.cc
Used By:
destructor.cc: NonTerminal::~NonTerminal()
valueOf(std::string const&, Options::Value, unsigned int)
Full name: Options::valueOf(std::string const&, Options::Value, unsigned int)
Source: valueof.cc
Used By:
setconstructorchecks.cc: Options::setConstructorChecks(std::string const&, std::string const&, unsigned long)
setdefaultaction.cc: Options::setDefaultAction(std::string const&, std::string const&, unsigned long)
settagmismatches.cc: Options::setTagMismatches(std::string const&, std::string const&, unsigned long)
valueQuotedName(std::ostream&) const
Full name: Terminal::valueQuotedName(std::ostream&) const
Source: valuequotedname.cc
Used By:
showterminals.cc: Rules::showTerminals() const
showunusedterminals.cc: Rules::showUnusedTerminals() const
vectorIdx(unsigned long) const
Full name: Production::vectorIdx(unsigned long) const
Source: vectoridx.cc
Used By:
stype.cc: Rules::sType(unsigned long) const
beyonddotisnonterminal.cc: Item::beyondDotIsNonTerminal() const
firstbeyonddot.cc: Item::firstBeyondDot(FirstSet*) const
hasrightofdot.cc: Item::hasRightOfDot(Symbol const&) const
notreducible.cc: State::notReducible(unsigned long)
blkassign.cc: Parser::blkAssign(std::string const&, Production const&)
blkcheck.cc: Parser::blkCheck(std::string const&, Production const&)
blkcheckw.cc: Parser::blkCheckW(std::string const&, Production const&)
blkerr.cc: Parser::blkErr(std::string const&, Production const&)
defaultpolymorphicaction.cc: Parser::defaultPolymorphicAction(Production const&)
version
Full name: version
Source: version.cc
Used By:
main.cc: main
usage.cc: usage(std::string const&)
filter.cc: Generator::filter(std::istream&, std::ostream&, bool) const
visitReduction(unsigned long)
Full name: SRConflict::visitReduction(unsigned long)
Source: visitreduction.cc
Used By:
inspect.cc: SRConflict::inspect()
visitReduction(unsigned long)
Full name: RRConflict::visitReduction(unsigned long)
Source: visitreduction.cc
Used By:
inspect.cc: RRConflict::inspect()
warnAutoTag(bool, AtDollar const&) const
Full name: Parser::warnAutoTag(bool, AtDollar const&) const
Source: warnautotag.cc
Used By:
dvalpolypar.cc: Parser::dvalPolyPar(int, Block&, AtDollar const&)
dvalpolyreplace.cc: Parser::dvalPolyReplace(bool, Block&, AtDollar const&, char const*)
dvalreplace.cc: Parser::dvalReplace(bool, Block&, AtDollar const&, char const*)
dvalunionreplace.cc: Parser::dvalUnionReplace(bool, Block&, AtDollar const&, char const*)
warnForceLSP(unsigned long) const
Full name: Parser::warnForceLSP(unsigned long) const
Source: warnforcelsp.cc
Used By:
loc.cc: Parser::loc(int, Block&, AtDollar const&)
locel.cc: Parser::locEl(int, Block&, AtDollar const&)
warnMissingSemval() const
Full name: Parser::warnMissingSemval() const
Source: warnmissingsemval.cc
Used By:
substituteblock.cc: Parser::substituteBlock(int, Block&)
warnNegativeDollarIndices(AtDollar const&) const
Full name: Parser::warnNegativeDollarIndices(AtDollar const&) const
Source: warnnegativedollarindices.cc
Used By:
svsreplace.cc: Parser::svsReplace(int, Block&, AtDollar const&, char const*)
warnTagMismatches(std::ostream&) const
Full name: Generator::warnTagMismatches(std::ostream&) const
Source: warntagmismatches.cc
Used By:
data.cc: GLOBALS data.cc 28data.o
Writer(std::string const&, Rules const&)
Full name: Writer::Writer(std::string const&, Rules const&)
Source: writer0.cc
Used By:
generator1.cc: Generator::Generator(Rules const&, std::unordered_map&&)
year
Full name: year
Source: version.cc
Used By:
usage.cc: usage(std::string const&)
~Base()
Full name: Meta_::Base::~Base()
Source: parse.cc
Used By:
handleproductionelement.cc: GLOBALS handleproductionelement.cc 2handleproductionelement.o
handleproductionelements.cc: GLOBALS handleproductionelements.cc 2handleproductionelements.o
setprecedence.cc: GLOBALS setprecedence.cc 2setprecedence.o
~Element()
Full name: Element::~Element()
Source: destructor.cc
Used By:
destructor.cc: Symbol::~Symbol()
symbol1.cc: Symbol::Symbol(std::string const&, Symbol::Type, std::string const&)
~Symbol()
Full name: Symbol::~Symbol()
Source: destructor.cc
Used By:
destructor.cc: NonTerminal::~NonTerminal()
destructor.cc: Terminal::~Terminal()
terminal1.cc: Terminal::Terminal(std::string const&, Symbol::Type, unsigned long, Terminal::Association, std::string const&)
terminal2.cc: Terminal::Terminal(std::string const&, std::string const&, Symbol::Type)
~Terminal()
Full name: Terminal::~Terminal()
Source: destructor.cc
Used By:
data.cc: GLOBALS data.cc 12data.o
----------------------------------------------------------------------
CALL TREE FOR: main
main
+-usage(std::string const&)
| +-version
| +-year
+-version
+-Parser::Parser(Rules&)
| +-Rules::s_errorTerminal
| +-Rules::s_eofTerminal
| +-ScannerBase::setDebug(bool)
| +-Scanner::Scanner(std::string const&)
| | +-Scanner::setTags() const
| | | +-Scanner::setLineNrs() const
| | +-ScannerBase::ScannerBase(std::string const&, std::string const&, bool)
| +-Options::instance()
| | +-Options::s_options
| | +-Options::Options()
| +-Parser::s_single
| +-ParserBase::setDebug(bool)
| +-ParserBase::ParserBase()
| +-Parser::predefine(Terminal const*)
| +-Rules::insert(Terminal*, std::string const&)
+-Parser::parse()
+-Parser::cleanup()
| +-Symtab::lookup(std::string const&)
| +-Rules::augmentGrammar(Symbol*)
| | +-NonTerminal::NonTerminal(std::string const&, std::string const&, Symbol::Type)
| | | +-Symbol::Symbol(std::string const&, Symbol::Type, std::string const&)
| | | +-Element::~Element()
| | +-Rules::addElement(Symbol*)
| | +-Rules::addProduction(unsigned long)
| | | +-Rules::updateDefaultActionLineNr(unsigned long)
| | | +-Rules::s_lastLineNr
| | | +-Production::Production(Symbol const*, unsigned long)
| | | +-Production::s_fileName
| | | +-Production::s_nr
| | +-Rules::insert(NonTerminal*)
| | +-Rules::newRule(NonTerminal*, std::string const&, unsigned long)
| | | +-Rules::s_lastLineNr
| | | +-Production::storeFilename(std::string const&)
| | | +-Production::s_fileName
| | +-Rules::s_startSymbol
| | +-Rules::s_acceptProductionNr
| +-Options::setAccessorVariables()
| | +-Global::plainWarnings()
| | +-Options::s_defaultStackExpansion
| | +-Options::setBooleans()
| | +-Options::setBasicStrings()
| | | +-Options::cleanDir(std::string&, bool)
| | | | +-Options::undelimit(std::string const&)
| | | +-Options::s_yylex
| | | +-Options::s_defaultScannerTokenFunction
| | | +-Options::s_YYText
| | | +-Options::s_defaultScannerMatchedTextFunction
| | | +-Options::s_defaultScannerClassName
| | | +-Options::s_defaultSkeletonDirectory
| | | +-Options::s_defaultClassName
| | | +-Options::setOpt(std::string*, char const*, std::string const&)
| | | +-Options::undelimit(std::string const&)
| | +-Options::setPathStrings()
| | | +-Options::s_defaultParsefunSource
| | | +-Options::setPath(std::string*, int, std::string const&, char const*, char const*)
| | +-Options::setQuotedStrings()
| | | +-Options::addIncludeQuotes(std::string&)
| | | +-Options::s_defaultTokenClass
| | +-Options::setSkeletons()
| | +-Options::s_defaultPolymorphicSkeleton
| | +-Options::s_defaultPolymorphicCodeSkeleton
| | +-Options::s_defaultParsefunSkeleton
| | +-Options::s_defaultImplementationSkeleton
| | +-Options::s_defaultClassSkeleton
| | +-Options::s_defaultBaseClassSkeleton
| +-Options::setVerbosity()
| +-Options::showFilenames() const
+-Rules::updatePrecedences()
| +-Rules::updatePrecedence(Production*)
| +-Production::setPrecedence(Terminal const*)
+-Rules::showRules() const
| +-Production::standard(std::ostream&) const
+-Rules::showTerminals() const
| +-Terminal::valueQuotedName(std::ostream&) const
+-Rules::determineFirst()
| +-NonTerminal::s_counter
| +-NonTerminal::setFirst(NonTerminal*)
| +-NonTerminal::s_counter
| +-FirstSet::operator+=(FirstSet const&)
| +-FirstSet::operator+=(std::set> const&)
+-Rules::showFirst() const
| +-NonTerminal::s_insertPtr
| +-Terminal::s_insertPtr
+-Production::s_startProduction
+-State::define(Rules const&)
| +-Rules::s_nExpectedConflicts
| +-RRConflict::s_nConflicts
| +-RRConflict::showConflicts(Rules const&) const
| | +-Production::s_fileName
| +-SRConflict::s_nConflicts
| +-SRConflict::showConflicts(Rules const&) const
| | +-Production::s_fileName
| +-State::insertExt(std::ostream&) const
| | +-NonTerminal::s_insertPtr
| | +-Terminal::s_insertPtr
| | +-Item::s_insertPtr
| | +-Item::pNrDotItem(std::ostream&) const
| | | +-Item::insert(std::ostream&, Production const*) const
| | | +-NonTerminal::s_insertPtr
| | +-StateItem::s_insertPtr
| | +-StateItem::itemContext(std::ostream&) const
| | | +-operator<<(std::ostream&, LookaheadSet const&)
| | | | +-LookaheadSet::insert(std::ostream&) const
| | | +-Item::s_insertPtr
| | +-RRConflict::insert(std::ostream&) const
| | | +-operator<<(std::ostream&, LookaheadSet const&)
| | | +-LookaheadSet::insert(std::ostream&) const
| | +-Next::s_insertPtr
| | +-Next::transitionKernel(std::ostream&) const
| | | +-NonTerminal::s_insertPtr
| | | +-Next::checkRemoved(std::ostream&) const
| | +-SRConflict::insert(std::ostream&) const
| +-State::s_insert
| +-State::s_state
| +-State::checkConflicts()
| | +-RRConflict::inspect()
| | | +-RRConflict::visitReduction(unsigned long)
| | | +-RRConflict::compareReductions(unsigned long*, unsigned long)
| | | +-LookaheadSet::intersection(LookaheadSet const&) const
| | | +-RRData::RRData(LookaheadSet)
| | | | +-LookaheadSet::LookaheadSet(LookaheadSet const&)
| | | +-RRData::setIdx(RRData::Keep, unsigned long, unsigned long)
| | | +-Terminal::comparePrecedence(Symbol const*, Symbol const*)
| | | +-RRConflict::s_nConflicts
| | +-RRConflict::removeConflicts(std::vector&)
| | | +-LookaheadSet::operator-=(LookaheadSet const&)
| | +-SRConflict::inspect()
| | | +-SRConflict::visitReduction(unsigned long)
| | | +-LookaheadSet::LookaheadSet(LookaheadSet const&)
| | | +-SRConflict::processShiftReduceConflict(Next::ConstIter const&, unsigned long)
| | | +-SRConflict::handleSRconflict(Next::ConstIter const&, unsigned long)
| | | +-RmReduction::RmReduction(unsigned long, unsigned long, Symbol const*, bool)
| | | +-RmShift::RmShift(unsigned long, bool)
| | | +-Next::solveByAssociation() const
| | | +-Next::solveByPrecedence(Symbol const*) const
| | | | +-Terminal::comparePrecedence(Symbol const*, Symbol const*)
| | | +-SRConflict::s_nConflicts
| | +-SRConflict::removeReductions(std::vector&)
| | | +-LookaheadSet::operator-=(Symbol const*)
| | | +-Rules::s_eofTerminal
| | +-SRConflict::removeShifts(std::vector&)
| | +-Next::removeShift(RmShift const&, std::vector&, unsigned long*)
| +-State::construct()
| | +-State::setItems()
| | | +-State::notReducible(unsigned long)
| | | +-Rules::s_errorTerminal
| | | +-Production::vectorIdx(unsigned long) const
| | | +-Next::addToKernel(std::vector&, Symbol const*, unsigned long)
| | | +-State::addNext(Symbol const*, unsigned long)
| | | | +-Next::Next(Symbol const*, unsigned long)
| | | | +-State::addProductions(Symbol const*)
| | | | +-Item::Item(Production const*)
| | | | +-StateItem::StateItem(Item const&)
| | | | +-LookaheadSet::LookaheadSet(LookaheadSet::EndStatus)
| | | +-State::nextFind(Symbol const*) const
| | +-State::nextState(Next&)
| | +-Next::buildKernel(std::vector*, std::vector const&)
| | | +-Item::Item(Item const*, unsigned long)
| | +-State::addState(std::vector const&)
| | | +-StateItem::StateItem(Item const&)
| | | | +-LookaheadSet::LookaheadSet(LookaheadSet::EndStatus)
| | | +-State::addKernelItem(StateItem const&)
| | | +-State::newState()
| | | +-State::s_state
| | | +-State::State(unsigned long)
| | | +-RRConflict::RRConflict(std::vector const&, std::vector const&)
| | | +-SRConflict::SRConflict(std::vector const&, std::vector const&, std::vector const&)
| | +-State::s_state
| | +-State::findKernel(std::vector const&) const
| | +-State::s_state
| | +-State::hasKernel(std::vector const&) const
| | +-StateItem::containsKernelItem(Item const&, unsigned long, std::vector const&)
| | +-Item::operator==(Item const&) const
| +-State::s_acceptState
| +-State::initialState()
| | +-Production::s_startProduction
| | +-LookaheadSet::LookaheadSet(LookaheadSet::EndStatus)
| | +-Item::Item(Production const*)
| | +-StateItem::StateItem(Item const&)
| | | +-LookaheadSet::LookaheadSet(LookaheadSet::EndStatus)
| | +-State::addKernelItem(StateItem const&)
| | +-State::newState()
| | +-State::s_state
| | +-State::State(unsigned long)
| | +-RRConflict::RRConflict(std::vector const&, std::vector const&)
| | +-SRConflict::SRConflict(std::vector const&, std::vector const&, std::vector const&)
| +-State::determineLAsets()
| | +-State::s_state
| | +-State::computeLAsets()
| | | +-State::distributeLAsetOf(StateItem&)
| | | +-LookaheadSet::LookaheadSet(LookaheadSet::EndStatus)
| | | +-LookaheadSet::operator+=(LookaheadSet const&)
| | | | +-FirstSet::operator+=(FirstSet const&)
| | | | +-FirstSet::operator+=(std::set> const&)
| | | +-Item::beyondDotIsNonTerminal() const
| | | | +-Production::vectorIdx(unsigned long) const
| | | +-Item::firstBeyondDot(FirstSet*) const
| | | | +-FirstSet::operator+=(FirstSet const&)
| | | | | +-FirstSet::operator+=(std::set> const&)
| | | | +-Production::vectorIdx(unsigned long) const
| | | +-StateItem::enlargeLA(LookaheadSet const&)
| | | +-LookaheadSet::operator>=(LookaheadSet const&) const
| | | +-LookaheadSet::operator+=(LookaheadSet const&)
| | | +-FirstSet::operator+=(FirstSet const&)
| | | +-FirstSet::operator+=(std::set> const&)
| | +-State::inspectTransitions(std::set>&)
| | +-StateItem::enlargeLA(LookaheadSet const&)
| | | +-LookaheadSet::operator>=(LookaheadSet const&) const
| | | +-LookaheadSet::operator+=(LookaheadSet const&)
| | | +-FirstSet::operator+=(FirstSet const&)
| | | +-FirstSet::operator+=(std::set> const&)
| | +-State::s_state
| +-State::summarizeActions()
| +-State::insertStd(std::ostream&) const
| +-StateItem::s_insertPtr
| +-RRConflict::insert(std::ostream&) const
| | +-operator<<(std::ostream&, LookaheadSet const&)
| | +-LookaheadSet::insert(std::ostream&) const
| +-Next::s_insertPtr
| +-SRConflict::insert(std::ostream&) const
+-Rules::assignNonTerminalNumbers()
| +-NonTerminal::s_number
| +-Terminal::s_maxValue
+-Rules::showUnusedTerminals() const
| +-Terminal::s_insertPtr
| +-Terminal::valueQuotedName(std::ostream&) const
| +-Terminal::unused(Terminal const*)
+-Rules::showUnusedNonTerminals() const
| +-NonTerminal::s_undefined
| +-NonTerminal::s_unused
| +-NonTerminal::undefined(NonTerminal const*)
| | +-NonTerminal::s_undefined
| +-NonTerminal::unused(NonTerminal const*)
| +-NonTerminal::s_unused
+-Rules::showUnusedRules() const
| +-Terminal::s_insertPtr
| +-Production::unused(Production const*)
| | +-Production::standard(std::ostream&) const
| | +-Production::s_unused
| +-Production::s_unused
+-State::allStates()
| +-State::insertExt(std::ostream&) const
| | +-NonTerminal::s_insertPtr
| | +-Terminal::s_insertPtr
| | +-Item::s_insertPtr
| | +-Item::pNrDotItem(std::ostream&) const
| | | +-Item::insert(std::ostream&, Production const*) const
| | | +-NonTerminal::s_insertPtr
| | +-StateItem::s_insertPtr
| | +-StateItem::itemContext(std::ostream&) const
| | | +-operator<<(std::ostream&, LookaheadSet const&)
| | | | +-LookaheadSet::insert(std::ostream&) const
| | | +-Item::s_insertPtr
| | +-RRConflict::insert(std::ostream&) const
| | | +-operator<<(std::ostream&, LookaheadSet const&)
| | | +-LookaheadSet::insert(std::ostream&) const
| | +-Next::s_insertPtr
| | +-Next::transitionKernel(std::ostream&) const
| | | +-NonTerminal::s_insertPtr
| | | +-Next::checkRemoved(std::ostream&) const
| | +-SRConflict::insert(std::ostream&) const
| +-State::s_insert
| +-State::s_state
+-Grammar::deriveSentence()
| +-Rules::s_startSymbol
| +-Grammar::derivable(Symbol const*)
| +-Grammar::becomesDerivable(Production const*)
| | +-Grammar::derivable(Symbol const*) ==> 2
| +-Grammar::isDerivable(Production const*)
+-Parser::releasePolymorphic()
+-Generator::Generator(Rules const&, std::unordered_map&&)
| +-Writer::Writer(std::string const&, Rules const&)
| | +-Writer::s_threadConst
| +-Options::instance()
| +-Options::s_options
| +-Options::Options()
+-Generator::conflicts() const
| +-Options::baseclassHeaderName() const
| +-Generator::errExisting(std::string const&, std::string const&, std::string const&) const
| | +-Generator::grep(std::string const&, std::string const&) const
| +-Generator::replace(std::string&, char, std::string const&)
+-Generator::baseClassHeader() const
| +-Generator::filter(std::istream&, std::ostream&, bool) const
| +-version
| +-Terminal::s_insertPtr
| +-Generator::replaceBaseFlag(std::string&) const
| | +-Generator::s_at
| | +-Generator::s_atFlag
| +-Generator::insert(std::ostream&) const
| +-Generator::s_insert
+-Generator::classHeader() const
| +-Generator::filter(std::istream&, std::ostream&, bool) const
| +-version
| +-Terminal::s_insertPtr
| +-Generator::replaceBaseFlag(std::string&) const
| | +-Generator::s_at
| | +-Generator::s_atFlag
| +-Generator::insert(std::ostream&) const
| +-Generator::s_insert
+-Generator::implementationHeader() const
| +-Generator::filter(std::istream&, std::ostream&, bool) const
| +-version
| +-Terminal::s_insertPtr
| +-Generator::replaceBaseFlag(std::string&) const
| | +-Generator::s_at
| | +-Generator::s_atFlag
| +-Generator::insert(std::ostream&) const
| +-Generator::s_insert
+-Generator::parseFunction() const
+-Generator::filter(std::istream&, std::ostream&, bool) const
+-version
+-Terminal::s_insertPtr
+-Generator::replaceBaseFlag(std::string&) const
| +-Generator::s_at
| +-Generator::s_atFlag
+-Generator::insert(std::ostream&) const
+-Generator::s_insert
bisonc++-6.09.01/block/ 0000775 0001750 0001750 00000000000 14771271012 013354 5 ustar frank frank bisonc++-6.09.01/block/block.f 0000664 0001750 0001750 00000001320 14700504612 014606 0 ustar frank frank inline bool Block::assignment() const
{
return d_assignment;
}
inline void Block::operator+=(std::string const &text)
{
append(text);
}
inline Block::operator bool() const
{
return d_count;
}
inline std::vector::const_reverse_iterator
Block::rbeginAtDollar() const
{
return d_atDollar.rbegin();
}
inline std::vector::const_reverse_iterator
Block::rendAtDollar() const
{
return d_atDollar.rend();
}
inline size_t Block::lineNr() const
{
return d_lineNr;
}
inline void Block::setLineNr(size_t lineNr)
{
d_lineNr = lineNr;
}
inline std::string const &Block::source() const
{
return d_source;
}
inline std::string const &Block::str() const
{
return *this;
}
bisonc++-6.09.01/block/open.cc 0000664 0001750 0001750 00000000734 14700504612 014625 0 ustar frank frank #include "block.ih"
void Block::open(size_t lineno, string const &source)
{
if (d_count) // existing block ?
*this += "{"s; // add open curly bracket to the block's code
else
{ // assign line if no braces were open yet
clear();
this->string::operator=("{"s);
d_lineNr = lineno;
d_source = source;
}
++d_count; // here, as clear() will reset d_count
}
bisonc++-6.09.01/block/opfuncharp.cc 0000664 0001750 0001750 00000000225 14700504612 016024 0 ustar frank frank #include "block.ih"
bool Block::operator()(string const &text)
{
if (d_count == 0)
return false;
*this += text;
return true;
}
bisonc++-6.09.01/block/clear.cc 0000664 0001750 0001750 00000000175 14700504612 014751 0 ustar frank frank #include "block.ih"
void Block::clear()
{
erase();
d_atDollar.clear();
d_count = 0;
d_assignment = false;
}
bisonc++-6.09.01/block/close.cc 0000664 0001750 0001750 00000000132 14700504612 014761 0 ustar frank frank #include "block.ih"
bool Block::close()
{
*this += "}";
return --d_count == 0;
}
bisonc++-6.09.01/block/block.h 0000664 0001750 0001750 00000004247 14700504612 014623 0 ustar frank frank #ifndef _INCLUDED_BLOCK_
#define _INCLUDED_BLOCK_
#include
#include
#include
#include "../atdollar/atdollar.h"
class Block: private std::string
{
friend std::ostream &operator<<(std::ostream &out, Block const &blk);
size_t d_lineNr;
std::string d_source; // the source in which the block
// was found. The block's text itself
// is in the Block's base class
int d_count = 0; // curly braces nesting count, handled
// by clear(), close(), and open()
std::vector d_atDollar; // @- and $-specifications
bool d_assignment = false;
public:
using std::string::empty;
using std::string::find;
using std::string::find_first_not_of;
using std::string::find_first_of;
using std::string::find_last_of;
using std::string::insert;
using std::string::length;
using std::string::operator[];
using std::string::replace;
using std::string::substr;
void clear();
// clears the previous block contents
void open(size_t lineno, std::string const &source);
bool close();
void atDollar(size_t lineNr, std::string const &text,
bool assignment, bool refByScanner = false);
void operator+=(std::string const &text);
operator bool() const; // return true if a block is active
// add text if a block is active,
bool operator()(std::string const &text); // returns true if active
std::vector::const_reverse_iterator rbeginAtDollar() const;
std::vector::const_reverse_iterator rendAtDollar() const;
size_t lineNr() const;
void setLineNr(size_t lineNr);
std::string const &source() const; // the block's source file
std::string const &str() const; // the block's contents
bool assignment() const; // used '$$ ='
};
#include "block.f"
#endif
bisonc++-6.09.01/block/atdollar.cc 0000664 0001750 0001750 00000000407 14700504612 015463 0 ustar frank frank #include "block.ih"
void Block::atDollar(size_t lineNr, string const &text, bool assignment,
bool refByScanner)
{
d_atDollar.push_back(AtDollar{length(), lineNr, text, refByScanner});
d_assignment |= assignment;
append(text);
}
bisonc++-6.09.01/block/operatorinsert.cc 0000664 0001750 0001750 00000000421 14700504612 016735 0 ustar frank frank #include "block.ih"
std::ostream &operator<<(std::ostream &out, Block const &blk)
{
out << '`' << static_cast(blk) << "'\n";
copy(blk.d_atDollar.rbegin(), blk.d_atDollar.rend(),
ostream_iterator(out, "\n"));
return out;
}
bisonc++-6.09.01/block/block.ih 0000664 0001750 0001750 00000000217 14700504612 014765 0 ustar frank frank #include "block.h"
#include
#include
#include
#include
#ifndef SPCH_
using namespace std;
#endif
bisonc++-6.09.01/block/frame 0000664 0001750 0001750 00000000056 14700504612 014367 0 ustar frank frank #include "block.ih"
void Block::() const
{
}
bisonc++-6.09.01/build 0000775 0001750 0001750 00000011751 14700504612 013311 0 ustar frank frank #!/usr/bin/icmake -t.
#include "icmconf"
string
g_logPath,
g_cwd = chdir(""); // initial working directory, ends in /
int g_echo = ON;
#include "icmake/cuteoln"
#include "icmake/backtick"
#include "icmake/setopt"
#include "icmake/run"
#include "icmake/md"
#include "icmake/special"
#include "icmake/pathfile"
#include "icmake/findall"
#include "icmake/loginstall"
#include "icmake/logrecursive"
#include "icmake/logzip"
#include "icmake/logfile"
#include "icmake/uninstall"
#include "icmake/clean"
#include "icmake/manpage"
#include "icmake/manual"
#include "icmake/gitlab"
#include "icmake/destinstall"
#include "icmake/loginstalled"
#include "icmake/install"
void main(int argc, list argv)
{
string option;
string psType; // program or strip
int idx;
int precomp = 1;
for (idx = listlen(argv); idx--; )
{
if (argv[idx] == "-q")
{
g_echo = OFF;
argv -= (list)"-q";
}
else if (argv[idx] == "-P")
{
precomp = 0;
argv -= (list)"-P";
}
else if (strfind(argv[idx], "LOG:") == 0)
{
g_logPath = argv[idx];
argv -= (list)g_logPath;
g_logPath = substr(g_logPath, 4, strlen(g_logPath));
}
}
echo(g_echo);
option = argv[1];
if (option == "clean")
clean(0);
if (option == "distclean")
clean(1);
if (option != "")
special();
if (option == "install")
install(argv[2], argv[3]);
if (option == "uninstall")
uninstall(argv[2]);
if (option == "gitlab")
gitlab();
if (option == "man")
manpage();
if (option == "manual")
manual();
if (precomp)
exec(P_NOCHECK,
"sed -i 's,^//#define SPCH,#define SPCH,' icmconf");
else
{
exec(P_NOCHECK,
"sed -i 's,^#define SPCH,//#define SPCH,' icmconf");
exec(P_NOCHECK, "rm -f *.ih.gch */*.ih.gch");
}
if (option == "library")
{
system("icmbuild library");
exit(0);
}
if (argv[2] == "strip")
psType = "strip";
else
psType = "program";
if (option == "program")
{
system("icmbuild " + psType);
exit(0);
}
if (option == "oxref")
{
system("icmbuild " + psType);
run("oxref -t main -r replace -fxs tmp/main.o tmp/lib" LIBRARY ".a > "
PROGRAM ".xref");
exit(0);
}
if (option == "scanner")
{
chdir("scanner");
system("flexc++ -i scanner.ih lexer");
chdir("..");
system("icmbuild " + psType);
exit(0);
}
printf("Usage: build [-q -P] what\n"
"Where\n"
" -q: run quietly, do not show executed commands\n"
" -P: do not use precompiled headers\n"
"`what' is one of:\n"
" clean - clean up remnants of previous compilations\n"
" distclean - clean + fully remove tmp/\n"
" library - build " PROGRAM "'s library\n"
" man - build the man-page (requires Yodl)\n"
" manual - build the manual (requires Yodl)\n"
" program [strip] - build " PROGRAM " (optionally strip the "
"executable)\n"
" oxref [strip] - same a `program', also builds xref file using "
"oxref\n"
" scanner [strip] - build new scanner, then 'build program'\n"
" install [LOG:path] selection [base] -\n"
" to install the software in the locations "
"defined \n"
" in the INSTALL.im file, optionally below "
"base.\n"
" LOG:path is optional: if specified `path' "
"is the\n"
" logfile on which the installation log is "
"written.\n"
" selection can be\n"
" x, to install all components,\n"
" or a combination of:\n"
" a (additional documentation),\n"
" b (binary program),\n"
" d (standard documentation),\n"
" m (man-pages)\n"
" s (skeleton files)\n"
" u (user guide)\n"
" uninstall logfile - remove files and empty directories listed\n"
" in the file 'logfile'\n"
" gitlab - prepare gitlab's web-pages update\n"
" (internal use only)\n"
"\n"
);
exit(0);
}
bisonc++-6.09.01/changelog 0000664 0001750 0001750 00000233345 14773773556 014174 0 ustar frank frank bisonc++ (6.09.01)
* Specifying %token-path now also works in combination with the
%target-directory directive (or option)
* scanner/lex.cc checks for non-empty d_matched strings when calling
d_matched.back() (required when using g++ >= 15.0.0).
* The usage info now also mentions the token options.
-- Frank B. Brokken Thu, 27 Mar 2025 19:03:48 +0100
bisonc++ (6.09.00)
* The manual shows the GPL V 3 (conditions for using bisonc++) which is now
included in the source distribution (the file ./LICENCE).
* End-of-line comment used in %polymorphic %type specifications is now
ignored.
-- Frank B. Brokken Thu, 16 May 2024 09:21:26 +0200
bisonc++ (6.08.00)
* The check for non-empty rules by the %prec directive was too strict.
It now checks whether the rule's rhs is empty (cf. rules/rules.f:
Rules::empty()).
-- Frank B. Brokken Sun, 24 Mar 2024 12:23:03 +0100
bisonc++ (6.07.00)
* 6.07 is only used by Debian.
-- Frank B. Brokken Fri, 01 Mar 2024 11:03:44 +0100
bisonc++ (6.06.00)
* The %prec directive requires a non-empty grammar rule.
* When using %polymorphic the Tag_ enum defines a last tag END_TAG_, and the
parserbase.h declares the (empty) class EndPolyType_. END_TAG_ and
EndPolyType_ are used by the default constructor of the Meta_::SType
class, avoiding undefined SType objects that caused segmentation faults
when the %prec directive was used in an empty grammar rule.
* States having SR and/or RR conflicts now count 1 SR conflict when multiple
LA-tokens are removed from the same production rule, and count 1 RR
conflict when an earlier rule is kept, dropping one or more later rules.
However, when RR conflicts are observed, Bisonc++ will report which rules
are dropped from which states.
-- Frank B. Brokken Sun, 15 Oct 2023 09:41:02 +0200
bisonc++ (6.05.00)
* Changed 'typedef' declarations into 'using' declarations, also in
generated parsers
* Updated the documentation accordingly
* Removed the superfluous flag -pthread from INSTALL.im
-- Frank B. Brokken Thu, 23 Mar 2023 10:01:08 +0100
bisonc++ (6.04.05)
* Ready for libbobcat6
* Added 'c++std' defining the c++ standard to use for
compilation. Compilation commands also use -Werror
* Repaired errors caused by warnings and -Werror
-- Frank B. Brokken Sun, 11 Sep 2022 13:06:55 +0200
bisonc++ (6.04.04)
* Removed -q from bisonc++'s build script
-- Frank B. Brokken Sat, 26 Jun 2021 14:52:47 +0200
bisonc++ (6.04.03)
* Added the descriptions of the %token-class, %token-namespace, and
%token-path directives to the bisonc++input(7) man-page.
-- Frank B. Brokken Thu, 18 Mar 2021 13:50:44 +0100
bisonc++ (6.04.02)
* Bisonc++'s lexical scanner was generated by flexc++ 2.09.00
* The .tar.gz extensions were removed from the man-pages' last lines.
-- Frank B. Brokken Sun, 21 Feb 2021 13:35:41 +0100
bisonc++ (6.04.01)
* Bisonc++'s lexical scanner was generated by flexc++ 2.08.00
-- Frank B. Brokken Fri, 13 Nov 2020 10:43:27 +0100
bisonc++ (6.04.00)
* Added options and directives 'token-class', 'token-namespace', and
'token-path' creating a 'Tokens' class containing the symbolic tokens of
the generated grammar on a separate file. Starting with this release
bisonc++'s own source files refer to the file parser/tokens.h, and its
Scanner class now refers to Tokens::tokenName instead of
Parser::tokenName.
* The manual and man-pages were updated accordingly.
* Updated icmake/findall in line with the icmake(1) man-page
-- Frank B. Brokken Fri, 21 Mar 2020 15:19:20 +0100
bisonc++ (6.03.00)
* Polymorphic assignment member functions are explicitly implemented instead
of using generic template functions. This allows the compiler to perform
implicit conversions. E.g., when using template assignment operators and a
polymorphic type INT -> int is defined then the assignment $$ = 'a' is not
compiled. But if the assignment operators are separately defined for each
of the polymorphic types the compiler performs the char -> int conversion
and the assignment is compiled.
* Fixed a flaw in the overview of bisonc++ options: -L by default uses the
bisonc++polymorphic.code skeleton, -M by default uses the
bisonc++polymorphic skeleton.
-- Frank B. Brokken Thu, 13 Jun 2019 12:32:16 +0200
bisonc++ (6.02.05)
* To avoid type conversion ambiguities when comparing StateTypes flags
operator& was defined for two StateType values (skeletons/bisonc++.cc)
-- Frank B. Brokken Fri, 01 Mar 2019 15:45:01 +0100
bisonc++ (6.02.04)
* The function print() (skeletons/bisonc++.ih; also in generated parser.ih
files) no longer calls print_(). The function print_() displays tokens if
the --print-tokens option is specified. However, if that option is
specified print_() is already called from nextToken_ in parse.cc.
-- Frank B. Brokken Mon, 21 Jan 2019 10:37:30 +0100
bisonc++ (6.02.03)
* Fixed an off-by-one line error reported by Alex Es.
* Added #define GNU to INSTALL.im to select either g++ or clang++ (->
clang++-7). Using g++ by default.
* Several source files received minor changes to prevent clang++ warnings.
* Added the directory iuo/ to contain files which are only internally used.
(currently containing module.modulemap)
-- Frank B. Brokken Sat, 10 Nov 2018 13:11:47 +0100
bisonc++ (6.02.02)
* [[fallthrough]] requires a final semicolon (cf. C++ std 20, 10.6.5).
Bisonc++'s internal and generated code is fixed accordingly.
* Andreas Beckmann noticed two dangling symlinks below the
bisonc++-doc/demos directory: fixed in this release. The files
documentation/man/calculator/scanner/lexer and
documentation/regression/calculator/scanner/lexer are now copies instead
of one being a symlink to the other
-- Frank B. Brokken Wed, 03 Oct 2018 21:39:50 +0200
bisonc++ (6.02.01)
* Migrated Bisonc++ from Github to Gitlab.
-- Frank B. Brokken Sat, 16 Jun 2018 07:22:42 +0200
bisonc++ (6.02.00)
* Starting with version 6.02.00 bisonc++ reserved identifiers no longer end
in two underscore characters, but in one. This modification was necessary
because according to the C++ standard identifiers having two or more
consecutive underscore characters are reserved by the language. In
practice this could require some minor modifications of existing source
files using bisonc++'s facilities, most likely limited to changing
Tokens__ into Tokens_ and changing Meta__ into Meta_.
The complete list of affected names is:
Enums: DebugMode_, ErrorRecovery_, Return_, Tag_, Tokens_;
Enum values: PARSE_ABORT_, PARSE_ACCEPT_, UNEXPECTED_TOKEN_, sizeofTag_;
Type / namespace designators: Meta_, PI_, STYPE_;
Member functions: clearin_, errorRecovery_, errorVerbose_, executeAction_,
lex_, lookup_, nextCycle_, nextToken_, popToken_, pop_, print_,
pushToken_, push_, recovery_, redoToken_, reduce_, savedToken_,
shift_, stackSize_, startRecovery_, state_, token_, top_, vs_,
Protected data members: d_acceptedTokens_, d_actionCases_, d_debug_,
d_nErrors_, d_requiredTokens_, d_val_, idOfTag_, s_nErrors_
-- Frank B. Brokken Tue, 15 May 2018 20:58:45 +0200
bisonc++ (6.01.03)
* To avoid lintian reports about missing examples the 'examples/'
directories were renamed to 'demos/'
-- Frank B. Brokken Thu, 08 Mar 2018 21:00:12 +0100
bisonc++ (6.01.02)
* Added C++-17 attributes [[maybe_notused]] to bisonc++'s code, and removed
unused parameters unless required.
-- Frank B. Brokken Thu, 08 Mar 2018 20:16:50 +0100
bisonc++ (6.01.01)
* Fixed a missing destination for the link to the sources of the rpn
calculator mentioned in Ch. 6 of the user manual.
-- Frank B. Brokken Tue, 23 Jan 2018 12:59:39 +0100
bisonc++ (6.01.00)
* Removed std:: in front of thread_local in generated code
* Removed definitions of the Yodl tr-macro from .yo files: it is a
predefined macro in Yodl 4.02.00, and is not used in de documentation.
-- Frank B. Brokken Sat, 20 Jan 2018 11:40:25 +0100
bisonc++ (6.00.00)
* The generated code was rewritten. The protected interface of ParserBase
and names of parse()-related members in Parser was modified. The names of
all accessible members in parserbase.h and parser.h now have two trailing
underscore characters.
Predefined members in parser.ih no longer have trailing underscores, and
can be redefined.
The traditional error(char const *) member in fact never uses its argument
(and bisonc++ only passed 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__();
---------------------------
removed:
---------------------------
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.
* Added a warning to skeleton/binsonc++.h that until the #undef instruction
Parser will be read as ParserBase.
* With Polymorphic semantic values a tag mismatch is no considered fatal
anymore if errors were already encountered. In that case the semantic
value showing a tag mismatch is replaced by the default value of the
semantic value of the expected polymorphic type.
* Compilation of bisonc++ now starts with the construction of precompiled
headers, significantly reducing the compilation time.
* The state stack elements now consist of two values: the first
element holds the state index, the second element the semantic value.
* Added option and directive 'prompt': 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. Previously it
could only be specified as option.
* Documentation was updated to reflect the above modifications
* The build script now properly recognizes the 'strip' option
* By default precompiled headers are used. The option -P (cf. log entry
'bisonc++ (4.12.03)' below) is now opertational.
Be advised that using -P removes all existing .ih.gch files from the
directory containing 'main.ih' and from all its immediate subdirectories.
* Removed the compiler option --std=c++14, since that's by now the default.
-- Frank B. Brokken Thu, 18 May 2017 09:46:19 +0200
bisonc++ (5.03.00)
* Added a declaration like 'Parser() = default' to the generated parser
class header file.
* Added an item about existing constructors and how to add additional
constructors to parser classes generated by bisonc++
* Corrected 'see also' references in the man-pages.
-- Frank B. Brokken Sat, 28 Jan 2017 15:12:16 +0100
bisonc++ (5.02.02)
* Updated the description of the %prec directive.
-- Frank B. Brokken Tue, 24 May 2016 16:33:48 +0530
bisonc++ (5.02.01)
* Repaired an error in 'build install LOG...'.
* Verified that 'selection' in 'build install selection' was correctly
specified.
-- Frank B. Brokken Wed, 18 May 2016 17:34:28 +0530
bisonc++ (5.02.00)
* The polymorphic semantic values implementation uses a unique_ptr when
transferring semantic values inside the geerated parser (including
bisonc++'s own parser). See the documentation for details.
* Added new option/directive stack-expansion defining the number of elements
to add to a completely full semantic value stack.
* Enlarging the semantic value stack does not require copying existing
semantic values to the enlarged semantic value stack. Either resizing is
used (when the capacity allows it) or the stored semantic values are moved
to the enlarged stack, which is then swapped with the parser's semantic
values stack.
* More in general: the generated parser itself does not internally copy
semantic values anymore. Copying is only used in the grammar's action
blocks .
-- Frank B. Brokken Fri, 13 May 2016 13:46:18 +0530
bisonc++ (5.01.00)
* Reimplemented polymorphic semantic values: the Meta__::Base class now is
a virtual bease class.
* Some templated operator& functions cannot handle two DebugMode__
arguments. To prevent compilation errors in those cases a
DebugMode__ operator&(DebugMode__, DebugMode__) function was added to
the parserbase-skeleton.
* The documentation erroneously referred to an undefined --action-cases
option. Instead, --debug should be used and setDebug(Parser::ACTIONCASES)
should be called. Code and documentation modified accordingly.
* Added the script documentation/regression/runone to run a single
regression test.
-- Frank B. Brokken Thu, 05 May 2016 20:35:39 +0530
bisonc++ (5.00.01)
* Fixed verbinsert calls: yodl 3.07.01 implements a macro 'verbinsert'
rendering bisonc++'s own definition superfluous. The new definition
requires 1 argument, and the old one 2, so the verbinsert calls were
updated accordingly.
* Alexander Sedov noticed that line numbers in the default actions were
incorrect. Line numbers of default actions are now set to the line of the
'|' or ';' character following the production rule receiving a default
action block.
* Updated the 'required' file.
-- Frank B. Brokken Mon, 25 Apr 2016 15:47:27 +0530
bisonc++ (5.00.00)
* Options/directives:
The default `default-actions std' option/directive unconditionally adds $$
= $1 action blocks to non-empty production rules w/o final action blocks
Added option/directive tag-mismatches. and option
--polymorphic-code-skeleton (-L).
The formerly available option --no-default-action-return was renamed to
default-actions (-d replacing -N), and can now also be used as a
directive: %default-actions.
Option --polymorphic-inline-skeleton (-m) is not used anymore and was
removed.
The option --include-only has been dropped (although it was mentioned in
the usage info, it had in fact not been available for quite some time).
* Implementation:
Reimplemented handling polymorphic semantic values. shared pointers are no
longer used. Details: see README.polymorphic-technical and parser/data.cc
Type specifications in %type directives are verified. With %union the
check is a simple check whether '\btype\b' is found in the %union spec.
Mismatches between the types of nonterminals and the types of the first
elements of their production rules previously resulted in a `type clash of
default action' warning. Such mismatches are now considered errors.
After parsing a grammar file only plain warning messages (i.e., without
file/line info) are issued. Switching to such plain message is now done in
Parser::cleanup, and no longer in various members of objects being used
after calling Parser::cleanup().
Comment (to end-of-line and C-style) can now also be used in polymorphic
type specifications.
Renamed the top-level bisonc++.cc and bisonc++.ih files to main.cc and
main.ih, respectively.
Using new lexical scanner, built by Flexc++ V2.04.00.
* Grammar files:
New dollar-notations ($$(...), _$$, _$i) are available, $$,
$i are not available anymore.
* API:
New member: setDebug(DebugMode__), shows the action case
just before executing the action block.
The SType::data() member is now obsolete and has been removed.
The semantic value type STYPE__ (the class Meta__::SType) member `valid()
const' returns true if its member tag() returns a valid Tag__, otherwise
it returns false. False is returned for default constructed STYPE__
values. Previous implementations of STYPE__ implemented an undocumented
member pointer (->) operator for calling get() and data(). This operator
is no longer available. Instead of -> the member selector operator (.)
should be used. E.g., stype.get().
The member SType::emplace (See the 4.13.00 log entry) was renamed to
SType::assign: it doesn't emplace, but assign. The construction
$$(-optional arguments-); can be used in action blocks to do
$$.emplace(-optional arguments-);
* Documentation:
Bisonc++'s man-page and manual was updated.
Added new man-pages bisonc++input.7, describing the organization of
bisonc++'s grammar file(s), and bisonc++api.3, describing the API of the
software generated by bisonc++
* Regression tests:
The extensive calculator regression test declared a RuleValue(unsigned)
constructor, but implemented a RuleValue(size_t) constructor, which does
not compile on amd64 architectures. The regression test was modified by
changing the constructor's size_t parameter type into unsigned.
All regression test grammar files contain the directive
%default-actions quiet
preventing warning messages about adding default $$ = $1 action blocks to
production rules without action blocks.
-- Frank B. Brokken Wed, 13 Apr 2016 11:03:54 +0530
bisonc++ (4.13.01)
* slightly modified the icmake build scripts to prevent multiple inclusions
of some of the installed files.
-- Frank B. Brokken Fri, 18 Dec 2015 13:41:08 +0100
bisonc++ (4.13.00)
* 'build install' supports an optional LOG: argument: the (relative or
absolute) path to a installation log file. The environment variable
BISONCPP is no longer used.
* Updated the usage info displayed by `./build', altered the procedure to
install the files at their final destinations.
* Following a suggestion made by gendx the polymorphic class Semantic now
defines a variadic template constructor, allowing Semantic objects
(and thus SType::emplace) to be initialized (c.q. called) using any set of
argument types that are supported by Semantic's DataType. Also, the
(internally used) classes HasDefault and NoDefault are now superfluous and
were removed (from skeletons/bisonc++polymorphic and
skeletons/bisonc++polymorphic.inline).
* Adapted the icmake build files to icmake 8.00.04
-- Frank B. Brokken Sun, 13 Dec 2015 16:29:41 +0100
bisonc++ (4.12.03)
* Kevin Brodsky observed that the installation scripts used 'chdir' rather
than 'cd'. Fixed in this release.
* Kevin Brodsky also observed that the combined size of all precompiled
headers might exceed some disks capacities. The option -P was added to the
./build script to prevent the use of precompiled headers.
-- Frank B. Brokken Mon, 05 Oct 2015 20:17:56 +0200
bisonc++ (4.12.02)
* Refined the 'build uninstall' procedure
-- Frank B. Brokken Sun, 04 Oct 2015 16:27:18 +0200
bisonc++ (4.12.01)
* The implementation of the ./build script was improved.
-- Frank B. Brokken Thu, 01 Oct 2015 18:41:45 +0200
bisonc++ (4.12.00)
* Added 'build uninstall'. This command only works if, when calling one of
the 'build install' alternatives and when calling 'build uninstall' the
environment variable BISONCPP contains the (preferably absolute) filename
of a file on which installed files and directories are logged.
Note that 'build (dist)clean' does not remove the file pointed at by the
BISONCPP environment variable, unless that file happpens to be in a
directory removed by 'build (dist)clean'. See also the file INSTALL.
Defining the BISONCPP environment variable as ~/.bisoncpp usually works
well.
* Guillaume Endignoux offered several valuable suggestions:
- Classes may not have default constructors, but may still be used if
the default $$ = $1 action is not used. This can now be controlled using
option --no-default-action-return (-N). When this option is specified
the default $$ = $1 assignment of semantic values when returning from an
action block isn't provided. When this option is specified then Bisonc++
generates a warning for typed rules (non-terminals) whose action blocks
do not provide an explicit $$ return value.
- To assign a value to $$ a member `emplace' is provided, expecting the
arguments of the type represented by $$.
- In cases where a $x.get() cannot return a reference to a
value matching tt(Tag::NAME) and the associated type does not provide a
default constructor this function throws an exception reporting
STYPE::get: no default constructor available
* Bisonc++'s documentation about using polymorphic values was modified, in
particular the information about how the various polymorphic values can
be assigned and retrieved.
-- Frank B. Brokken Tue, 29 Sep 2015 11:48:18 +0200
bisonc++ (4.11.00)
* Cleanup of the manual, in particular how lexical scanners can access the
various values of polymorphic semantic value types (cf. section
`Polymorphism and multiple semantic values'). The man-page was modified
accordingly.
* The manual-stamp file is no longer used. Calling 'build manual' now always
(re)builds the manual. The same holds true for 'build man'.
* The in version 4.08.00 removed const members were reinstalled, as they are
required in situations where, e.g., a function defines an STYPE__ const *
parameter.
* Added 'build uninstall'. This command only works if, when calling one of
the 'build install' alternatives and when calling 'build uninstall' the
environment variable BISONCPP contains the (preferably absolute) filename
of a file on which installed files and directories are logged.
Note that 'build (dist)clean' does not remove the file pointed at by the
BISONCPP environment variable, unless that file happpens to be in a
directory removed by 'build (dist)clean'. See also the file INSTALL.
Defining the BISONCPP environment variable as ~/.bisoncpp usually works
well.
* The INSTALL file was updated to the current state of affairs.
* Removed the file parser/reader, which contained code generated by
bison. It was nowhere used and I simply couldn't see why it was added to
the parser's directory at all.
* Removed the file 'distribution' from this directory's parent directory. It
is not used, and was superseded by the file sourcetar (both files are
Internal Use Only).
* Removed the file documentation/bison.ps.org/bison.ps.gz: it harbored an
compression error (already at the very first bisonc++ release), and the
bison documentation in html format remains part of the bisonc++
distribution.
-- Frank B. Brokken Sun, 30 Aug 2015 11:13:57 +0200
bisonc++ (4.10.01)
* Production rules of non-terminal symbols that immediately follow dot
positions of existing items are added as new (implied) items to that
state's set of items. The --construction option no longer shows the
indices of such newly added items as this information can easily be
obtained from the provided construction output.
-- Frank B. Brokken Sun, 17 May 2015 16:54:13 +0200
bisonc++ (4.10.00)
* FOLLOW sets are not used when analyzing LALR(1) grammars. The class
FollowSet and all operations on follow sets were removed.
* The LA set computation algorithm was reimplemented, a description of the
new algorithm is included in the manual and in several source files, in
particular state/determinelasets.cc. Both the state items' LA computation
and the LA propagation algorithms were completely reimplemented.
* Rules causing conflicts (i.e., conflict remaining after processing %left,
%right, %nonassoc and/or %expect) as wel as the involved LA characters re
briefly mentioned immediately following the SR/RR conflict-counts.
* The class Symtab now uses an unordered_map rather than a mere (ordered)
map.
* The class-dependency diagram (README.class-setup) was updated to reflect
the latest changes. Same for the file CLASSES which is used by the build
script.
* Added the file `required' listing the non-standard software that is
required to build bisonc++ and its user guide / man-page
-- Frank B. Brokken Sun, 17 May 2015 13:13:55 +0200
bisonc++ (4.09.02)
* Wilko Kuiper reported an annoying bug in the skeleton lex.in, causing the
compilation of parser.hh to fail. This release fixes that bug.
-- Frank B. Brokken Mon, 28 Jul 2014 16:46:35 +0200
bisonc++ (4.09.01)
* $#$#@ !! Forgot to update the help-info (bisonc++ --help) to reflect the
new -D option. Now fixed.
-- Frank B. Brokken Sun, 11 May 2014 09:05:48 +0200
bisonc++ (4.09.00)
* Added option --no-decoration (-D), suppressing the actions that are
normally associated with matched rules.
-- Frank B. Brokken Sat, 10 May 2014 11:58:46 +0200
bisonc++ (4.08.01)
* Members of the class `Generator' generating a substantial amount of code
now read skeleton files instead of strings which are defined in these
functions' bodies.
* Added new skeleton files for the abovementioned functions. The names of
these skeleton files are identical to the matching filenames in
generator/, but use extensions `.in'
-- Frank B. Brokken Mon, 31 Mar 2014 11:45:41 +0200
bisonc++ (4.08.00)
* std::shared_ptr doesn't slice: virtual ~Base() and dynamic_casts removed
from the generated parserbase.h files
* %polymorphicimpl removed from skeleton/bisonc++, matching files from
Generator
* The implementation of polymorphic semantic values was simplified. Const
members were removed from polymorphic semantic value classes; ReturnType
get() const and ReturnType data() const are no longer
required and were removed.
-- Frank B. Brokken Sun, 02 Mar 2014 11:51:38 +0100
bisonc++ (4.07.02)
* Changed 'class SType into struct SType in skeletons/polymorphic, since all
its members are public anyway.
* Class header and class implementation header files are no longer
overwritten at bisonc++ runs.
* Running './build program' no longer by default uses -g (see INSTALL.im)
-- Frank B. Brokken Mon, 17 Feb 2014 13:43:16 +0100
bisonc++ (4.07.01)
* Fixed segfaults (encountered with 4.07.00) caused by for-statement range
specification errors.
-- Frank B. Brokken Sun, 16 Feb 2014 15:46:45 +0100
bisonc++ (4.07.00)
* Generating files is prevented when errors in option/declaration
specifications are encountered. All errors in option/declaration
specifications (instead of just the first error that is encountered)
are now reported.
-- Frank B. Brokken Fri, 14 Feb 2014 14:53:33 +0100
bisonc++ (4.06.00)
* Repaired buggy handling of some options/directives
* Prevented spurious option warnings sometimes generated when options aren't
specified
* Action blocks associated with rules may contain raw string literals.
-- Frank B. Brokken Sun, 09 Feb 2014 11:31:14 +0100
bisonc++ (4.05.00)
* Added the directive %scanner-class-name specifying the class name of the
scanner to use in combination with the %scanner directive
* re-installed the --namespace option (see the next item)
* Warnings are issued when options or directives are specified wchich are
ignored because the target file (e.g., parser.h, parser.hh) already
exists. These warnings are not issued for parse.cc and parserbase.h, which
are by default rewritten at each bisonc++ run. These warnings are issued
for the `class-header', `class-name', `baseclass-header', `namespace',
`scanner', `scanner-class-name' and `scanner-token-function'
options/directives.
* The --force-class-header and --force-implementation-header options were
removed: 'rm ...' should be used instead.
* man-page and manual updated
* CLASSES class dependencies updated, icmconf's USE_ALL activated
-- Frank B. Brokken Sat, 10 Aug 2013 10:16:17 +0200
bisonc++ (4.04.01)
* Removed the possibility to specify path names for the --baseclass-header,
--class-header, --implementation-header, and --parsefun-source options
(and corresponding directives). Path names for generated files should be
specified using the target-directory option or directive.
-- Frank B. Brokken Mon, 27 May 2013 12:12:58 +0200
bisonc++ (4.04.00)
* Repaired %target-directory not recognizing path-characters and not
removing surrounding "-delimiters.
* The --baseclass-header, --class-header, --implementation-header, and
--parsefun-source options (and corresponding directives) now also accept
path-specifications.
* The man-page and manual have been updated accordingly.
-- Frank B. Brokken Sun, 26 May 2013 14:22:50 +0200
bisonc++ (4.03.00)
* Bisonc++ before 4.03.00 failed to notice the --debug option. Now repaired.
* Added the rpn example to the manual, and repaired typos in the manual.
* Options/directives that can only accept file names (like
--baseclass-header) no longer accept path names.
-- Frank B. Brokken Sun, 31 Mar 2013 11:25:49 +0200
bisonc++ (4.02.01)
* Parser-class header files (e.g., Parser.h) and parser-class internal
header files (e.g., Parser.hh) generated with bisonc++ < 4.02.00 require
two hand-modifications when used in combination with bisonc++ >= 4.02.00:
In Parser.h, just below the declaration
void print__();
add:
void exceptionHandler__(std::exception const &exc);
In Parser.hh, assuming the name of the generated class is `Parser', add
the following member definition (if a namespace is used: within the
namespace's scope):
inline void Parser::exceptionHandler__(std::exception const &exc)
{
throw; // re-implement to handle exceptions thrown by actions
}
This function may be re-implemented, see the man-page for further details.
-- Frank B. Brokken Mon, 11 Mar 2013 16:50:26 +0100
bisonc++ (4.02.00)
* Added member Parser::exceptionHandler(std::exception const &exc), handling
std::exceptions thrown from the parser's action blocks.
* The --namespace option was removed, since it does not affect once
generated parser.h files, resulting in inconsistent namespace
definitions.
* Include guards of parser.h and parserbase.h include the namespace
identifier, if %namespace has been used.
* Provided print()'s implementation in bisonc++.hh with a correct
class-prifix (was a fixed Parser::)
* Textual corrections of the man-page and manual.
-- Frank B. Brokken Thu, 07 Mar 2013 09:57:07 +0100
bisonc++ (4.01.02)
* Bisonc++ returns 0 for options --help and --version
* Catching Errno exceptions is replaced by catching std::exception
exceptions
-- Frank B. Brokken Thu, 24 Jan 2013 08:14:59 +0100
bisonc++ (4.01.01)
* The following #defines in INSTALL.im can be overruled by defining
identically named environment variables:
CXX defines the name of the compiler to use. By default `g++'
CXXFLAGS the options passed to the compiler.
By default `-Wall --std=c++0x -O2 -g'
LDFLAGS the options passed to the linker. By default no options are
passed to the linker.
SKEL the directory where the skeletons are stored
-- Frank B. Brokken Sun, 15 Jul 2012 14:44:46 +0200
bisonc++ (4.01.00)
* Repaired a long-existing bug due to which some S/R conflicts are solved by
a reduce, where a shift should have been used. See
README.states-and-conflicts for details.
* Removed line-numbers from final warning/error messages
* This version requires Bobcat >= 3.00.00
-- Frank B. Brokken Thu, 03 May 2012 21:21:47 +0200
bisonc++ (4.00.00)
* Implemented the %polymorphic directive. Bisonc++ itself uses %polymorphic
to implement its own polymorphic semantic values; man-page and manual
extended with sections about polymorphic semantic values.
* Implemented the %weak-tags directive. By default %polymorphic declares
an `enum class Tag__', resulting in strongly typed polymorphic tags. If
the traditional tag declaration is preferred, the %weak-tags directive can
be specified in addition to %polymorphic, resulting in the declaration
`enum Tag__'.
* The previously used class spSemBase and derivatives (e.g., SemBase,
Semantic) are now obsolete and the directories sembase and spsembase
implementing these classes were removed.
* The Parser's inline functions are all private and were moved to the
parser's .hh file. This doesn't affect current implementations, as
parser.h and parser.hh are only generated once, but newly generated
parsers no longer define the Parser's inline members (error, print__, and
lex) in parser.h but in parser.hh
* @@ can be used (instead of d_loc__) to refer to a rule's location stack
value.
* The generated parser now uses unordered_maps instead of maps.
-- Frank B. Brokken Fri, 13 Apr 2012 14:10:12 +0200
bisonc++ (3.01.00)
* The `%print-tokens' directive was accidentally omitted from
3.00.00. Repaired in this release.
* Starting this release all release tags (using names that are identical to
the version number, so for this release the tag is 3.01.00) are signed to
allow authentication.
-- Frank B. Brokken Mon, 27 Feb 2012 13:33:20 +0100
bisonc++ (3.00.00)
* This release's scanner was built by flexc++
* Option handling was separated from parsing, following the method also used
in flexc++: a class Options holds and maintains directives and options
that are used in multiple points in bisonc++'s sources. The Parser passes
directive specifications to set-functions defined by the class Options.
* The parser's semantic value handling recevied a complete overhaul. Unions
are no longer used; instead a light-weight polymorphic base class in
combination with some template meta programming was used to handle the
semantic values. See sembase/sembase.h for a description of the appproach.
* Options and directives were rationalized/standardized. See the man-page
for details. Grammar specification files should no longer use %print, but
should either use %print-tokens or %own-tokens (or the equivalent
command-line options).
* NOTE: Existing Parser class interfaces (i.e. parser.h) must be
(hand-) modified by declaring a private member
void print__();
See the man-page and/or manual for details about print__.
* All regression tests (in documentation/regression) are now expecting
that flexc++ (>= 0.93.00) is available.
-- Frank B. Brokken Mon, 20 Feb 2012 16:32:01 +0100
bisonc++ (2.09.04)
* Replaced many for_each calls and lamda functions by range-based for-loops
* Used g++-4.7
-- Frank B. Brokken Wed, 04 Jan 2012 12:26:01 +0100
bisonc++ (2.09.03)
* Replaced all FnWrap* calls by lambda function calls
* `build' script now recognizes CXXFLAGS and LDFLAGS for, resp. g++ and ld
flags. Default values are set in INSTALL.im, as before.
-- Frank B. Brokken Thu, 23 Jun 2011 10:06:02 +0200
bisonc++ (2.09.02)
* Repaired flaws that emerged with g++ 4.6
-- Frank B. Brokken Mon, 02 May 2011 16:30:43 +0200
bisonc++ (2.9.1)
* Documentation requires >= Yodl 3.00.0
-- Frank B. Brokken Wed, 10 Nov 2010 10:30:51 +0100
bisonc++ (2.9.0)
* Changed Errno::what() call to Errno::why()
* Removed dependencies on Msg, using Mstreams and Errno::open
instead. Consequently, bisonc++ depends on at least Bobcat 2.9.0
-- Frank B. Brokken Sat, 30 Oct 2010 22:05:30 +0200
bisonc++ (2.8.0)
* Grammars having states consisting of items in which a reduction from a
(series of) non-terminals is indicated have automatically a higher
precedence than items in which a shift is required. Therefore, in these
cases the shift/reduce conflict is solved by a reduce, rather than a
shift. See README.states-and-conflicts, srconflict/visitreduction.cc and
the Bisonc++ manual, section 'Rule precedence' for examples and further
information. These grammars are now showing S/R conflicts, which remained
undetected in earlier versions of Bisonc++. The example was brought to my
attention by Ramanand Mandayam (thanks, Ramanand!).
* To the set of regression tests another test was added containing a grammar
having two S/R conflicts resulting from automatically selecting reductions
rather than shifts. This test was named 'mandayam'.
* Output generated by --verbose and --construction now shows in more detail
how S/R conflicts are handled. The Bisonc++ manual also received an
additional section explaining when reduces are used with certain S/R
conflicts.
* Previously the documentation stated that --construction writes the
construction process to stdout, whereas it is written to the same file as
used by --verbose. This is now repaired.
* The meaning/use of the data members of all classes are now described at
the data members in all the classes' header files.
-- Frank B. Brokken Sun, 08 Aug 2010 15:15:46 +0200
bisonc++ (2.7.0)
* $-characters appearing in strings or character constants in action blocks
no longer cause warnings about incorrect or negative $-indices
* Repaired incorrect interpretation of '{' and '}' character constants
in action blocks.
* Added option --print (directive %print) displaying tokens received by the
scanner used by the generated parser.
* Added option --scanner-token-function (directive %scanner-token-function)
specifying the name of the function called from the generated parser's
lex() function.
* The build script received an additional option: `build parser' can be used
to force the reconstruction of parser/parse.cc and parser/parserbase.h
-- Frank B. Brokken Wed, 31 Mar 2010 15:54:52 +0200
bisonc++ (2.6.0)
* Reorganized Bisonc++'s classes: public inheritance changed to private
where possible, all virtual members now private. The parser->parserbase
inheritance remains as-is (public) because parserbase essentially is a
element of parser, defining types and the token-enum that must also be
available to the users of the generated parser class. The alternative,
defining types and tokens in the parser class would make it impossible to
adapt the tokens without rewriting the parser class. Another alternative,
defining the types and enum in a separate namespace imposes further
restrictions on the users of the parser class, which is also considered
undesirable. Public inheritance is now only used by NonTerminal, Terminal,
and Symbol as these classes override virtual functions either in Symbol or
in Element and the derived classes must all be usable where their base
classes are expected (in accordance with the LSP).
bisonc++ (2.5.1)
* Token values written to parserbase.h are (again) suppressed when their
values exceed the previous token's value by 1. All values were shown
because writer/insertToken erroneously didn't receive a size_t
&lastTokenValue anymore, but a size_t lastTokenValue.
* Removed Terminal's operator<< from the namespace std
* Now using initializer_lists to initialize static data (generator/data.cc
main.cc)
-- Frank B. Brokken Mon, 08 Mar 2010 20:51:22 +0100
bisonc++ (2.5.0)
* Renamed parser/spec/aux to parser/spec/auxiliary to avoid file/device
confusion on some systems
* Removed inclusions of superfluous bobcat/fnwrap1c headers
* Replaced all FnWrap1c calls by FnWrap::unary
* Added check for d_currentRule == 0 in rules/addproduction. d_currentRule
could be a 0-pointer, in which case addproduction shouldn't do anything.
d_currentRule is a 0-pointer in, e.g. the erroneous grammar submitted
by Justin Madru about which he rightfully remarked that even though
erroneous bisonc++ shouldn't crash on it. This is his stripped-down
grammar:
%token X x_list
%%
x_list:
x_list X
|
X
;
bisonc++ (2.4.8)
* Recompilation using option --std=c++0x, required because of Bobcat's use
of C++0x syntax.
-- Frank B. Brokken Sat, 05 Sep 2009 17:25:56 +0200
bisonc++ (2.4.7)
* Streams processed by an `#include' directive were not properly closed,
resulting in a memory leak. The Scanner's code was modified to plug that
leak.
-- Frank B. Brokken Wed, 06 May 2009 09:36:02 +0200
bisonc++ (2.4.6)
* Changed the build script to allow finer control over construction and
installation of parts of the package
-- Frank B. Brokken Tue, 24 Mar 2009 19:16:10 +0100
bisonc++ (2.4.5)
* DateTime (generator/filter.cc) adapted due to change of Bobcat's DateTime
interface
bisonc++ (2.4.4)
* typed terminal tokens (as used in, e.g., %type) were not
included in the parserbase's Tokens__ enum since their symbol type is left
at UNDETERMINED. tokens used in type lists can also be non-terminals, in
which case their symbol type is changed accordingly. In 2.4.4. a symbol is
selected for inclusion in the Tokens__ enum if it's a terminal token but
also if it's a symbol that has been used in the grammar although its
symbol type is left at UNDETERMINED (in generator/selectsymbolic.cc)
bisonc++ (2.4.3)
* repaired segfault generated when the name of a non-existing file was
passed to bisonc++
bisonc++ (2.4.2)
* scanner/yylex.cc removed from the distribution: flex will create a new
Scanner::yylex() member at each new distribution to prevent
incompatibilities between earlier yylex.cc and later FlexLexer.h files.
bisonc++ (2.4.1)
* Implemented minor changes related to requirements imposed upon the code by
g++ 4.3.
* Generator/filter now uses the Datetime::rfc2822(), implmented since Bobcat
1.17.1
bisonc++ (2.4.0)
* Fixed missing entry in multiple reduction state tables:
State tables of multiple reduction states (e.g., REQ_RED states) were
constructed incompletely. E.g., for the grammar:
expr:
name
|
ident '(' ')'
|
NR
;
name:
IDENT
;
ident:
IDENT
;
the state following IDENT is either a reduce to 'name' or 'ident': the
corresponding table was filled incompletely, using the number of the next
token where the next token for the reduction should have been be
mentioned, and an empty field in the table itself.
NOTE that in these situations d_val__ MUST be set by the scanner, as the
reduction requires another token, and only once that token is available
the reduction to, e.g., 'ident' can be performed, but at that time
YYText() has already gone and is inaccessible in an action block like:
ident:
IDENT
{
$$ = d_scanner.YYText();
}
;
* The error recovery procedure in skeleton's bisonc++.cc skeleton file was
reimplemented. As a side effect the internally used function
'ParserBase::checkEOF()' could be removed.
* #line directives in rule action blocks now correctly identify the grammar
specification file in which the action block was defined.
* Extra empty line at the end of state transition tables were removed
* Files generated by Bisonc++ report Bisonc++'s version and the file
construction time (conform RFC 2822) as C++ comment in their first line.
bisonc++ (2.3.1)
* Fixed character returned in escaped constants. E.g., at '\'' the \ was
returned instead of the ' character.
* Implemented the default assignment of $1 to $$ at the begin of action
rules. This required another Block member: saveDollar1(), called for
nested blocks. The function saveDollar1() prepends the code to save $$
from $1 of the rule in which the nested block was defined. In
share/bisonc++ the function executeAction() no longer saves the semantic
value's TOS value as d_val__ but the rule's $1 value.
* To allow extraction of the archive under Cygwin (Windows) the directory
parser/spec/aux was renamed to parser/spec/auxiliary (as Windows can't
handle files or directories named 'aux').
bisonc++ (2.3.0)
* Dallas A. Clement uncovered a bug in handling semantic values, due to
which semantic values of tokens returned by some grammars got lost. He
intended to use a polymorphic semantic value class to pass different kinds
of semantic values over from the scanner to the parser. This approach was
the foundation of another regression test example, now added to the set of
regression tests and described in Bisonc++'s manual. It will also appear
as an annotated example in the C++ Annotations. Thanks, Dallas, for
uncovering and reporting that bug.
* Dallas also noted that mid-rule actions could not refer to semantic values
of rule components that had already been seen by Bisonc++. This has been
fixed in this release. Dallas, thanks again!
* Earlier versions of Bisonc++ used the class OM (Output Mode) to define the
way objects like (Non)Terminal tokens and (Non)Kernel Items were inserted
into ostreams. Using OM did not result in the clarity of design I
originally had in mind. OM is now removed, and instead relevant classes
support a function `inserter()' allowing sources to specify (passing
`inserter()' a pointer to a member function) what kind of insertion they
need. For the Terminal class there is also a manipulator allowing sources
to insert a insertion-member directly into the ostream.
* New option: --insert-stype
The generated parser will now also display semantic values when %debug is
specified if the new command-line option --insert-stype is provided. Of
course, in this case users should make sure that the semantic value is
actually insertable (e.g., by providing an overloaded operator
std::ostream &std::operator<<(std::ostream &out, STYPE__ const &semVal).
bisonc++ (2.2.0)
* Repaired a bug in parsing action blocks of rules appearing only in
versions 2.1.0 and 2.0.0. In these versions compound statements defined
within the action blocks result in bisonc++ erroneously reporting an error
caused by bisonc++'s scanner (scanner/lexer) interpreting the closing
curly brace as the end of the action block.
* Repaired a flaw in terminal/terminal1.cc causing a segfault when using
bisonc++ compiled with g++ 4.2.1
bisonc++ (2.1.0)
* In the skeleton bisonc++.cc $insert 4 staticdata is followed by $insert
namespace-open. Since `staticdata' defined s_out if %debug is requested,
it could be defined outside of the user's namespace (defined by
%namespace). Repaired by defining s_out after (if applicable) opening the
namespace (in Generator::namespaceOpen(), called from $insert
namespace-open).
bisonc++ (2.0.0)
* Rebuilt Bisonc++'s parser and scanner, creating Bisonc++'s parser from the
file parser/grammar. Initially Bisonc++ 1.6.1 was used to create the
Parser class header and parsing function. Once Bisonc++ 2.0.0 was
available, the grammar file was split into various subfiles (see below)
and Bisonc++ 2.0.0 was used to implement its own parsing function. As a
direct consequence of using a grammar rather than a hand-implemented
parsing function quite a few members of the Parser and Scanner class were
reimplemented, new members were added and some could be removed. Parts of
other classes (Rules, Block) were significantly modified as well.
* Minor hand-modifications may be necessary with previously designed code
using identifiers that are defined by the parser class generated by
Bisonc++. The following names have changed:
-------------------------------------------------------------------------
old name change into new name: Protected
-------------------------------------------------------------------------
Parser::LTYPE Parser::LTYPE__
Parser::STYPE Parser::STYPE__
Parser::Tokens Parser::Tokens__
Parser::DEFAULT_RECOVERY_MODE Parser::DEFAULT_RECOVERY_MODE__ Yes
Parser::ErrorRecovery Parser::ErrorRecovery__ Yes
Parser::Return Parser::Return__ Yes
Parser::UNEXPECTED_TOKEN Parser::UNEXPECTED_TOKEN__ Yes
Parser::d_debug Parser::d_debug__ Yes
Parser::d_loc Parser::d_loc__ Yes
Parser::d_lsp Parser::d_lsp__ Yes
Parser::d_nErrors Parser::d_nErrors__ Yes
Parser::d_nextToken Parser::d_nextToken__ Yes
Parser::d_state Parser::d_state__ Yes
Parser::d_token Parser::d_token__ Yes
Parser::d_val Parser::d_val__ Yes
Parser::d_vsp Parser::d_vsp__ Yes
-------------------------------------------------------------------------
The symbols marked `Protected' can only occur in classes that were derived
from the parser class generated by Bisonc++. Unless you derived a class
from the parser class generated by Bisonc++ these changes should not
affect your code. The first three symbols may have been used in other
classes as well (for an example now using LTYPE__ and STYPE__ see the file
documentation/regression/location/scanner/scanner.h).
Note that the only required modification in all these cases is to append
two underscores to the previously defined identifiers.
* The grammar file may now be split into several grammar specification
files. The directive %include may be specified to include grammar files
into other grammar files (much like the way C/C++'s #include preprocessor
directive operates). Starting point of the grammar recognized by Bisonc++
2.0.0 is the file parser/grammar, using subfiles in the parser/spec
directory. The file README.parser documents the grammar specification
files in some detail.
* Previous releases implicitly enforced several restrictions on the
identifiers used for the grammar's tokens. These restrictions resulted
from name collisions with names defined in the parser's base class. While
the restrictions cannot be completely resolved without giving up backward
compatibility, they can be relieved greatly. Tokens cannot be ABORT,
ACCEPT, ERROR, clearin, debug, error and setDebug. Furthermore, tokens
should not end in two underscores (__).
* Implemented various new options and directives:
- the option --analyze-only, merely analyzing the provided grammar, not
writing any source or header files.
- the option --error-verbose as well as the directive %error-verbose
dumping the state-stack when a syntactic error is reported.
- the option --include-only, catenating all grammar files in their order
of processing to the standard output stream (and terminating).
- the option --max-inclusion-depth, defining the maximum number of nested
grammar files (default: 10).
- the option --required-tokens (also available as the directive
%required-tokens). Error recovery is now configurable in the sense that
a configurable number of tokens must have been successfully processed
before new error messages can be generated (see
documentation/manual/error/intro.yo)
- the option --scanner-debug writing the contents and locations (in
scanner/lexer) of matched regular expresions as well as the names/values
of returned tokens to the standard error stream.
- the option --skeleton-directory. This option overrides the default
location of the director containing the skeleton files. In turn it is
overridden by the options specifying specific skeleton files (e.g.,
--baseclass-skeleton).
- the option --thread-safe. If specified, Bisonc++ will generate code that
is thread-safe. I.e., no static data will be modified by the parse()
function. As a consequence, all static data in the file containing the
parse() function are defined as const. Manpage and manual adapted
accordingly.
* As a convenience, filenames in the grammar files may optionally be
surrounded by double quotes ("...") or pointed brackets <...>. Delimiting
pointed brackets are only kept with the %scanner and %baseclass-preinclude
directives, in all other cases they are replaced by double quotes and a
warning is displayed.
* Token Handling in the generated parsing member function was improved: the
share/bisonc++.cc skeleton now defines pushToken__() and popToken__() as
the standard interface to the tiny two-element token stack. The member
nextToken() was redesigned.
* Documentation was extended and updated. The Bisonc++ manual now contains an
extensive description of the grammar-analysis process as implemented in
Bisonc++ (see documentation/manual/algorith.yo). All new options and
directives, as well as the token-name requirements are covered by the
man-page and by the manual.
* Various other repairs and cosmetic changes:
- The --construction option as implemented in Bisonc++ 1.6.1 showed the
FIRST set where the FOLLOW set was labeled. Repaired: now the FOLLOW set
is actually displayed.
- The --show-filenames option now shows `(not requested)' as default for
d_verboseName instead of `-' if no --verbose was requested.
- The --construction option no longer displays the `LA expanded' value
from the state's descriptions since it's always 0
- The --class-name option was not actually mentioned in the set of
recognized long options: repaired.
- The %type directive now allows you to specify semantic type associations
of terminal tokens as well.
- The %token, %left, %right and %nonassoc directives now all use the same
syntax (as they always should have). These directives all define
terminal tokens
- Added `rebuild' command to the `build' script to recreate the parser
bisonc++ (1.6.1)
* Changed the error recovery procedure preventing stack underflows with
unrecoverable input errors.
* Added protected parser base class member checkEOF(), terminating the
parse() member's activities (man-page adapted accordingly).
* Changed small support member functions in the share/bisonc++.cc skeleton
file into inline members, some were moved to share/bisonc++base.h
* The skeleton files now use `\@' as baseclass-flag rather than `@'. The
baseclass-flag is now defined as a static data member in Generator. This
change prevents the `@' in e-mail addresses from being changed into the
parser's class name.
* Removed the class Support since it is now covered by Bobcat's (1.15.0)
default implementation of FBB::TableSupport
bisonc++ (1.6.0)
* NOTE: THE PROTOTYPE OF THE PARSER'S lookup() FUNCTION CHANGED. IT IS NOW:
int lookup(bool recovery);
OLD parser.h HEADER FILES CAN BE REUSED AFTER ADDING THE PARAMETER
bool recovery
* Segfaults were caused by some grammars due to an erroneous index in
(formerly state/setitems.cc) state/adddependents.cc, where idx,
representing an index in d_itemVector was used to index an element in
d_nextVector (for which the index variable `nextIdx' should have been
used. Repaired.
* For some unknown reason, priority and association rules were not
implemented in earlier versions of bisonc++. Consequently priority and
association values of rules were left at their default values. This was
repaired by defining the function Rules::updatePrecedences(), which
defines priorities of productions as either their values assigned by a
%prec specification or as the priority of their first terminal token.
* The accepting State no longer has default reductions. It doesn't need them
since EOF__ in those states terminates the parser. Accepting States
now have search sentinels, allowing the parser to do proper error
recovery.
* The implementation of the shift/reduce algorithm and error handling in
share/bisonc++.cc was modified, now using bitflags indicating
state-requirements (e.g., requiring a token, having a default reduction,
having an `error' continuation, etc.). Also, the functions nextToken() and
lookup() were reimplemented.
* The share/bisonc++.cc parser function skeleton's initial comment was
improved.
* The function state/state1.cc contained the superfluous intialization
d_itemVector(0). The line has been removed.
* The class `Rules' lacked facilities to detect properly whether a grammar
file without rules was specified. Solved by defining a Rules constructor
and an additional member indicating whether there weree any rules at all.
* In grammar files, rules must now be terminated by a semicolon. Previous
versions did not explicitly check this. Also, improperly formed
character-tokens are now recognized as errors.
* In correspondence with bison, the default verbose grammar output file is
now called .output rather than .output
* The description of the State information shown when --construction is
specified was clarified.
* The debug output generated by parse.cc was improved.
* The setDebug() member is now a public member. Manual page and
documentation changed accordingly.
* The description of the setItems() algorithm in state/setItems was
improved.
* The `build' script was given an additional command (installprog) to
install just the program and the skeletons.
* Added several missing headers fixing gcc/g++ 4.3 problems
-- Frank B. Brokken Mon, 09 Apr 2007 14:54:46 +0200
bisonc++ (1.5.3)
* Using Bobcat's FnWrap* classes instead of Bobcat's Wrap* classes
* The INSTALL.im file has received a (by default commented out)
#define PROFILE. By activating this define, bisonc++ is compiled with
support for the gprof profiler. This define should not be activated for
production versions of bisonc++
* Not released.
-- Frank B. Brokken Sat, 17 Feb 2007 20:44:19 +0100
bisonc++ (1.5.2)
* It turns out that the modification in 1.5.1. is not necessary. The
compilation problems mentioned there were the result of a presumed small
g++ compiler bug. A workaround is implemented in Bobcat 1.12.1, preventing
the bug from occurring. In fact, this release has the same contents as
release 1.5.0. Release 1.5.1. can be considered obsolete. It is available
from the svn repository only.
-- Frank B. Brokken Thu, 30 Nov 2006 17:05:09 +0100
bisonc++ (1.5.1)
* Building the usage support program failed because of implied dependencies
on the bobcat library, resulting from superfluously including bobcat.h in
the documentation/usage/usage.cc program source. This is solved by
setting bisonc++.h's include guard identifier just before inserting
../../usage.cc in the documentation/usage/usage.cc program source.
bisonc++ (1.5.0)
* The algorithms for lookahead propagation and detection of grammars not
deriving sentences have been redesigned and rewritten. The previously used
algorithm propagating lookaheads suffered from spurious reduce/reduce
conflicts for some grammars (e.g., see the one in
documentation/regression/icmake1). Also, 1.4.0 choked on a (fairly)
complex grammar like the one used by icmake V 7.00. These problems are now
solved, and comparable problems should no longer occur.
The layout and organization of the output has been changed as well. Now
there are basically three forms of verbose output: No verbose output, in
which the file *.output is not written, standard verbose output, in which
an overview of the essential parts of the grammar is written to the file
*.output, and --construction, in which case all lookaheadsets, as well as
the first and follow sets are written to *.output.
Multiple new classes were added, and some previously existing classes were
removed. See the file README.class-setup and the file CLASSES for details.
The man-page and manual were adapted on minor points.
bisonc++ (1.4.0)
* It turned out that in the previous versions, S/R conflicts were also
produced for empty default reductions. Now detectSR() checks whether there
is one empty reduction. If so, no S/R conflicts are possible in that
state. Instead a SHIFT (which is already the default solution of a S/R
conflict) is performed in these situations. So, now for all
tokens for which a known continuation state exist the known continuation
state is selected; for all other tokens the default reduction (reducing to
its associated state) is selected. See state/detectsr.cc for details.
Since the above change also represents a change of algorithm, the
subversion was incremented. I added a sub-subversion to have a separate
level of version-numbers for minor modifications.
The documentation/regression/run script did not properly return to its
initial working directory, and it called a test that no longer
existed. Both errors have been repaired.
Some leftover references to the Academic Free License were replaced by
references to the GPL.
The previously used scripts below make/ are obsolete and were removed from
this and future distributions. Icmake should be used instead, for which a
top-level script (build) and support scripts in the ./icmake/ directory
are available. Icmake is available on a great many architectures. See the
file INSTALL (and INSTALL.im, replacing the previously used INSTALL.cf)
for further details.
All plain `unsigned' variables were changed to `size_t'
bisonc++ (1.03-1) unstable; urgency=low
* License changed to the GNU GENERAL PUBLIC LICENSE. See the file
`copyright'.
According to the manual page, the debug-output generated by parsers
created using the --debug option should be user-controllable through the
`setDebug()' member. These feature is now actually implemented.
The usage info now correctly shows the -V flag as a synonym for the
--verbose option.
From now on this file will contain the `upstream' changes. The Debian
related changes are in changelog.Debian.gz
-- Frank B. Brokken Wed, 19 Jul 2006 13:12:39 +0200
bisonc++ (1.02) unstable; urgency=low
* Following suggestions made by George Danchev, this version was compiled by
the unstable's g++ compiler (version >= 4.1), which unveiled several flaws
in the library's class header files. These flaws were removed (i.e.,
repaired).
In order to facilitate compiler selection, the compiler to use is defined
in the INSTALL.cf file.
The debian control-files (i.e., all files under the debian subdirectory)
were removed from the source distribution, which is now also named in
accordance with the Debian policy. A diff.gz file was added.
-- Frank B. Brokken Thu, 6 Jul 2006 12:41:43 +0200
bisonc++ (1.01) unstable; urgency=low
* Synchronized the version back to numbers-only, adapted the debian
standards and the required bobcat library in the debian/control file.
No implementation changes as compared to the previous version, but I felt
the need to join various sub-sub-versions back to just one standard
version.
-- Frank B. Brokken Mon, 26 Jun 2006 12:11:15 +0200
bisonc++ (1.00a) unstable; urgency=low
* Debian's Linda and lintian errors, warnings and notes processed. No
messages are generated by linda and lintian in this version.
-- Frank B. Brokken Sun, 28 May 2006 14:26:03 +0200
bisonc++ (1.00) unstable; urgency=low
* Bisonc++ Version 1.00 has changed markedly as compared to its predecessor,
bisonc++ 0.98.510.
The main reason for upgrading to 1.00 following a year of testing the 0.98
series is that the grammar analysis and lookahead propagation algorithms
as used in bisonc++ 0.98.510 were either too cumbersome and contained some
unfortunate errors.
The errors were discovered during my 2005-2006 C++ class, where some
students produced grammars which were simple, but were incorrectly
analyzed by bisonc++ 0.98. It turned out that the lookahead (LA)
propagation contained several flaws. Furthermore, a plain and simple bug
assigned the last-used priority to terminal tokens appearing literally in
the grammar (i.e., without explicitly defining them in a %token or
comparable directive). A simple, but potentially very confusing bug.
At the cosmetic level, the information produced with the --construction
option was modified, aiming at better legibility of the construction
process.
The `examples' directory was reduced in size, moving most examples to a
new directory `regression', which now contains a script `run' that can be
used to try each of the examples below the `regression' directory. Some of
the examples call `bison', so in order to run those examples `bison' must
be installed as well. It usually is.
A minor backward IN-compatibility results from a change in prototype of
some private parser member functions. This should only affect exising
Parser.h header files. Simply replacing the `support functions for
parse()' section shown at the end of the header file by the following
lines should make your header file up-to-date again. Note that bisonc++
does not by itself rewrite Parser.h to prevent undoing any modifications
you may have implemented in the parser-class header file:
// support functions for parse():
void executeAction(int ruleNr);
void errorRecovery();
int lookup();
void nextToken();
Please note that this version depends on bobcat 1.7.1 or beyond. If you
compile bobcat yourself, then you may want to know that bobcat's Milter
and Xpointer classes are not used by bisonc++, so they could optionally be
left out of bobcat's compilation.
-- Frank B. Brokken Sun, 7 May 2006 15:10:05 +0200
bisonc++ (0.98.510) unstable; urgency=low
* When no %union has been declared, no $$ warnings are issued anymore about
non-exisiting types;
When no %union has been declared a $i or $$ warning is issued
about non-exisiting types.
The State table (in the generated parse.cc file) containing `PARSE_ACCEPT'
was created with a `REDUCE' indication for grammars whose start symbol's
production rules were non-repetitive. This was repaired in
state/writestatearray.cc by setting the (positive) non-reduce indication
for states using shifts and/or the accept state.
The logic in writeStateArray() was modifed: a separate ShiftReduce::Status
variable is now used to store the possible actions: SHIFT, REDUCE or
ACCEPT. The tables show `SHIFTS' if a state uses shifts; `ACCEPTS' if a
state contains PARSE_ACCEPT; and `REDUCE' otherwise.
-- Frank B. Brokken Tue, 21 Mar 2006 20:47:49 +0100
bisonc++ (0.98.500) unstable; urgency=low
* Handling of $i and $$ repaired, added the
%negative-dollar-indices directive.
$ specifications were not properly parsed. Instead of $i or
$$ constructions like $i and $$ were parsed, which is
contrary to the manual's specification. The function parsing the $-values
is defined in parser/handledollar.cc.
The handling of negative $-indices is improved. Negative $-indices are
used when synthesizing attributes. In that context, $0 is useful, since it
refers to the nonterminal matched before the current rule is starting to
be used, allowing rules like `vardef: typename varlist ' where `varlist'
inherits the type specification defined at `typename'.
In most situations indices are positive. Therefore bisonc++ will warn when
zero or non-positive $-indices are seen. The %negative-dollar-indices
directive may be used to suppress these warnings.
$-indices exceeding the number of elements continue to cause an error.
-- Frank B. Brokken Sun, 5 Mar 2006 13:59:08 +0100
bisonc++ (0.98.402) unstable; urgency=low
* links against bobcat 1.6.0, using bobcat's new Arg:: interface
-- Frank B. Brokken Mon, 26 Dec 2005 19:25:42 +0100
bisonc++ (0.98.400) unstable; urgency=low
* state/writestatearray.cc adds {} around individual union values to allow
warningless compilation of the generated parse.cc file by g++-4.0.
bisonc++ is now itself too compiled by g++-4.0.
-- Frank B. Brokken Fri, 18 Nov 2005 22:46:06 +0100
bisonc++ (0.98.007) unstable; urgency=low
* Added a README.flex file giving some background information about the
provided implementation of the lexical scanner (bisonc++/scanner/yylex.cc)
Modified the compilation scripts: bisconc++/flex/FlexLexer.h is now
included by default. This FlexLexer.h file is expected by
bisonc++/scanner/yylex.cc and by the Scanner class.
Simplified some compilation scripts.
-- Frank B. Brokken Fri, 9 Sep 2005 11:42:24 +0200
bisonc++ (0.98.006) unstable; urgency=low
* Removed the dependency on `icmake'. No change of functionality
See the instructions in the `INSTALL' file when you want to compile and
install `bisonc++' yourself, rather than using the binary (.deb)
distribution.
-- Frank B. Brokken Sat, 3 Sep 2005 17:42:29 +0200
bisonc++ (0.98.005) unstable; urgency=low
* Removed the classes Arg, Errno, Msg and Wrap1, using the Bobcat library's
versions of these classes from now on. No feature-changes.
Added minor modifications to the `build' script.
Annoying Error: The function `ItemSets::deriveAction()' did not recognize
the `ACCEPT' action, so some (most ?) grammars could not be properly
recognized. I applied a quick hack: if an action isn't `shift' or
`reduce', it can be `accept', resulting in acceptance of the grammar. This
solves the actual problem, but I'll have to insepct this in a bit more
detail. For now, it should work ok.
-- Frank B. Brokken Mon, 22 Aug 2005 13:05:28 +0200
bisonc++ (0.98.004) unstable; urgency=low
* When new lookahead set elements are added to existing states,
d_recheckState in itemsets/lookaheads.cc (ItemSets::checkLookaheads()) was
reassigned to the state index whose lookaheadset was enlarged. However, if
that happened for existing state `i' and then, during the same
state-inspection, for state `j' where j > i, then the recheck would start
at `j' rather than `i'. This problem was solved by giving d_recheckState
only a lower value than its current value.
With R/R conflicts involving `ACCEPT' reductions (with, e.g., `S_$: S .'),
ACCEPT is selected as the chosen alternative. See State::setReduce()
(state/setreduce.cc). Since this matches with the `first reduction rule'
principle, it should be ok.
%stype specifications may consist of multiple elements: the remainder of
the line beyond %stype is interpreted as the type definition. The
specification should (therefore) not contain comment or other characters
that are not part of the actual type definition. The man-page is adapted
accordingly. Same holds true for the %ltype directive
Added a check whether the grammar derives a sentence
(itemsets/derivesentence.cc). If not, a fatal error is issued. This
happens at the end of the program's actions, and at this point files
etc. have already been generated. They are kept rather than removed for
further reference. Grammars not deriving sentences should probably not be
used.
The original Bison documentation has been converted to a Bisonc++ user
guide. Furthermore, a html-converted manual page is now available under
/usr/share/doc/bisonc++/man
The `calculator' example used in the man-page is now under
/usr/share/doc/bisonc++/man/calculator
Bisonc++ is distributed under the Academic Free License, see the file
COPYING in /usr/share/doc/bisonc++
-- Frank B. Brokken Sun, 7 Aug 2005 13:49:07 +0200
bisonc++ (0.98.003) unstable; urgency=low
* Incomplete default State constructor now explicitly defined, prevents
the incidental erroneous rapporting of conflicts for some states.
-- Frank B. Brokken Thu, 26 May 2005 07:21:20 +0200
bisonc++ (0.98.002) unstable; urgency=low
* The Wrap1 configurable unary predicate template class replaces various
other templates (WrapStatic, Wrap, Pred1Wrap). No further usage or
implementation changes/modifications.
-- Frank B. Brokken Sun, 22 May 2005 15:27:19 +0200
bisonc++ (0.98.001) unstable; urgency=low
* This is a complete rewrite of the former bisonc++ (0.91) version. The
program bisonc++ is now a C++ program, producing C++ sources, using the
algorithm for creating LALR-1 grammars as outlined by Aho, Sethi and
Ullman's (1986) `Dragon' book. The release number will remain 0.98 for a
while, and 0.98.001 holds the initial package, new style. Also see the
man-page, since some things have been changed (augmented) since the
previous version. No dramatic changes in the grammar specification method:
Bisonc++ still uses bison's way to specify grammars, but some features,
already obsolete in bisonc++ 0.91 were removed.
Also note my e-mail address: the U. of Groningen's official policy now is
to remove department specific information, so it's `@rug.nl' rather than
`@rc.rug.nl', as used before.
-- Frank B. Brokken Mon, 16 May 2005 13:39:38 +0200
bisonc++ (0.91) unstable; urgency=low
* Added several missing short options (like -B etc) to the getopt() function
call. I forgot to add them to the previous version(s). Internally, all old
C style allocations were changed to C++ style allocations, using operators
new and delete. Where it was immediately obvious that a vector could be
used, I now use vectors. The internally used types `core' `shifts' and
'reductions' (types.h) now use a vector data member rather than an int [1]
member, which is then allocated to its proper (I may hope) size when the
structs are allocated.
-- Frank B. Brokken Sat, 19 Feb 2005 10:21:58 +0100
bisonc++ (0.90) unstable; urgency=low
* Command-line options now override matching declarations specified in the
grammar specification file.
All %define declarations have been removed. Instead their first arguments
are now used to specify declarations. E.g., %parser-skeleton instead of
%define parser-skeleton.
All declarations use lower-case letters, and use only separating hyphens,
no underscores. E.g., %lsp-needed rather than %define LSP_NEEDED
The declaration %class-name replaces the former %name declaration
All yy and YY name prefixes of symbols defined by bisonc++ have been
removed. The parser-state `yydefault' has been renamed to `defaultstate'.
-- Frank B. Brokken Sun, 6 Feb 2005 12:50:40 +0100
bisonc++ (0.82) unstable; urgency=low
* Added d_nError as protected data member to the base class. Missed it
during the initial conversion. d_nErrors counts the number of parsing
errors. Replaces yynerrs from bison(++)
-- Frank B. Brokken Sat, 29 Jan 2005 18:58:24 +0100
bisonc++ (0.81) unstable; urgency=low
* Added the option --show-files to display the names of the files that are
used or generated by bisonc++.
-- Frank B. Brokken Fri, 28 Jan 2005 14:50:48 +0100
bisonc++ (0.80) unstable; urgency=low
* Completed the initial debian release. No changes in the software.
-- Frank B. Brokken Fri, 28 Jan 2005 14:30:05 +0100
bisonc++ (0.70-1) unstable; urgency=low
* Initial Release.
-- Frank B. Brokken Thu, 27 Jan 2005 22:34:50 +0100
bisonc++-6.09.01/CLASSES 0000664 0001750 0001750 00000002272 14700504612 013302 0 ustar frank frank atdollar //
block // atdollar
//
element //
firstset // element
symbol // firstset
terminal // symbol
//
production // block terminal
//
nonterminal // production
//
symtab // nonterminal
rules // nonterminal
//
grammar // rules
//
lookaheadset // grammar
//
item // lookaheadset
rrdata // lookaheadset
//
rmreduction //
rmshift //
//
stateitem // item rrdata rmshift rmreduction
//
rrconflict // stateitem
//
enumsolution //
statetype //
//
next // enumsolution statetype stateitem
//
srconflict // next
//
state // srconflict rrconflict
//
writer // state
//
options //
//
scanner // block options
//
generator // writer options
//
parser // scanner rules symtab
bisonc++-6.09.01/CLASSES.bobcat 0000664 0001750 0001750 00000000132 14700504612 014524 0 ustar frank frank align
arg
datetime
exception
indent
mstream
pattern
ranger
stat
string
table
tablesupport
bisonc++-6.09.01/c++std.OBS 0000664 0001750 0001750 00000000036 14700504612 013706 0 ustar frank frank #define CPPSTD "--std=c++20"
bisonc++-6.09.01/documentation/ 0000775 0001750 0001750 00000000000 14700504612 015130 5 ustar frank frank bisonc++-6.09.01/documentation/html/ 0000775 0001750 0001750 00000000000 14700504612 016074 5 ustar frank frank bisonc++-6.09.01/documentation/html/bison_6.html 0000664 0001750 0001750 00000231065 14700504612 020330 0 ustar frank frank
Bison 2.21.5: Grammar File
The C declarations section contains macro definitions and
declarations of functions and variables that are used in the actions in the
grammar rules. These are copied to the beginning of the parser file so
that they precede the definition of yyparse. You can use
`#include' to get the declarations from a header file. If you don't
need any C declarations, you may omit the `%{' and `%}'
delimiters that bracket this section.
The Bison declarations section contains declarations that define
terminal and nonterminal symbols, specify precedence, and so on.
In some simple grammars you may not need any declarations.
See section Bison Declarations.
The grammar rules section contains one or more Bison grammar
rules, and nothing else. See section Syntax of Grammar Rules.
There must always be at least one grammar rule, and the first
`%%' (which precedes the grammar rules) may never be omitted even
if it is the first thing in the file.
The additional C code section is copied verbatim to the end of
the parser file, just as the C declarations section is copied to
the beginning. This is the most convenient place to put anything
that you want to have in the parser file but which need not come before
the definition of yyparse. For example, the definitions of
yylex and yyerror often go here. See section Parser C-Language Interface.
If the last section is empty, you may omit the `%%' that separates it
from the grammar rules.
The Bison parser itself contains many static variables whose names start
with `yy' and many macros whose names start with `YY'. It is a
good idea to avoid using any such names (except those documented in this
manual) in the additional C code section of the grammar file.
Symbols in Bison grammars represent the grammatical classifications
of the language.
A terminal symbol (also known as a token type) represents a
class of syntactically equivalent tokens. You use the symbol in grammar
rules to mean that a token in that class is allowed. The symbol is
represented in the Bison parser by a numeric code, and the yylex
function returns a token type code to indicate what kind of token has been
read. You don't need to know what the code value is; you can use the
symbol to stand for it.
A nonterminal symbol stands for a class of syntactically equivalent
groupings. The symbol name is used in writing grammar rules. By convention,
it should be all lower case.
Symbol names can contain letters, digits (not at the beginning),
underscores and periods. Periods make sense only in nonterminals.
There are three ways of writing terminal symbols in the grammar:
A named token type is written with an identifier, like an
identifier in C. By convention, it should be all upper case. Each
such name must be defined with a Bison declaration such as
%token. See section Token Type Names.
A character token type (or literal character token) is
written in the grammar using the same syntax used in C for character
constants; for example, '+' is a character token type. A
character token type doesn't need to be declared unless you need to
specify its semantic value data type (see section Data Types of Semantic Values), associativity, or precedence (see section Operator Precedence).
By convention, a character token type is used only to represent a
token that consists of that particular character. Thus, the token
type '+' is used to represent the character `+' as a
token. Nothing enforces this convention, but if you depart from it,
your program will confuse other readers.
All the usual escape sequences used in character literals in C can be
used in Bison as well, but you must not use the null character as a
character literal because its ASCII code, zero, is the code yylex
returns for end-of-input (see section Calling Convention for yylex).
A literal string token is written like a C string constant; for
example, "<=" is a literal string token. A literal string token
doesn't need to be declared unless you need to specify its semantic
value data type (see section 3.5.1 Data Types of Semantic Values), associativity, precedence
(see section 5.3 Operator Precedence).
You can associate the literal string token with a symbolic name as an
alias, using the %token declaration (see section Token Declarations). If you don't do that, the lexical analyzer has to
retrieve the token number for the literal string token from the
yytname table (see section 4.2.1 Calling Convention for yylex).
WARNING: literal string tokens do not work in Yacc.
By convention, a literal string token is used only to represent a token
that consists of that particular string. Thus, you should use the token
type "<=" to represent the string `<=' as a token. Bison
does not enforces this convention, but if you depart from it, people who
read your program will be confused.
All the escape sequences used in string literals in C can be used in
Bison as well. A literal string token must contain two or more
characters; for a token containing just one character, use a character
token (see above).
How you choose to write a terminal symbol has no effect on its
grammatical meaning. That depends only on where it appears in rules and
on when the parser function returns that symbol.
The value returned by yylex is always one of the terminal symbols
(or 0 for end-of-input). Whichever way you write the token type in the
grammar rules, you write it the same way in the definition of yylex.
The numeric code for a character token type is simply the ASCII code for
the character, so yylex can use the identical character constant to
generate the requisite code. Each named token type becomes a C macro in
the parser file, so yylex can use the name to stand for the code.
(This is why periods don't make sense in terminal symbols.)
See section Calling Convention for yylex.
If yylex is defined in a separate file, you need to arrange for the
token-type macro definitions to be available there. Use the `-d'
option when you run Bison, so that it will write these macro definitions
into a separate header file `name.tab.h' which you can include
in the other source files that need it. See section Invoking Bison.
The symbol error is a terminal symbol reserved for error recovery
(see section 6. Error Recovery); you shouldn't use it for any other purpose.
In particular, yylex should never return this value.
A Bison grammar rule has the following general form:
result: components...
;
where result is the nonterminal symbol that this rule describes
and components are various terminal and nonterminal symbols that
are put together by this rule (see section 3.2 Symbols, Terminal and Nonterminal).
For example,
exp: exp '+' exp
;
says that two groupings of type exp, with a `+' token in between,
can be combined into a larger grouping of type exp.
Whitespace in rules is significant only to separate symbols. You can add
extra whitespace as you wish.
Scattered among the components can be actions that determine
the semantics of the rule. An action looks like this:
{C statements}
Usually there is only one action and it follows the components.
See section 3.5.3 Actions.
Multiple rules for the same result can be written separately or can
be joined with the vertical-bar character `|' as follows:
They are still considered distinct rules even when joined in this way.
If components in a rule is empty, it means that result can
match the empty string. For example, here is how to define a
comma-separated sequence of zero or more exp groupings:
A rule is called recursive when its result nonterminal appears
also on its right hand side. Nearly all Bison grammars need to use
recursion, because that is the only way to define a sequence of any number
of somethings. Consider this recursive definition of a comma-separated
sequence of one or more expressions:
expseq1: exp
| expseq1 ',' exp
;
Since the recursive use of expseq1 is the leftmost symbol in the
right hand side, we call this left recursion. By contrast, here
the same construct is defined using right recursion:
expseq1: exp
| exp ',' expseq1
;
Any kind of sequence can be defined using either left recursion or
right recursion, but you should always use left recursion, because it
can parse a sequence of any number of elements with bounded stack
space. Right recursion uses up space on the Bison stack in proportion
to the number of elements in the sequence, because all the elements
must be shifted onto the stack before the rule can be applied even
once. See section The Bison Parser Algorithm , for
further explanation of this.
Indirect or mutual recursion occurs when the result of the
rule does not appear directly on its right hand side, but does appear
in rules for other nonterminals which do appear on its right hand
side.
The grammar rules for a language determine only the syntax. The semantics
are determined by the semantic values associated with various tokens and
groupings, and by the actions taken when various groupings are recognized.
For example, the calculator calculates properly because the value
associated with each expression is the proper number; it adds properly
because the action for the grouping `x + y' is to add
the numbers associated with x and y.
In a simple program it may be sufficient to use the same data type for
the semantic values of all language constructs. This was true in the
RPN and infix calculator examples (see section Reverse Polish Notation Calculator).
Bison's default is to use type int for all semantic values. To
specify some other type, define YYSTYPE as a macro, like this:
#define YYSTYPE double
This macro definition must go in the C declarations section of the grammar
file (see section Outline of a Bison Grammar).
In most programs, you will need different data types for different kinds
of tokens and groupings. For example, a numeric constant may need type
int or long, while a string constant needs type char *,
and an identifier might need a pointer to an entry in the symbol table.
To use more than one data type for semantic values in one parser, Bison
requires you to do two things:
Specify the entire collection of possible data types, with the
%union Bison declaration (see section The Collection of Value Types).
Choose one of those types for each symbol (terminal or nonterminal)
for which semantic values are used. This is done for tokens with the
%token Bison declaration (see section Token Type Names) and for groupings
with the %type Bison declaration (see section Nonterminal Symbols).
An action accompanies a syntactic rule and contains C code to be executed
each time an instance of that rule is recognized. The task of most actions
is to compute a semantic value for the grouping built by the rule from the
semantic values associated with tokens or smaller groupings.
An action consists of C statements surrounded by braces, much like a
compound statement in C. It can be placed at any position in the rule; it
is executed at that position. Most rules have just one action at the end
of the rule, following all the components. Actions in the middle of a rule
are tricky and used only for special purposes (see section Actions in Mid-Rule).
The C code in an action can refer to the semantic values of the components
matched by the rule with the construct $n, which stands for
the value of the nth component. The semantic value for the grouping
being constructed is $$. (Bison translates both of these constructs
into array element references when it copies the actions into the parser
file.)
Here is a typical example:
exp: ...
| exp '+' exp
{ $$ = $1 + $3; }
This rule constructs an exp from two smaller exp groupings
connected by a plus-sign token. In the action, $1 and $3
refer to the semantic values of the two component exp groupings,
which are the first and third symbols on the right hand side of the rule.
The sum is stored into $$ so that it becomes the semantic value of
the addition-expression just recognized by the rule. If there were a
useful semantic value associated with the `+' token, it could be
referred to as $2.
If you don't specify an action for a rule, Bison supplies a default:
$$ = $1. Thus, the value of the first symbol in the rule becomes
the value of the whole rule. Of course, the default rule is valid only
if the two data types match. There is no meaningful default action for
an empty rule; every empty rule must have an explicit action unless the
rule's value does not matter.
$n with n zero or negative is allowed for reference
to tokens and groupings on the stack before those that match the
current rule. This is a very risky practice, and to use it reliably
you must be certain of the context in which the rule is applied. Here
is a case in which you can use this reliably:
foo: expr bar '+' expr { ... }
| expr bar '-' expr { ... }
;
bar: /* empty */
{ previous_expr = $0; }
;
As long as bar is used only in the fashion shown here, $0
always refers to the expr which precedes bar in the
definition of foo.
If you have chosen a single data type for semantic values, the $$
and $n constructs always have that data type.
If you have used %union to specify a variety of data types, then you
must declare a choice among these types for each terminal or nonterminal
symbol that can have a semantic value. Then each time you use $$ or
$n, its data type is determined by which symbol it refers to
in the rule. In this example,
exp: ...
| exp '+' exp
{ $$ = $1 + $3; }
$1 and $3 refer to instances of exp, so they all
have the data type declared for the nonterminal symbol exp. If
$2 were used, it would have the data type declared for the
terminal symbol '+', whatever that might be.
Alternatively, you can specify the data type when you refer to the value,
by inserting `<type>' after the `$' at the beginning of the
reference. For example, if you have defined types as shown here:
%union {
int itype;
double dtype;
}
then you can write $<itype>1 to refer to the first subunit of the
rule as an integer, or $<dtype>1 to refer to it as a double.
Occasionally it is useful to put an action in the middle of a rule.
These actions are written just like usual end-of-rule actions, but they
are executed before the parser even recognizes the following components.
A mid-rule action may refer to the components preceding it using
$n, but it may not refer to subsequent components because
it is run before they are parsed.
The mid-rule action itself counts as one of the components of the rule.
This makes a difference when there is another action later in the same rule
(and usually there is another at the end): you have to count the actions
along with the symbols when working out which number n to use in
$n.
The mid-rule action can also have a semantic value. The action can set
its value with an assignment to $$, and actions later in the rule
can refer to the value using $n. Since there is no symbol
to name the action, there is no way to declare a data type for the value
in advance, so you must use the `$<...>' construct to specify a
data type each time you refer to this value.
There is no way to set the value of the entire rule with a mid-rule
action, because assignments to $$ do not have that effect. The
only way to set the value for the entire rule is with an ordinary action
at the end of the rule.
Here is an example from a hypothetical compiler, handling a let
statement that looks like `let (variable) statement' and
serves to create a variable named variable temporarily for the
duration of statement. To parse this construct, we must put
variable into the symbol table while statement is parsed, then
remove it afterward. Here is how it is done:
As soon as `let (variable)' has been recognized, the first
action is run. It saves a copy of the current semantic context (the
list of accessible variables) as its semantic value, using alternative
context in the data-type union. Then it calls
declare_variable to add the new variable to that list. Once the
first action is finished, the embedded statement stmt can be
parsed. Note that the mid-rule action is component number 5, so the
`stmt' is component number 6.
After the embedded statement is parsed, its semantic value becomes the
value of the entire let-statement. Then the semantic value from the
earlier action is used to restore the prior list of variables. This
removes the temporary let-variable from the list so that it won't
appear to exist while the rest of the program is parsed.
Taking action before a rule is completely recognized often leads to
conflicts since the parser must commit to a parse in order to execute the
action. For example, the following two rules, without mid-rule actions,
can coexist in a working parser because the parser can shift the open-brace
token and look at what follows before deciding whether there is a
declaration or not:
Now the parser is forced to decide whether to run the mid-rule action
when it has read no farther than the open-brace. In other words, it
must commit to using one rule or the other, without sufficient
information to do it correctly. (The open-brace token is what is called
the look-ahead token at this time, since the parser is still
deciding what to do about it. See section Look-Ahead Tokens.)
You might think that you could correct the problem by putting identical
actions into the two rules, like this:
But this does not help, because Bison does not realize that the two actions
are identical. (Bison never tries to understand the C code in an action.)
If the grammar is such that a declaration can be distinguished from a
statement by the first token (which is true in C), then one solution which
does work is to put the action after the open-brace, like this:
Now Bison can execute the action in the rule for subroutine without
deciding which rule for compound it will eventually use. Note that
the action is now at the end of its rule. Any mid-rule action can be
converted to an end-of-rule action in this way, and this is what Bison
actually does to implement mid-rule actions.
The Bison declarations section of a Bison grammar defines the symbols
used in formulating the grammar and the data types of semantic values.
See section 3.2 Symbols, Terminal and Nonterminal.
All token type names (but not single-character literal tokens such as
'+' and '*') must be declared. Nonterminal symbols must be
declared if you need to specify which data type to use for the semantic
value (see section More Than One Value Type).
The first rule in the file also specifies the start symbol, by default.
If you want some other symbol to be the start symbol, you must declare
it explicitly (see section Languages and Context-Free Grammars).
The basic way to declare a token type name (terminal symbol) is as follows:
%token name
Bison will convert this into a #define directive in
the parser, so that the function yylex (if it is in this file)
can use the name name to stand for this token type's code.
Alternatively, you can use %left, %right, or %nonassoc
instead of %token, if you wish to specify precedence.
See section Operator Precedence.
You can explicitly specify the numeric code for a token type by appending
an integer value in the field immediately following the token name:
%token NUM 300
It is generally best, however, to let Bison choose the numeric codes for
all token types. Bison will automatically select codes that don't conflict
with each other or with ASCII characters.
In the event that the stack type is a union, you must augment the
%token or other token declaration to include the data type
alternative delimited by angle-brackets (see section More Than One Value Type).
For example:
%union { /* define stack type */
double val;
symrec *tptr;
}
%token <val> NUM /* define token NUM and its type */
You can associate a literal string token with a token type name by
writing the literal string at the end of a %token
declaration which declares the name. For example:
%token arrow "=>"
For example, a grammar for the C language might specify these names with
equivalent literal string tokens:
%token <operator> OR "||"
%token <operator> LE 134 "<="
%left OR "<="
Once you equate the literal string and the token name, you can use them
interchangeably in further declarations or the grammar rules. The
yylex function can use the token name or the literal string to
obtain the token type code number (see section 4.2.1 Calling Convention for yylex).
Use the %left, %right or %nonassoc declaration to
declare a token and specify its precedence and associativity, all at
once. These are called precedence declarations.
See section Operator Precedence, for general information on operator precedence.
The syntax of a precedence declaration is the same as that of
%token: either
%left symbols...
or
%left <type> symbols...
And indeed any of these declarations serves the purposes of %token.
But in addition, they specify the associativity and relative precedence for
all the symbols:
The associativity of an operator op determines how repeated uses
of the operator nest: whether `xopyopz' is parsed by grouping x with y first or by
grouping y with z first. %left specifies
left-associativity (grouping x with y first) and
%right specifies right-associativity (grouping y with
z first). %nonassoc specifies no associativity, which
means that `xopyopz' is
considered a syntax error.
The precedence of an operator determines how it nests with other operators.
All the tokens declared in a single precedence declaration have equal
precedence and nest together according to their associativity.
When two tokens declared in different precedence declarations associate,
the one declared later has the higher precedence and is grouped first.
The %union declaration specifies the entire collection of possible
data types for semantic values. The keyword %union is followed by a
pair of braces containing the same thing that goes inside a union in
C.
For example:
%union {
double val;
symrec *tptr;
}
This says that the two alternative types are double and symrec
*. They are given names val and tptr; these names are used
in the %token and %type declarations to pick one of the types
for a terminal or nonterminal symbol (see section Nonterminal Symbols).
Note that, unlike making a union declaration in C, you do not write
a semicolon after the closing brace.
When you use %union to specify multiple value types, you must
declare the value type of each nonterminal symbol for which values are
used. This is done with a %type declaration, like this:
%type <type> nonterminal...
Here nonterminal is the name of a nonterminal symbol, and type
is the name given in the %union to the alternative that you want
(see section The Collection of Value Types). You can give any number of nonterminal symbols in
the same %type declaration, if they have the same value type. Use
spaces to separate the symbol names.
You can also declare the value type of a terminal symbol. To do this,
use the same <type> construction in a declaration for the
terminal symbol. All kinds of token declarations allow
<type>.
Bison normally warns if there are any conflicts in the grammar
(see section Shift/Reduce Conflicts), but most real grammars have harmless shift/reduce
conflicts which are resolved in a predictable way and would be difficult to
eliminate. It is desirable to suppress the warning about these conflicts
unless the number of conflicts changes. You can do this with the
%expect declaration.
The declaration looks like this:
%expect n
Here n is a decimal integer. The declaration says there should be no
warning if there are n shift/reduce conflicts and no reduce/reduce
conflicts. The usual warning is given if there are either more or fewer
conflicts, or if there are any reduce/reduce conflicts.
In general, using %expect involves these steps:
Compile your grammar without %expect. Use the `-v' option
to get a verbose list of where the conflicts occur. Bison will also
print the number of conflicts.
Check each of the conflicts to make sure that Bison's default
resolution is what you really want. If not, rewrite the grammar and
go back to the beginning.
Add an %expect declaration, copying the number n from the
number which Bison printed.
Now Bison will stop annoying you about the conflicts you have checked, but
it will warn you again if changes in the grammar result in additional
conflicts.
Bison assumes by default that the start symbol for the grammar is the first
nonterminal specified in the grammar specification section. The programmer
may override this restriction with the %start declaration as follows:
A reentrant program is one which does not alter in the course of
execution; in other words, it consists entirely of pure (read-only)
code. Reentrancy is important whenever asynchronous execution is possible;
for example, a nonreentrant program may not be safe to call from a signal
handler. In systems with multiple threads of control, a nonreentrant
program must be called only within interlocks.
Normally, Bison generates a parser which is not reentrant. This is
suitable for most uses, and it permits compatibility with YACC. (The
standard YACC interfaces are inherently nonreentrant, because they use
statically allocated variables for communication with yylex,
including yylval and yylloc.)
Alternatively, you can generate a pure, reentrant parser. The Bison
declaration %pure_parser says that you want the parser to be
reentrant. It looks like this:
%pure_parser
The result is that the communication variables yylval and
yylloc become local variables in yyparse, and a different
calling convention is used for the lexical analyzer function
yylex. See section Calling Conventions for Pure Parsers, for the details of this. The variable yynerrs also
becomes local in yyparse (see section The Error Reporting Function yyerror). The convention for calling
yyparse itself is unchanged.
Whether the parser is pure has nothing to do with the grammar rules.
You can generate either a pure parser or a nonreentrant parser from any
valid grammar.
Declare a terminal symbol (token type name) with no precedence
or associativity specified (see section Token Type Names).
%right
Declare a terminal symbol (token type name) that is right-associative
(see section Operator Precedence).
%left
Declare a terminal symbol (token type name) that is left-associative
(see section Operator Precedence).
%nonassoc
Declare a terminal symbol (token type name) that is nonassociative
(using it in a way that would be associative is a syntax error)
(see section Operator Precedence).
%type
Declare the type of semantic values for a nonterminal symbol
(see section Nonterminal Symbols).
%start
Specify the grammar's start symbol (see section The Start-Symbol).
Don't generate any #line preprocessor commands in the parser
file. Ordinarily Bison writes these commands in the parser file so that
the C compiler and debuggers will associate errors and object code with
your source file (the grammar file). This directive causes them to
associate errors with the parser file, treating it an independent source
file in its own right.
%raw
The output file `name.h' normally defines the tokens with
Yacc-compatible token numbers. If this option is specified, the
internal Bison numbers are used instead. (Yacc-compatible numbers start
at 257 except for single character tokens; Bison assigns token numbers
sequentially for all tokens starting at 3.)
%token_table
Generate an array of token names in the parser file. The name of the
array is yytname; yytname[i] is the name of the
token whose internal Bison token code number is i. The first three
elements of yytname are always "$", "error", and
"$illegal"; after these come the symbols defined in the grammar
file.
For single-character literal tokens and literal string tokens, the name
in the table includes the single-quote or double-quote characters: for
example, "'+'" is a single-character literal and "\"<=\""
is a literal string token. All the characters of the literal string
token appear verbatim in the string found in the table; even
double-quote characters are not escaped. For example, if the token
consists of three characters `*"*', its string in yytname
contains `"*"*"'. (In C, that would be written as
"\"*\"*\"").
When you specify %token_table, Bison also generates macro
definitions for macros YYNTOKENS, YYNNTS, and
YYNRULES, and YYNSTATES:
Most programs that use Bison parse only one language and therefore contain
only one Bison parser. But what if you want to parse more than one
language with the same program? Then you need to avoid a name conflict
between different definitions of yyparse, yylval, and so on.
The easy way to do this is to use the option `-p prefix'
(see section Invoking Bison). This renames the interface functions and
variables of the Bison parser to start with prefix instead of
`yy'. You can use this to give each parser distinct names that do
not conflict.
The precise list of symbols renamed is yyparse, yylex,
yyerror, yynerrs, yylval, yychar and
yydebug. For example, if you use `-p c', the names become
cparse, clex, and so on.
All the other variables and macros associated with Bison are not
renamed. These others are not global; there is no conflict if the same
name is used in different parsers. For example, YYSTYPE is not
renamed, but defining this in different ways in different parsers causes
no trouble (see section Data Types of Semantic Values).
The `-p' option works by adding macro definitions to the beginning
of the parser source file, defining yyparse as
prefixparse, and so on. This effectively substitutes one
name for the other in the entire parser file.
This document was generated
by Frank B. Brokken on January, 28 2005
using texi2html
bisonc++-6.09.01/documentation/html/bison_1.html 0000664 0001750 0001750 00000010225 14700504612 020314 0 ustar frank frank
Bison 2.21.5: Introduction
Bison is a general-purpose parser generator that converts a
grammar description for an LALR(1) context-free grammar 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 written primarily by Robert Corbett; Richard Stallman made it
Yacc-compatible. Wilfred Hansen of Carnegie Mellon University added
multicharacter string literals and other features.
This edition corresponds to version 2.21.5 of Bison.
This document was generated
by Frank B. Brokken on January, 28 2005
using texi2html
bisonc++-6.09.01/documentation/html/bison_9.html 0000664 0001750 0001750 00000020763 14700504612 020334 0 ustar frank frank
Bison 2.21.5: Error Recovery
It is not usually acceptable to have a program terminate on a parse
error. For example, a compiler should recover sufficiently to parse the
rest of the input file and check it for errors; a calculator should accept
another expression.
In a simple interactive command parser where each input is one line, it may
be sufficient to allow yyparse to return 1 on error and have the
caller ignore the rest of the input line when that happens (and then call
yyparse again). But this is inadequate for a compiler, because it
forgets all the syntactic context leading up to the error. A syntax error
deep within a function in the compiler input should not cause the compiler
to treat the following line like the beginning of a source file.
You can define how to recover from a syntax error by writing rules to
recognize the special token error. This is a terminal symbol that
is always defined (you need not declare it) and reserved for error
handling. The Bison parser generates an error token whenever a
syntax error happens; if you have provided a rule to recognize this token
in the current context, the parse can continue.
The fourth rule in this example says that an error followed by a newline
makes a valid addition to any stmnts.
What happens if a syntax error occurs in the middle of an exp? The
error recovery rule, interpreted strictly, applies to the precise sequence
of a stmnts, an error and a newline. If an error occurs in
the middle of an exp, there will probably be some additional tokens
and subexpressions on the stack after the last stmnts, and there
will be tokens to read before the next newline. So the rule is not
applicable in the ordinary way.
But Bison can force the situation to fit the rule, by discarding part of
the semantic context and part of the input. First it discards states and
objects from the stack until it gets back to a state in which the
error token is acceptable. (This means that the subexpressions
already parsed are discarded, back to the last complete stmnts.) At
this point the error token can be shifted. Then, if the old
look-ahead token is not acceptable to be shifted next, the parser reads
tokens and discards them until it finds a token which is acceptable. In
this example, Bison reads and discards input until the next newline
so that the fourth rule can apply.
The choice of error rules in the grammar is a choice of strategies for
error recovery. A simple and useful strategy is simply to skip the rest of
the current input line or current statement if an error is detected:
stmnt: error ';' /* on error, skip until ';' is read */
It is also useful to recover to the matching close-delimiter of an
opening-delimiter that has already been parsed. Otherwise the
close-delimiter will probably appear to be unmatched, and generate another,
spurious error message:
primary: '(' expr ')'
| '(' error ')'
...
;
Error recovery strategies are necessarily guesses. When they guess wrong,
one syntax error often leads to another. In the above example, the error
recovery rule guesses that an error is due to bad input within one
stmnt. Suppose that instead a spurious semicolon is inserted in the
middle of a valid stmnt. After the error recovery rule recovers
from the first error, another syntax error will be found straightaway,
since the text following the spurious semicolon is also an invalid
stmnt.
To prevent an outpouring of error messages, the parser will output no error
message for another syntax error that happens shortly after the first; only
after three consecutive input tokens have been successfully shifted will
error messages resume.
Note that rules which accept the error token may have actions, just
as any other rules can.
You can make error messages resume immediately by using the macro
yyerrok in an action. If you do this in the error rule's action, no
error messages will be suppressed. This macro requires no arguments;
`yyerrok;' is a valid C statement.
The previous look-ahead token is reanalyzed immediately after an error. If
this is unacceptable, then the macro yyclearin may be used to clear
this token. Write the statement `yyclearin;' in the error rule's
action.
For example, suppose that on a parse error, an error handling routine is
called that advances the input stream to some point where parsing should
once again commence. The next symbol returned by the lexical scanner is
probably correct. The previous look-ahead token ought to be discarded
with `yyclearin;'.
The macro YYRECOVERING stands for an expression that has the
value 1 when the parser is recovering from a syntax error, and 0 the
rest of the time. A value of 1 indicates that error messages are
currently suppressed for new syntax errors.
This document was generated
by Frank B. Brokken on January, 28 2005
using texi2html
bisonc++-6.09.01/documentation/html/bison_16.html 0000664 0001750 0001750 00000060304 14700504612 020405 0 ustar frank frank
Bison 2.21.5: Index: M -- Y
This document was generated
by Frank B. Brokken on January, 28 2005
using texi2html
bisonc++-6.09.01/documentation/html/bison_5.html 0000664 0001750 0001750 00000164064 14700504612 020333 0 ustar frank frank
Bison 2.21.5: Examples
Now we show and explain three sample programs written using Bison: a
reverse polish notation calculator, an algebraic (infix) notation
calculator, and a multi-function calculator. All three have been tested
under BSD Unix 4.3; each produces a usable, though limited, interactive
desk-top calculator.
These examples are simple, but Bison grammars for real programming
languages are written the same way.
You can copy these examples out of the Info file and into a source file
to try them.
The first example is that of a simple double-precision reverse polish
notation calculator (a calculator using postfix operators). This example
provides a good starting point, since operator precedence is not an issue.
The second example will illustrate how operator precedence is handled.
The source code for this calculator is named `rpcalc.y'. The
`.y' extension is a convention used for Bison input files.
The C declarations section (see section The C Declarations Section) contains two
preprocessor directives.
The #define directive defines the macro YYSTYPE, thus
specifying the C data type for semantic values of both tokens and groupings
(see section Data Types of Semantic Values). The Bison parser will use whatever type
YYSTYPE is defined as; if you don't define it, int is the
default. Because we specify double, each token and each expression
has an associated value, which is a floating point number.
The #include directive is used to declare the exponentiation
function pow.
The second section, Bison declarations, provides information to Bison about
the token types (see section The Bison Declarations Section). Each terminal symbol that is
not a single-character literal must be declared here. (Single-character
literals normally don't need to be declared.) In this example, all the
arithmetic operators are designated by single-character literals, so the
only terminal symbol that needs to be declared is NUM, the token
type for numeric constants.
The groupings of the rpcalc "language" defined here are the expression
(given the name exp), the line of input (line), and the
complete input transcript (input). Each of these nonterminal
symbols has several alternate rules, joined by the `|' punctuator
which is read as "or". The following sections explain what these rules
mean.
The semantics of the language is determined by the actions taken when a
grouping is recognized. The actions are the C code that appears inside
braces. See section 3.5.3 Actions.
You must specify these actions in C, but Bison provides the means for
passing semantic values between the rules. In each action, the
pseudo-variable $$ stands for the semantic value for the grouping
that the rule is going to construct. Assigning a value to $$ is the
main job of most actions. The semantic values of the components of the
rule are referred to as $1, $2, and so on.
This definition reads as follows: "A complete input is either an empty
string, or a complete input followed by an input line". Notice that
"complete input" is defined in terms of itself. This definition is said
to be left recursive since input appears always as the
leftmost symbol in the sequence. See section Recursive Rules.
The first alternative is empty because there are no symbols between the
colon and the first `|'; this means that input can match an
empty string of input (no tokens). We write the rules this way because it
is legitimate to type Ctrl-d right after you start the calculator.
It's conventional to put an empty alternative first and write the comment
`/* empty */' in it.
The second alternate rule (input line) handles all nontrivial input.
It means, "After reading any number of lines, read one more line if
possible." The left recursion makes this rule into a loop. Since the
first alternative matches empty input, the loop can be executed zero or
more times.
The parser function yyparse continues to process input until a
grammatical error is seen or the lexical analyzer says there are no more
input tokens; we will arrange for the latter to happen at end of file.
The first alternative is a token which is a newline character; this means
that rpcalc accepts a blank line (and ignores it, since there is no
action). The second alternative is an expression followed by a newline.
This is the alternative that makes rpcalc useful. The semantic value of
the exp grouping is the value of $1 because the exp in
question is the first symbol in the alternative. The action prints this
value, which is the result of the computation the user asked for.
This action is unusual because it does not assign a value to $$. As
a consequence, the semantic value associated with the line is
uninitialized (its value will be unpredictable). This would be a bug if
that value were ever used, but we don't use it: once rpcalc has printed the
value of the user's input line, that value is no longer needed.
The exp grouping has several rules, one for each kind of expression.
The first rule handles the simplest expressions: those that are just numbers.
The second handles an addition-expression, which looks like two expressions
followed by a plus-sign. The third handles subtraction, and so on.
Most of the rules have actions that compute the value of the expression in
terms of the value of its parts. For example, in the rule for addition,
$1 refers to the first component exp and $2 refers to
the second one. The third component, '+', has no meaningful
associated semantic value, but if it had one you could refer to it as
$3. When yyparse recognizes a sum expression using this
rule, the sum of the two subexpressions' values is produced as the value of
the entire expression. See section 3.5.3 Actions.
You don't have to give an action for every rule. When a rule has no
action, Bison by default copies the value of $1 into $$.
This is what happens in the first rule (the one that uses NUM).
The formatting shown here is the recommended convention, but Bison does
not require it. You can add or change whitespace as much as you wish.
For example, this:
The lexical analyzer's job is low-level parsing: converting characters or
sequences of characters into tokens. The Bison parser gets its tokens by
calling the lexical analyzer. See section The Lexical Analyzer Function yylex.
Only a simple lexical analyzer is needed for the RPN calculator. This
lexical analyzer skips blanks and tabs, then reads in numbers as
double and returns them as NUM tokens. Any other character
that isn't part of a number is a separate token. Note that the token-code
for such a single-character token is the character itself.
The return value of the lexical analyzer function is a numeric code which
represents a token type. The same text used in Bison rules to stand for
this token type is also a C expression for the numeric code for the type.
This works in two ways. If the token type is a character literal, then its
numeric code is the ASCII code for that character; you can use the same
character literal in the lexical analyzer to express the number. If the
token type is an identifier, that identifier is defined by Bison as a C
macro whose definition is the appropriate number. In this example,
therefore, NUM becomes a macro for yylex to use.
The semantic value of the token (if it has one) is stored into the global
variable yylval, which is where the Bison parser will look for it.
(The C data type of yylval is YYSTYPE, which was defined
at the beginning of the grammar; see section Declarations for rpcalc.)
A token type code of zero is returned if the end-of-file is encountered.
(Bison recognizes any nonpositive value as indicating the end of the
input.)
Here is the code for the lexical analyzer:
/* Lexical analyzer returns a double floating point
number on the stack and the token NUM, or the ASCII
character read if not a number. Skips all blanks
and tabs, returns 0 for EOF. */
#include <ctype.h>
yylex ()
{
int c;
/* skip white space */
while ((c = getchar ()) == ' ' || c == '\t')
;
/* process numbers */
if (c == '.' || isdigit (c))
{
ungetc (c, stdin);
scanf ("%lf", &yylval);
return NUM;
}
/* return end-of-file */
if (c == EOF)
return 0;
/* return single chars */
return c;
}
In keeping with the spirit of this example, the controlling function is
kept to the bare minimum. The only requirement is that it call
yyparse to start the process of parsing.
When yyparse detects a syntax error, it calls the error reporting
function yyerror to print an error message (usually but not always
"parse error"). It is up to the programmer to supply yyerror
(see section Parser C-Language Interface), so here is the definition we will use:
#include <stdio.h>
yyerror (s) /* Called by yyparse on error */
char *s;
{
printf ("%s\n", s);
}
After yyerror returns, the Bison parser may recover from the error
and continue parsing if the grammar contains a suitable error rule
(see section 6. Error Recovery). Otherwise, yyparse returns nonzero. We
have not written any error rules in this example, so any invalid input will
cause the calculator program to exit. This is not clean behavior for a
real calculator, but it is adequate in the first example.
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 (see section 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.
# List files in current directory.
% ls
rpcalc.tab.c rpcalc.y
# Compile the Bison parser.
# `-lm' tells compiler to search math library for pow.
% cc rpcalc.tab.c -lm -o rpcalc
# List files again.
% ls
rpcalc rpcalc.tab.c rpcalc.y
The file `rpcalc' now contains the executable code. Here is an
example session using rpcalc.
We now modify rpcalc to handle infix operators instead of postfix. Infix
notation involves the concept of operator precedence and the need for
parentheses nested to arbitrary depth. Here is the Bison code for
`calc.y', an infix desk-top calculator.
The functions yylex, yyerror and main can be the same
as before.
There are two important new features shown in this code.
In the second section (Bison declarations), %left declares token
types and says they are left-associative operators. The declarations
%left and %right (right associativity) take the place of
%token which is used to declare a token type name without
associativity. (These tokens are single-character literals, which
ordinarily don't need to be declared. We declare them here to specify
the associativity.)
Operator precedence is determined by the line ordering of the
declarations; the higher the line number of the declaration (lower on
the page or screen), the higher the precedence. Hence, exponentiation
has the highest precedence, unary minus (NEG) is next, followed
by `*' and `/', and so on. See section Operator Precedence.
The other important new feature is the %prec in the grammar section
for the unary minus operator. The %prec simply instructs Bison that
the rule `| '-' exp' has the same precedence as NEG---in this
case the next-to-highest. See section Context-Dependent Precedence.
Up to this point, this manual has not addressed the issue of error
recovery---how to continue parsing after the parser detects a syntax
error. All we have handled is error reporting with yyerror. Recall
that by default yyparse returns after calling yyerror. This
means that an erroneous input line causes the calculator program to exit.
Now we show how to rectify this deficiency.
The Bison language itself includes the reserved word error, which
may be included in the grammar rules. In the example below it has
been added to one of the alternatives for line:
This addition to the grammar allows for simple error recovery in the event
of a parse error. If an expression that cannot be evaluated is read, the
error will be recognized by the third rule for line, and parsing
will continue. (The yyerror function is still called upon to print
its message as well.) The action executes the statement yyerrok, a
macro defined automatically by Bison; its meaning is that error recovery is
complete (see section 6. Error Recovery). Note the difference between
yyerrok and yyerror; neither one is a misprint.
This form of error recovery deals with syntax errors. There are other
kinds of errors; for example, division by zero, which raises an exception
signal that is normally fatal. A real calculator program must handle this
signal and use longjmp to return to main and resume parsing
input lines; it would also have to discard the rest of the current line of
input. We won't discuss this issue further because it is not specific to
Bison programs.
Now that the basics of Bison have been discussed, it is time to move on to
a more advanced problem. The above calculators provided only five
functions, `+', `-', `*', `/' and `^'. It would
be nice to have a calculator that provides other mathematical functions such
as sin, cos, etc.
It is easy to add new operators to the infix calculator as long as they are
only single-character literals. The lexical analyzer yylex passes
back all non-number characters as tokens, so new grammar rules suffice for
adding a new operator. But we want something more flexible: built-in
functions whose syntax has this form:
function_name (argument)
At the same time, we will add memory to the calculator, by allowing you
to create named variables, store values in them, and use them later.
Here is a sample session with the multi-function calculator:
Here are the C and Bison declarations for the multi-function calculator.
%{
#include <math.h> /* For math functions, cos(), sin(), etc. */
#include "calc.h" /* Contains definition of `symrec' */
%}
%union {
double val; /* For returning numbers. */
symrec *tptr; /* For returning symbol-table pointers */
}
%token <val> NUM /* Simple double precision number */
%token <tptr> VAR FNCT /* Variable and Function */
%type <val> exp
%right '='
%left '-' '+'
%left '*' '/'
%left NEG /* Negation--unary minus */
%right '^' /* Exponentiation */
/* Grammar follows */
%%
The above grammar introduces only two new features of the Bison language.
These features allow semantic values to have various data types
(see section More Than One Value Type).
The %union declaration specifies the entire list of possible types;
this is instead of defining YYSTYPE. The allowable types are now
double-floats (for exp and NUM) and pointers to entries in
the symbol table. See section The Collection of Value Types.
Since values can now have various types, it is necessary to associate a
type with each grammar symbol whose semantic value is used. These symbols
are NUM, VAR, FNCT, and exp. Their
declarations are augmented with information about their data type (placed
between angle brackets).
The Bison construct %type is used for declaring nonterminal symbols,
just as %token is used for declaring token types. We have not used
%type before because nonterminal symbols are normally declared
implicitly by the rules that define them. But exp must be declared
explicitly so we can specify its value type. See section Nonterminal Symbols.
Here are the grammar rules for the multi-function calculator.
Most of them are copied directly from calc; three rules,
those which mention VAR or FNCT, are new.
The multi-function calculator requires a symbol table to keep track of the
names and meanings of variables and functions. This doesn't affect the
grammar rules (except for the actions) or the Bison declarations, but it
requires some additional C functions for support.
The symbol table itself consists of a linked list of records. Its
definition, which is kept in the header `calc.h', is as follows. It
provides for either functions or variables to be placed in the table.
/* Data type for links in the chain of symbols. */
struct symrec
{
char *name; /* name of symbol */
int type; /* type of symbol: either VAR or FNCT */
union {
double var; /* value of a VAR */
double (*fnctptr)(); /* value of a FNCT */
} value;
struct symrec *next; /* link field */
};
typedef struct symrec symrec;
/* The symbol table: a chain of `struct symrec'. */
extern symrec *sym_table;
symrec *putsym ();
symrec *getsym ();
The new version of main includes a call to init_table, a
function that initializes the symbol table. Here it is, and
init_table as well:
#include <stdio.h>
main ()
{
init_table ();
yyparse ();
}
yyerror (s) /* Called by yyparse on error */
char *s;
{
printf ("%s\n", s);
}
struct init
{
char *fname;
double (*fnct)();
};
struct init arith_fncts[]
= {
"sin", sin,
"cos", cos,
"atan", atan,
"ln", log,
"exp", exp,
"sqrt", sqrt,
0, 0
};
/* The symbol table: a chain of `struct symrec'. */
symrec *sym_table = (symrec *)0;
init_table () /* puts arithmetic functions in table. */
{
int i;
symrec *ptr;
for (i = 0; arith_fncts[i].fname != 0; i++)
{
ptr = putsym (arith_fncts[i].fname, FNCT);
ptr->value.fnctptr = arith_fncts[i].fnct;
}
}
By simply editing the initialization list and adding the necessary include
files, you can add additional functions to the calculator.
Two important functions allow look-up and installation of symbols in the
symbol table. The function putsym is passed a name and the type
(VAR or FNCT) of the object to be installed. The object is
linked to the front of the list, and a pointer to the object is returned.
The function getsym is passed the name of the symbol to look up. If
found, a pointer to that symbol is returned; otherwise zero is returned.
The function yylex must now recognize variables, numeric values, and
the single-character arithmetic operators. Strings of alphanumeric
characters with a leading nondigit are recognized as either variables or
functions depending on what the symbol table says about them.
The string is passed to getsym for look up in the symbol table. If
the name appears in the table, a pointer to its location and its type
(VAR or FNCT) is returned to yyparse. If it is not
already in the table, then it is installed as a VAR using
putsym. Again, a pointer and its type (which must be VAR) is
returned to yyparse.
No change is needed in the handling of numeric values and arithmetic
operators in yylex.
#include <ctype.h>
yylex ()
{
int c;
/* Ignore whitespace, get first nonwhite character. */
while ((c = getchar ()) == ' ' || c == '\t');
if (c == EOF)
return 0;
/* Char starts a number => parse the number. */
if (c == '.' || isdigit (c))
{
ungetc (c, stdin);
scanf ("%lf", &yylval.val);
return NUM;
}
/* Char starts an identifier => read the name. */
if (isalpha (c))
{
symrec *s;
static char *symbuf = 0;
static int length = 0;
int i;
/* Initially make the buffer long enough
for a 40-character symbol name. */
if (length == 0)
length = 40, symbuf = (char *)malloc (length + 1);
i = 0;
do
{
/* If buffer is full, make it bigger. */
if (i == length)
{
length *= 2;
symbuf = (char *)realloc (symbuf, length + 1);
}
/* Add this character to the buffer. */
symbuf[i++] = c;
/* Get another character. */
c = getchar ();
}
while (c != EOF && isalnum (c));
ungetc (c, stdin);
symbuf[i] = '\0';
s = getsym (symbuf);
if (s == 0)
s = putsym (symbuf, VAR);
yylval.tptr = s;
return s->type;
}
/* Any other character is a token by itself. */
return c;
}
This program is both powerful and flexible. You may easily add new
functions, and it is a simple job to modify this code to install predefined
variables such as pi or e as well.
Add some new functions from `math.h' to the initialization list.
Add another array that contains constants and their values. Then
modify init_table to add these constants to the symbol table.
It will be easiest to give the constants type VAR.
Make the program report an error if the user refers to an
uninitialized variable in any way except to store a value in it.
This document was generated
by Frank B. Brokken on January, 28 2005
using texi2html
bisonc++-6.09.01/documentation/html/bison_12.html 0000664 0001750 0001750 00000034400 14700504612 020377 0 ustar frank frank
Bison 2.21.5: Invocation
Here infile is the grammar file name, which usually ends in
`.y'. The parser file's name is made by replacing the `.y'
with `.tab.c'. Thus, the `bison foo.y' filename yields
`foo.tab.c', and the `bison hack/foo.y' filename yields
`hack/foo.tab.c'.
Bison supports both traditional single-letter options and mnemonic long
option names. Long option names are indicated with `--' instead of
`-'. Abbreviations for option names are allowed as long as they
are unique. When a long option takes an argument, like
`--file-prefix', connect the option name and the argument with
`='.
Here is a list of options that can be used with Bison, alphabetized by
short option. It is followed by a cross key alphabetized by long
option.
`-b file-prefix'
`--file-prefix=prefix'
Specify a prefix to use for all Bison output file names. The names are
chosen as if the input file were named `prefix.c'.
`-d'
`--defines'
Write an extra output file containing macro definitions for the token
type names defined in the grammar and the semantic value type
YYSTYPE, as well as a few extern variable declarations.
If the parser output file is named `name.c' then this file
is named `name.h'.
This output file is essential if you wish to put the definition of
yylex in a separate source file, because yylex needs to
be able to refer to token type codes and the variable
yylval. See section Semantic Values of Tokens.
`-l'
`--no-lines'
Don't put any #line preprocessor commands in the parser file.
Ordinarily Bison puts them in the parser file so that the C compiler
and debuggers will associate errors with your source file, the
grammar file. This option causes them to associate errors with the
parser file, treating it as an independent source file in its own right.
`-n'
`--no-parser'
Do not include any C code in the parser file; generate tables only. The
parser file contains just #define directives and static variable
declarations.
This option also tells Bison to write the C code for the grammar actions
into a file named `filename.act', in the form of a
brace-surrounded body fit for a switch statement.
`-o outfile'
`--output-file=outfile'
Specify the name outfile for the parser file.
The other output files' names are constructed from outfile
as described under the `-v' and `-d' options.
`-p prefix'
`--name-prefix=prefix'
Rename the external symbols used in the parser so that they start with
prefix instead of `yy'. The precise list of symbols renamed
is yyparse, yylex, yyerror, yynerrs,
yylval, yychar and yydebug.
For example, if you use `-p c', the names become cparse,
clex, and so on.
Output a definition of the macro YYDEBUG into the parser file,
so that the debugging facilities are compiled. See section Debugging Your Parser.
`-v'
`--verbose'
Write an extra output file containing verbose descriptions of the
parser states and what is done for each type of look-ahead token in
that state.
This file also describes all the conflicts, both those resolved by
operator precedence and the unresolved ones.
The file's name is made by removing `.tab.c' or `.c' from
the parser output file name, and adding `.output' instead.
Therefore, if the input file is `foo.y', then the parser file is
called `foo.tab.c' by default. As a consequence, the verbose
output file is called `foo.output'.
`-V'
`--version'
Print the version number of Bison and exit.
`-h'
`--help'
Print a summary of the command-line options to Bison and exit.
`-y'
`--yacc'
`--fixed-output-files'
Equivalent to `-o y.tab.c'; the parser output file is called
`y.tab.c', and the other outputs are called `y.output' and
`y.tab.h'. The purpose of this option is to imitate Yacc's output
file name conventions. Thus, the following shell script can substitute
for Yacc:
The command line syntax for Bison on VMS is a variant of the usual
Bison command syntax--adapted to fit VMS conventions.
To find the VMS equivalent for any Bison option, start with the long
option, and substitute a `/' for the leading `--', and
substitute a `_' for each `-' in the name of the long option.
For example, the following invocation under VMS:
bison /debug/name_prefix=bar foo.y
is equivalent to the following command under POSIX.
bison --debug --name-prefix=bar foo.y
The VMS file system does not permit filenames such as
`foo.tab.c'. In the above example, the output file
would instead be named `foo_tab.c'.
This document was generated
by Frank B. Brokken on January, 28 2005
using texi2html
bisonc++-6.09.01/documentation/html/bison_abt.html 0000664 0001750 0001750 00000007653 14700504612 020735 0 ustar frank frank
Bison 2.21.5: About this document
This document was generated
by
using texi2html
The buttons in the navigation panels have the following meaning:
Button
Name
Go to
From 1.2.3 go to
[ < ]
Back
previous section in reading order
1.2.2
[ > ]
Forward
next section in reading order
1.2.4
[ << ]
FastBack
beginning of this chapter or previous chapter
1
[ Up ]
Up
up section
1.2
[ >> ]
FastForward
next chapter
2
[Top]
Top
cover (top) of document
[Contents]
Contents
table of contents
[Index]
Index
concept index
[ ? ]
About
this page
where the Example assumes that the current position
is at Subsubsection One-Two-Three of a document of
the following structure:
1. Section One
1.1 Subsection One-One
...
1.2 Subsection One-Two
1.2.1 Subsubsection One-Two-One
1.2.2 Subsubsection One-Two-Two
1.2.3 Subsubsection One-Two-Three
<== Current Position
1.2.4 Subsubsection One-Two-Four
1.3 Subsection One-Three
...
1.4 Subsection One-Four
This document was generated
by Frank B. Brokken on January, 28 2005
using texi2html
bisonc++-6.09.01/documentation/html/bison_8.html 0000664 0001750 0001750 00000125754 14700504612 020341 0 ustar frank frank
Bison 2.21.5: Algorithm
As Bison reads tokens, it pushes them onto a stack along with their
semantic values. The stack is called the parser stack. Pushing a
token is traditionally called shifting.
For example, suppose the infix calculator has read `1 + 5 *', with a
`3' to come. The stack will have four elements, one for each token
that was shifted.
But the stack does not always have an element for each token read. When
the last n tokens and groupings shifted match the components of a
grammar rule, they can be combined according to that rule. This is called
reduction. Those tokens and groupings are replaced on the stack by a
single grouping whose symbol is the result (left hand side) of that rule.
Running the rule's action is part of the process of reduction, because this
is what computes the semantic value of the resulting grouping.
For example, if the infix calculator's parser stack contains this:
1 + 5 * 3
and the next input token is a newline character, then the last three
elements can be reduced to 15 via the rule:
expr: expr '*' expr;
Then the stack contains just these three elements:
1 + 15
At this point, another reduction can be made, resulting in the single value
16. Then the newline token can be shifted.
The parser tries, by shifts and reductions, to reduce the entire input down
to a single grouping whose symbol is the grammar's start-symbol
(see section Languages and Context-Free Grammars).
This kind of parser is known in the literature as a bottom-up parser.
The Bison parser does not always reduce immediately as soon as the
last n tokens and groupings match a rule. This is because such a
simple strategy is inadequate to handle most languages. Instead, when a
reduction is possible, the parser sometimes "looks ahead" at the next
token in order to decide what to do.
When a token is read, it is not immediately shifted; first it becomes the
look-ahead token, which is not on the stack. Now the parser can
perform one or more reductions of tokens and groupings on the stack, while
the look-ahead token remains off to the side. When no more reductions
should take place, the look-ahead token is shifted onto the stack. This
does not mean that all possible reductions have been done; depending on the
token type of the look-ahead token, some rules may choose to delay their
application.
Here is a simple case where look-ahead is needed. These three rules define
expressions which contain binary addition operators and postfix unary
factorial operators (`!'), and allow parentheses for grouping.
expr: term '+' expr
| term
;
term: '(' expr ')'
| term '!'
| NUMBER
;
Suppose that the tokens `1 + 2' have been read and shifted; what
should be done? If the following token is `)', then the first three
tokens must be reduced to form an expr. This is the only valid
course, because shifting the `)' would produce a sequence of symbols
term ')', and no rule allows this.
If the following token is `!', then it must be shifted immediately so
that `2 !' can be reduced to make a term. If instead the
parser were to reduce before shifting, `1 + 2' would become an
expr. It would then be impossible to shift the `!' because
doing so would produce on the stack the sequence of symbols expr
'!'. No rule allows that sequence.
Suppose we are parsing a language which has if-then and if-then-else
statements, with a pair of rules like this:
if_stmt:
IF expr THEN stmt
| IF expr THEN stmt ELSE stmt
;
Here we assume that IF, THEN and ELSE are
terminal symbols for specific keyword tokens.
When the ELSE token is read and becomes the look-ahead token, the
contents of the stack (assuming the input is valid) are just right for
reduction by the first rule. But it is also legitimate to shift the
ELSE, because that would lead to eventual reduction by the second
rule.
This situation, where either a shift or a reduction would be valid, is
called a shift/reduce conflict. Bison is designed to resolve
these conflicts by choosing to shift, unless otherwise directed by
operator precedence declarations. To see the reason for this, let's
contrast it with the other alternative.
Since the parser prefers to shift the ELSE, the result is to attach
the else-clause to the innermost if-statement, making these two inputs
equivalent:
if x then if y then win (); else lose;
if x then do; if y then win (); else lose; end;
But if the parser chose to reduce when possible rather than shift, the
result would be to attach the else-clause to the outermost if-statement,
making these two inputs equivalent:
if x then if y then win (); else lose;
if x then do; if y then win (); end; else lose;
The conflict exists because the grammar as written is ambiguous: either
parsing of the simple nested if-statement is legitimate. The established
convention is that these ambiguities are resolved by attaching the
else-clause to the innermost if-statement; this is what Bison accomplishes
by choosing to shift rather than reduce. (It would ideally be cleaner to
write an unambiguous grammar, but that is very hard to do in this case.)
This particular ambiguity was first encountered in the specifications of
Algol 60 and is called the "dangling else" ambiguity.
To avoid warnings from Bison about predictable, legitimate shift/reduce
conflicts, use the %expect n declaration. There will be no
warning as long as the number of shift/reduce conflicts is exactly n.
See section Suppressing Conflict Warnings.
The definition of if_stmt above is solely to blame for the
conflict, but the conflict does not actually appear without additional
rules. Here is a complete Bison input file that actually manifests the
conflict:
%token IF THEN ELSE variable
%%
stmt: expr
| if_stmt
;
if_stmt:
IF expr THEN stmt
| IF expr THEN stmt ELSE stmt
;
expr: variable
;
Another situation where shift/reduce conflicts appear is in arithmetic
expressions. Here shifting is not always the preferred resolution; the
Bison declarations for operator precedence allow you to specify when to
shift and when to reduce.
Suppose the parser has seen the tokens `1', `-' and `2';
should it reduce them via the rule for the addition operator? It depends
on the next token. Of course, if the next token is `)', we must
reduce; shifting is invalid because no single rule can reduce the token
sequence `- 2 )' or anything starting with that. But if the next
token is `*' or `<', we have a choice: either shifting or
reduction would allow the parse to complete, but with different
results.
To decide which one Bison should do, we must consider the
results. If the next operator token op is shifted, then it
must be reduced first in order to permit another opportunity to
reduce the sum. The result is (in effect) `1 - (2
op 3)'. On the other hand, if the subtraction is reduced
before shifting op, the result is `(1 - 2) op
3'. Clearly, then, the choice of shift or reduce should depend
on the relative precedence of the operators `-' and
op: `*' should be shifted first, but not `<'.
What about input such as `1 - 2 - 5'; should this be
`(1 - 2) - 5' or should it be `1 - (2 - 5)'? For
most operators we prefer the former, which is called left
association. The latter alternative, right association, is
desirable for assignment operators. The choice of left or right
association is a matter of whether the parser chooses to shift or
reduce when the stack contains `1 - 2' and the look-ahead
token is `-': shifting makes right-associativity.
Bison allows you to specify these choices with the operator precedence
declarations %left and %right. Each such declaration
contains a list of tokens, which are operators whose precedence and
associativity is being declared. The %left declaration makes all
those operators left-associative and the %right declaration makes
them right-associative. A third alternative is %nonassoc, which
declares that it is a syntax error to find the same operator twice "in a
row".
The relative precedence of different operators is controlled by the
order in which they are declared. The first %left or
%right declaration in the file declares the operators whose
precedence is lowest, the next such declaration declares the operators
whose precedence is a little higher, and so on.
In our example, we would want the following declarations:
%left '<'
%left '-'
%left '*'
In a more complete example, which supports other operators as well, we
would declare them in groups of equal precedence. For example, '+' is
declared with '-':
%left '<' '>' '=' NE LE GE
%left '+' '-'
%left '*' '/'
(Here NE and so on stand for the operators for "not equal"
and so on. We assume that these tokens are more than one character long
and therefore are represented by names, not character literals.)
The first effect of the precedence declarations is to assign precedence
levels to the terminal symbols declared. The second effect is to assign
precedence levels to certain rules: each rule gets its precedence from the
last terminal symbol mentioned in the components. (You can also specify
explicitly the precedence of a rule. See section Context-Dependent Precedence.)
Finally, the resolution of conflicts works by comparing the
precedence of the rule being considered with that of the
look-ahead token. If the token's precedence is higher, the
choice is to shift. If the rule's precedence is higher, the
choice is to reduce. If they have equal precedence, the choice
is made based on the associativity of that precedence level. The
verbose output file made by `-v' (see section Invoking Bison) says
how each conflict was resolved.
Not all rules and not all tokens have precedence. If either the rule or
the look-ahead token has no precedence, then the default is to shift.
Often the precedence of an operator depends on the context. This sounds
outlandish at first, but it is really very common. For example, a minus
sign typically has a very high precedence as a unary operator, and a
somewhat lower precedence (lower than multiplication) as a binary operator.
The Bison precedence declarations, %left, %right and
%nonassoc, can only be used once for a given token; so a token has
only one precedence declared in this way. For context-dependent
precedence, you need to use an additional mechanism: the %prec
modifier for rules.
The %prec modifier declares the precedence of a particular rule by
specifying a terminal symbol whose precedence should be used for that rule.
It's not necessary for that symbol to appear otherwise in the rule. The
modifier's syntax is:
%prec terminal-symbol
and it is written after the components of the rule. Its effect is to
assign the rule the precedence of terminal-symbol, overriding
the precedence that would be deduced for it in the ordinary way. The
altered rule precedence then affects how conflicts involving that rule
are resolved (see section Operator Precedence).
Here is how %prec solves the problem of unary minus. First, declare
a precedence for a fictitious terminal symbol named UMINUS. There
are no tokens of this type, but the symbol serves to stand for its
precedence:
...
%left '+' '-'
%left '*'
%left UMINUS
Now the precedence of UMINUS can be used in specific rules:
The function yyparse is implemented using a finite-state machine.
The values pushed on the parser stack are not simply token type codes; they
represent the entire sequence of terminal and nonterminal symbols at or
near the top of the stack. The current state collects all the information
about previous input which is relevant to deciding what to do next.
Each time a look-ahead token is read, the current parser state together
with the type of look-ahead token are looked up in a table. This table
entry can say, "Shift the look-ahead token." In this case, it also
specifies the new parser state, which is pushed onto the top of the
parser stack. Or it can say, "Reduce using rule number n."
This means that a certain number of tokens or groupings are taken off
the top of the stack, and replaced by one grouping. In other words,
that number of states are popped from the stack, and one new state is
pushed.
There is one other alternative: the table can say that the look-ahead token
is erroneous in the current state. This causes error processing to begin
(see section 6. Error Recovery).
A reduce/reduce conflict occurs if there are two or more rules that apply
to the same sequence of input. This usually indicates a serious error
in the grammar.
For example, here is an erroneous attempt to define a sequence
of zero or more word groupings.
The error is an ambiguity: there is more than one way to parse a single
word into a sequence. It could be reduced to a
maybeword and then into a sequence via the second rule.
Alternatively, nothing-at-all could be reduced into a sequence
via the first rule, and this could be combined with the word
using the third rule for sequence.
There is also more than one way to reduce nothing-at-all into a
sequence. This can be done directly via the first rule,
or indirectly via maybeword and then the second rule.
You might think that this is a distinction without a difference, because it
does not change whether any particular input is valid or not. But it does
affect which actions are run. One parsing order runs the second rule's
action; the other runs the first rule's action and the third rule's action.
In this example, the output of the program changes.
Bison resolves a reduce/reduce conflict by choosing to use the rule that
appears first in the grammar, but it is very risky to rely on this. Every
reduce/reduce conflict must be studied and usually eliminated. Here is the
proper way to define sequence:
sequence: /* empty */
{ printf ("empty sequence\n"); }
| sequence word
{ printf ("added word %s\n", $2); }
;
Here is another common error that yields a reduce/reduce conflict:
sequence: /* empty */
| sequence words
| sequence redirects
;
words: /* empty */
| words word
;
redirects:/* empty */
| redirects redirect
;
The intention here is to define a sequence which can contain either
word or redirect groupings. The individual definitions of
sequence, words and redirects are error-free, but the
three together make a subtle ambiguity: even an empty input can be parsed
in infinitely many ways!
Consider: nothing-at-all could be a words. Or it could be two
words in a row, or three, or any number. It could equally well be a
redirects, or two, or any number. Or it could be a words
followed by three redirects and another words. And so on.
Here are two ways to correct these rules. First, to make it a single level
of sequence:
Sometimes reduce/reduce conflicts can occur that don't look warranted.
Here is an example:
%token ID
%%
def: param_spec return_spec ','
;
param_spec:
type
| name_list ':' type
;
return_spec:
type
| name ':' type
;
type: ID
;
name: ID
;
name_list:
name
| name ',' name_list
;
It would seem that this grammar can be parsed with only a single token
of look-ahead: when a param_spec is being read, an ID is
a name if a comma or colon follows, or a type if another
ID follows. In other words, this grammar is LR(1).
However, Bison, like most parser generators, cannot actually handle all
LR(1) grammars. In this grammar, two contexts, that after an ID
at the beginning of a param_spec and likewise at the beginning of
a return_spec, are similar enough that Bison assumes they are the
same. They appear similar because the same set of rules would be
active--the rule for reducing to a name and that for reducing to
a type. Bison is unable to determine at that stage of processing
that the rules would require different look-ahead tokens in the two
contexts, so it makes a single parser state for them both. Combining
the two contexts causes a conflict later. In parser terminology, this
occurrence means that the grammar is not LALR(1).
In general, it is better to fix deficiencies than to document them. But
this particular deficiency is intrinsically hard to fix; parser
generators that can handle LR(1) grammars are hard to write and tend to
produce parsers that are very large. In practice, Bison is more useful
as it is now.
When the problem arises, you can often fix it by identifying the two
parser states that are being confused, and adding something to make them
look distinct. In the above example, adding one rule to
return_spec as follows makes the problem go away:
%token BOGUS
...
%%
...
return_spec:
type
| name ':' type
/* This rule is never used. */
| ID BOGUS
;
This corrects the problem because it introduces the possibility of an
additional active rule in the context after the ID at the beginning of
return_spec. This rule is not active in the corresponding context
in a param_spec, so the two contexts receive distinct parser states.
As long as the token BOGUS is never generated by yylex,
the added rule cannot alter the way actual input is parsed.
In this particular example, there is another way to solve the problem:
rewrite the rule for return_spec to use ID directly
instead of via name. This also causes the two confusing
contexts to have different sets of active rules, because the one for
return_spec activates the altered rule for return_spec
rather than the one for name.
param_spec:
type
| name_list ':' type
;
return_spec:
type
| ID ':' type
;
The Bison parser stack can overflow if too many tokens are shifted and
not reduced. When this happens, the parser function yyparse
returns a nonzero value, pausing only to call yyerror to report
the overflow.
By defining the macro YYMAXDEPTH, you can control how deep the
parser stack can become before a stack overflow occurs. Define the
macro with a value that is an integer. This value is the maximum number
of tokens that can be shifted (and not reduced) before overflow.
It must be a constant expression whose value is known at compile time.
The stack space allowed is not necessarily allocated. If you specify a
large value for YYMAXDEPTH, the parser actually allocates a small
stack at first, and then makes it bigger by stages as needed. This
increasing allocation happens automatically and silently. Therefore,
you do not need to make YYMAXDEPTH painfully small merely to save
space for ordinary inputs that do not need much stack.
The default value of YYMAXDEPTH, if you do not define it, is
10000.
You can control how much stack is allocated initially by defining the
macro YYINITDEPTH. This value too must be a compile-time
constant integer. The default is 200.
This document was generated
by Frank B. Brokken on January, 28 2005
using texi2html
bisonc++-6.09.01/documentation/html/bison_10.html 0000664 0001750 0001750 00000035064 14700504612 020404 0 ustar frank frank
Bison 2.21.5: Context Dependency
The Bison paradigm is to parse tokens first, then group them into larger
syntactic units. In many languages, the meaning of a token is affected by
its context. Although this violates the Bison paradigm, certain techniques
(known as kludges) may enable you to write Bison parsers for such
languages.
The C language has a context dependency: the way an identifier is used
depends on what its current meaning is. For example, consider this:
foo (x);
This looks like a function call statement, but if foo is a typedef
name, then this is actually a declaration of x. How can a Bison
parser for C decide how to parse this input?
The method used in GNU C is to have two different token types,
IDENTIFIER and TYPENAME. When yylex finds an
identifier, it looks up the current declaration of the identifier in order
to decide which token type to return: TYPENAME if the identifier is
declared as a typedef, IDENTIFIER otherwise.
The grammar rules can then express the context dependency by the choice of
token type to recognize. IDENTIFIER is accepted as an expression,
but TYPENAME is not. TYPENAME can start a declaration, but
IDENTIFIER cannot. In contexts where the meaning of the identifier
is not significant, such as in declarations that can shadow a
typedef name, either TYPENAME or IDENTIFIER is
accepted--there is one rule for each of the two token types.
This technique is simple to use if the decision of which kinds of
identifiers to allow is made at a place close to where the identifier is
parsed. But in C this is not always so: C allows a declaration to
redeclare a typedef name provided an explicit type has been specified
earlier:
typedef int foo, bar, lose;
static foo (bar); /* redeclare bar as static variable */
static int foo (lose); /* redeclare foo as function */
Unfortunately, the name being declared is separated from the declaration
construct itself by a complicated syntactic structure--the "declarator".
As a result, the part of Bison parser for C needs to be duplicated, with
all the nonterminal names changed: once for parsing a declaration in which
a typedef name can be redefined, and once for parsing a declaration in
which that can't be done. Here is a part of the duplication, with actions
omitted for brevity:
Here initdcl can redeclare a typedef name, but notype_initdcl
cannot. The distinction between declarator and
notype_declarator is the same sort of thing.
There is some similarity between this technique and a lexical tie-in
(described next), in that information which alters the lexical analysis is
changed during parsing by other parts of the program. The difference is
here the information is global, and is used for other purposes in the
program. A true lexical tie-in has a special-purpose flag controlled by
the syntactic context.
One way to handle context-dependency is the lexical tie-in: a flag
which is set by Bison actions, whose purpose is to alter the way tokens are
parsed.
For example, suppose we have a language vaguely like C, but with a special
construct `hex (hex-expr)'. After the keyword hex comes
an expression in parentheses in which all integers are hexadecimal. In
particular, the token `a1b' must be treated as an integer rather than
as an identifier if it appears in that context. Here is how you can do it:
Here we assume that yylex looks at the value of hexflag; when
it is nonzero, all integers are parsed in hexadecimal, and tokens starting
with letters are parsed as integers if possible.
The declaration of hexflag shown in the C declarations section of
the parser file is needed to make it accessible to the actions
(see section The C Declarations Section). You must also write the code in yylex
to obey the flag.
Lexical tie-ins make strict demands on any error recovery rules you have.
See section 6. Error Recovery.
The reason for this is that the purpose of an error recovery rule is to
abort the parsing of one construct and resume in some larger construct.
For example, in C-like languages, a typical error recovery rule is to skip
tokens until the next semicolon, and then start a new statement, like this:
If there is a syntax error in the middle of a `hex (expr)'
construct, this error rule will apply, and then the action for the
completed `hex (expr)' will never run. So hexflag would
remain set for the entire rest of the input, or until the next hex
keyword, causing identifiers to be misinterpreted as integers.
To avoid this problem the error recovery rule itself clears hexflag.
There may also be an error recovery rule that works within expressions.
For example, there could be a rule which applies within parentheses
and skips to the close-parenthesis:
If this rule acts within the hex construct, it is not going to abort
that construct (since it applies to an inner level of parentheses within
the construct). Therefore, it should not clear the flag: the rest of
the hex construct should be parsed with the flag still in effect.
What if there is an error recovery rule which might abort out of the
hex construct or might not, depending on circumstances? There is no
way you can write the action to determine whether a hex construct is
being aborted or not. So if you are using a lexical tie-in, you had better
make sure your error recovery rules are not of this kind. Each rule must
be such that you can be sure that it always will, or always won't, have to
clear the flag.
This document was generated
by Frank B. Brokken on January, 28 2005
using texi2html
bisonc++-6.09.01/documentation/html/bison_2.html 0000664 0001750 0001750 00000010475 14700504612 020324 0 ustar frank frank
Bison 2.21.5: Conditions
As of Bison version 1.24, we have changed the distribution terms for
yyparse to permit using Bison's output in non-free programs.
Formerly, Bison parsers could be used only in programs that were free
software.
The other GNU programming tools, such as the GNU C compiler, have never
had such a requirement. They could always be used for non-free
software. The reason Bison was different was not due to a special
policy decision; it resulted from applying the usual General Public
License to all of the Bison source code.
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.) When we applied the GPL terms to the code for yyparse,
the effect was to restrict the use of Bison output to free software.
We didn't change the terms because of sympathy for people who want to
make software proprietary. Software should be free. But we
concluded that limiting Bison's use to free software was doing little to
encourage people to make other software free. So we decided to make the
practical conditions for using Bison match the practical conditions for
using the other GNU tools.
This document was generated
by Frank B. Brokken on January, 28 2005
using texi2html
bisonc++-6.09.01/documentation/html/bison.html 0000664 0001750 0001750 00000060126 14700504612 020101 0 ustar frank frank
Bison 2.21.5: Bison 2.21.5
This document was generated
by Frank B. Brokken on January, 28 2005
using texi2html
bisonc++-6.09.01/documentation/html/bison_13.html 0000664 0001750 0001750 00000030474 14700504612 020407 0 ustar frank frank
Bison 2.21.5: Table of Symbols
A token name reserved for error recovery. This token may be used in
grammar rules so as to allow the Bison parser to recognize an error in
the grammar without halting the process. In effect, a sentence
containing an error may be recognized as valid. On a parse error, the
token error becomes the current look-ahead token. Actions
corresponding to error are then executed, and the look-ahead
token is reset to the token that originally caused the violation.
See section 6. Error Recovery.
YYABORT
Macro to pretend that an unrecoverable syntax error has occurred, by
making yyparse return 1 immediately. The error reporting
function yyerror is not called. See section The Parser Function yyparse.
YYACCEPT
Macro to pretend that a complete utterance of the language has been
read, by making yyparse return 0 immediately.
See section The Parser Function yyparse.
Macro to pretend that a syntax error has just been detected: call
yyerror and then perform normal error recovery if possible
(see section 6. Error Recovery), or (if recovery is impossible) make
yyparse return 1. See section 6. Error Recovery.
YYERROR_VERBOSE
Macro that you define with #define in the Bison declarations
section to request verbose, specific error message strings when
yyerror is called.
External integer variable that contains the integer value of the
current look-ahead token. (In a pure parser, it is a local variable
within yyparse.) Error-recovery rule actions may examine this
variable. See section Special Features for Use in Actions.
yyclearin
Macro used in error-recovery rule actions. It clears the previous
look-ahead token. See section 6. Error Recovery.
yydebug
External integer variable set to zero by default. If yydebug
is given a nonzero value, the parser will output information on input
symbols and parser action. See section Debugging Your Parser.
yyerrok
Macro to cause parser to recover immediately to its normal mode
after a parse error. See section 6. Error Recovery.
yyerror
User-supplied function to be called by yyparse on error. The
function receives one argument, a pointer to a character string
containing an error message. See section The Error Reporting Function yyerror.
External variable in which yylex should place the semantic
value associated with a token. (In a pure parser, it is a local
variable within yyparse, and its address is passed to
yylex.) See section Semantic Values of Tokens.
yylloc
External variable in which yylex should place the line and
column numbers associated with a token. (In a pure parser, it is a
local variable within yyparse, and its address is passed to
yylex.) You can ignore this variable if you don't use the
`@' feature in the grammar actions. See section Textual Positions of Tokens.
yynerrs
Global variable which Bison increments each time there is a parse
error. (In a pure parser, it is a local variable within
yyparse.) See section The Error Reporting Function yyerror.
yyparse
The parser function produced by Bison; call this function to start
parsing. See section The Parser Function yyparse.
%left
Bison declaration to assign left associativity to token(s).
See section Operator Precedence.
Bison declaration to use Bison internal token code numbers in token
tables instead of the usual Yacc-compatible token code numbers.
See section 3.6.8 Bison Declaration Summary.
%right
Bison declaration to assign right associativity to token(s).
See section Operator Precedence.
%start
Bison declaration to specify the start symbol. See section The Start-Symbol.
%token
Bison declaration to declare token(s) without specifying precedence.
See section Token Type Names.
Bison declaration to specify several possible data types for semantic
values. See section The Collection of Value Types.
These are the punctuation and delimiters used in Bison input:
`%%'
Delimiter used to separate the grammar rule section from the
Bison declarations section or the additional C code section.
See section The Overall Layout of a Bison Grammar.
`%{ %}'
All code listed between `%{' and `%}' is copied directly
to the output file uninterpreted. Such code forms the "C
declarations" section of the input file. See section Outline of a Bison Grammar.
This document was generated
by Frank B. Brokken on January, 28 2005
using texi2html
bisonc++-6.09.01/documentation/html/bison_14.html 0000664 0001750 0001750 00000023764 14700504612 020414 0 ustar frank frank
Bison 2.21.5: Glossary
Formal method of specifying context-free grammars. BNF was first used
in the ALGOL-60 report, 1963. See section Languages and Context-Free Grammars.
Context-free grammars
Grammars specified as rules that can be applied regardless of context.
Thus, if there is a rule which says that an integer can be used as an
expression, integers are allowed anywhere an expression is
permitted. See section Languages and Context-Free Grammars.
Dynamic allocation
Allocation of memory that occurs during execution, rather than at
compile time or on entry to a function.
Empty string
Analogous to the empty set in set theory, the empty string is a
character string of length zero.
Finite-state stack machine
A "machine" that has discrete states in which it is said to exist at
each instant in time. As input to the machine is processed, the
machine moves from state to state as specified by the logic of the
machine. In the case of the parser, the input is the language being
parsed, and the states correspond to various stages in the grammar
rules. See section The Bison Parser Algorithm .
Grouping
A language construct that is (in general) grammatically divisible;
for example, `expression' or `declaration' in C.
See section Languages and Context-Free Grammars.
Infix operator
An arithmetic operator that is placed between the operands on which it
performs some operation.
Input stream
A continuous flow of data between devices or programs.
Language construct
One of the typical usage schemas of the language. For example, one of
the constructs of the C language is the if statement.
See section Languages and Context-Free Grammars.
Left associativity
Operators having left associativity are analyzed from left to right:
`a+b+c' first computes `a+b' and then combines with
`c'. See section Operator Precedence.
Left recursion
A rule whose result symbol is also its first component symbol;
for example, `expseq1 : expseq1 ',' exp;'. See section Recursive Rules.
Left-to-right parsing
Parsing a sentence of a language by analyzing it token by token from
left to right. See section The Bison Parser Algorithm .
A token already read but not yet shifted. See section Look-Ahead Tokens.
LALR(1)
The class of context-free grammars that Bison (like most other parser
generators) can handle; a subset of LR(1). See section Mysterious Reduce/Reduce Conflicts.
LR(1)
The class of context-free grammars in which at most one token of
look-ahead is needed to disambiguate the parsing of any piece of input.
Nonterminal symbol
A grammar symbol standing for a grammatical construct that can
be expressed through rules in terms of smaller constructs; in other
words, a construct that is not a token. See section 3.2 Symbols, Terminal and Nonterminal.
Parse error
An error encountered during parsing of an input stream due to invalid
syntax. See section 6. Error Recovery.
Parser
A function that recognizes valid sentences of a language by analyzing
the syntax structure of a set of tokens passed to it from a lexical
analyzer.
Postfix operator
An arithmetic operator that is placed after the operands upon which it
performs some operation.
Reduction
Replacing a string of nonterminals and/or terminals with a single
nonterminal, according to a grammar rule. See section The Bison Parser Algorithm .
Reentrant
A reentrant subprogram is a subprogram which can be in invoked any
number of times in parallel, without interference between the various
invocations. See section A Pure (Reentrant) Parser.
Reverse polish notation
A language in which all operators are postfix operators.
Right recursion
A rule whose result symbol is also its last component symbol;
for example, `expseq1: exp ',' expseq1;'. See section Recursive Rules.
Semantics
In computer languages, the semantics are specified by the actions
taken for each instance of the language, i.e., the meaning of
each statement. See section Defining Language Semantics.
Shift
A parser is said to shift when it makes the choice of analyzing
further input from the stream rather than reducing immediately some
already-recognized rule. See section The Bison Parser Algorithm .
The nonterminal symbol that stands for a complete valid utterance in
the language being parsed. The start symbol is usually listed as the
first nonterminal symbol in a language specification.
See section The Start-Symbol.
Symbol table
A data structure where symbol names and associated data are stored
during parsing to allow for recognition and use of existing
information in repeated uses of a symbol. See section 2.4 Multi-Function Calculator: mfcalc.
Token
A basic, grammatically indivisible unit of a language. The symbol
that describes a token in the grammar is a terminal symbol.
The input of the Bison parser is a stream of tokens which comes from
the lexical analyzer. See section 3.2 Symbols, Terminal and Nonterminal.
Terminal symbol
A grammar symbol that has no rules in the grammar and therefore
is grammatically indivisible. The piece of text it represents
is a token. See section Languages and Context-Free Grammars.
This document was generated
by Frank B. Brokken on January, 28 2005
using texi2html
bisonc++-6.09.01/documentation/html/bison_11.html 0000664 0001750 0001750 00000015154 14700504612 020403 0 ustar frank frank
Bison 2.21.5: Debugging
If a Bison grammar compiles properly but doesn't do what you want when it
runs, the yydebug parser-trace feature can help you figure out why.
To enable compilation of trace facilities, you must define the macro
YYDEBUG when you compile the parser. You could use
`-DYYDEBUG=1' as a compiler option or you could put `#define
YYDEBUG 1' in the C declarations section of the grammar file
(see section The C Declarations Section). Alternatively, use the `-t' option when
you run Bison (see section Invoking Bison). We always define YYDEBUG so that
debugging is always possible.
The trace facility uses stderr, so you must add #include
<stdio.h> to the C declarations section unless it is already there.
Once you have compiled the program with trace facilities, the way to
request a trace is to store a nonzero value in the variable yydebug.
You can do this by making the C code do it (in main, perhaps), or
you can alter the value with a C debugger.
Each step taken by the parser when yydebug is nonzero produces a
line or two of trace information, written on stderr. The trace
messages tell you these things:
Each time the parser calls yylex, what kind of token was read.
Each time a token is shifted, the depth and complete contents of the
state stack (see section 5.5 Parser States).
Each time a rule is reduced, which rule it is, and the complete contents
of the state stack afterward.
To make sense of this information, it helps to refer to the listing file
produced by the Bison `-v' option (see section Invoking Bison). This file
shows the meaning of each state in terms of positions in various rules, and
also what each state will do with each possible input token. As you read
the successive trace messages, you can see that the parser is functioning
according to its specification in the listing file. Eventually you will
arrive at the place where something undesirable happens, and you will see
which parts of the grammar are to blame.
The parser file is a C program and you can use C debuggers on it, but it's
not easy to interpret what it is doing. The parser function is a
finite-state machine interpreter, and aside from the actions it executes
the same code over and over. Only the values of variables show where in
the grammar it is working.
The debugging information normally gives the token type of each token
read, but not its semantic value. You can optionally define a macro
named YYPRINT to provide a way to print the value. If you define
YYPRINT, it should take three arguments. The parser will pass a
standard I/O stream, the numeric code for the token type, and the token
value (from yylval).
Here is an example of YYPRINT suitable for the multi-function
calculator (see section Declarations for mfcalc):
This document was generated
by Frank B. Brokken on January, 28 2005
using texi2html
bisonc++-6.09.01/documentation/html/bison_4.html 0000664 0001750 0001750 00000070002 14700504612 020316 0 ustar frank frank
Bison 2.21.5: Concepts
This chapter introduces many of the basic concepts without which the
details of Bison will not make sense. If you do not already know how to
use Bison or Yacc, we suggest you start by reading this chapter carefully.
In order for Bison to parse a language, it must be described by a
context-free grammar. This means that you specify one or more
syntactic groupings and give rules for constructing them from their
parts. For example, in the C language, one kind of grouping is called an
`expression'. One rule for making an expression might be, "An expression
can be made of a minus sign and another expression". Another would be,
"An expression can be an integer". As you can see, rules are often
recursive, but there must be at least one rule which leads out of the
recursion.
The most common formal system for presenting such rules for humans to read
is Backus-Naur Form or "BNF", which was developed in order to
specify the language Algol 60. Any grammar expressed in BNF is a
context-free grammar. The input to Bison is essentially machine-readable
BNF.
Not all context-free languages can be handled by Bison, only those
that are LALR(1). In brief, this means that it must be possible to
tell how to parse any portion of an input string with just a single
token of look-ahead. Strictly speaking, that is a description of an
LR(1) grammar, and LALR(1) involves additional restrictions that are
hard to explain simply; but it is rare in actual practice to find an
LR(1) grammar that fails to be LALR(1). See section Mysterious Reduce/Reduce Conflicts, for more information on this.
In the formal grammatical rules for a language, each kind of syntactic unit
or grouping is named by a symbol. Those which are built by grouping
smaller constructs according to grammatical rules are called
nonterminal symbols; those which can't be subdivided are called
terminal symbols or token types. We call a piece of input
corresponding to a single terminal symbol a token, and a piece
corresponding to a single nonterminal symbol a grouping.
We can use the C language as an example of what symbols, terminal and
nonterminal, mean. The tokens of C are identifiers, constants (numeric and
string), and the various keywords, arithmetic operators and punctuation
marks. So the terminal symbols of a grammar for C include `identifier',
`number', `string', plus one symbol for each keyword, operator or
punctuation mark: `if', `return', `const', `static', `int', `char',
`plus-sign', `open-brace', `close-brace', `comma' and many more. (These
tokens can be subdivided into characters, but that is a matter of
lexicography, not grammar.)
Here is a simple C function subdivided into tokens:
The syntactic groupings of C include the expression, the statement, the
declaration, and the function definition. These are represented in the
grammar of C by nonterminal symbols `expression', `statement',
`declaration' and `function definition'. The full grammar uses dozens of
additional language constructs, each with its own nonterminal symbol, in
order to express the meanings of these four. The example above is a
function definition; it contains one declaration, and one statement. In
the statement, each `x' is an expression and so is `x * x'.
Each nonterminal symbol must have grammatical rules showing how it is made
out of simpler constructs. For example, one kind of C statement is the
return statement; this would be described with a grammar rule which
reads informally as follows:
A `statement' can be made of a `return' keyword, an `expression' and a
`semicolon'.
There would be many other rules for `statement', one for each kind of
statement in C.
One nonterminal symbol must be distinguished as the special one which
defines a complete utterance in the language. It is called the start
symbol. In a compiler, this means a complete input program. In the C
language, the nonterminal symbol `sequence of definitions and declarations'
plays this role.
For example, `1 + 2' is a valid C expression--a valid part of a C
program--but it is not valid as an entire C program. In the
context-free grammar of C, this follows from the fact that `expression' is
not the start symbol.
The Bison parser reads a sequence of tokens as its input, and groups the
tokens using the grammar rules. If the input is valid, the end result is
that the entire token sequence reduces to a single grouping whose symbol is
the grammar's start symbol. If we use a grammar for C, the entire input
must be a `sequence of definitions and declarations'. If not, the parser
reports a syntax error.
A formal grammar is a mathematical construct. To define the language
for Bison, you must write a file expressing the grammar in Bison syntax:
a Bison grammar file. See section Bison Grammar Files.
A nonterminal symbol in the formal grammar is represented in Bison input
as an identifier, like an identifier in C. By convention, it should be
in lower case, such as expr, stmt or declaration.
The Bison representation for a terminal symbol is also called a token
type. Token types as well can be represented as C-like identifiers. By
convention, these identifiers should be upper case to distinguish them from
nonterminals: for example, INTEGER, IDENTIFIER, IF or
RETURN. A terminal symbol that stands for a particular keyword in
the language should be named after that keyword converted to upper case.
The terminal symbol error is reserved for error recovery.
See section 3.2 Symbols, Terminal and Nonterminal.
A terminal symbol can also be represented as a character literal, just like
a C character constant. You should do this whenever a token is just a
single character (parenthesis, plus-sign, etc.): use that same character in
a literal as the terminal symbol for that token.
A third way to represent a terminal symbol is with a C string constant
containing several characters. See section 3.2 Symbols, Terminal and Nonterminal, for more information.
The grammar rules also have an expression in Bison syntax. For example,
here is the Bison rule for a C return statement. The semicolon in
quotes is a literal character token, representing part of the C syntax for
the statement; the naked semicolon, and the colon, are Bison punctuation
used in every rule.
A formal grammar selects tokens only by their classifications: for example,
if a rule mentions the terminal symbol `integer constant', it means that
any integer constant is grammatically valid in that position. The
precise value of the constant is irrelevant to how to parse the input: if
`x+4' is grammatical then `x+1' or `x+3989' is equally
grammatical.
But the precise value is very important for what the input means once it is
parsed. A compiler is useless if it fails to distinguish between 4, 1 and
3989 as constants in the program! Therefore, each token in a Bison grammar
has both a token type and a semantic value. See section Defining Language Semantics,
for details.
The token type is a terminal symbol defined in the grammar, such as
INTEGER, IDENTIFIER or ','. It tells everything
you need to know to decide where the token may validly appear and how to
group it with other tokens. The grammar rules know nothing about tokens
except their types.
The semantic value has all the rest of the information about the
meaning of the token, such as the value of an integer, or the name of an
identifier. (A token such as ',' which is just punctuation doesn't
need to have any semantic value.)
For example, an input token might be classified as token type
INTEGER and have the semantic value 4. Another input token might
have the same token type INTEGER but value 3989. When a grammar
rule says that INTEGER is allowed, either of these tokens is
acceptable because each is an INTEGER. When the parser accepts the
token, it keeps track of the token's semantic value.
Each grouping can also have a semantic value as well as its nonterminal
symbol. For example, in a calculator, an expression typically has a
semantic value that is a number. In a compiler for a programming
language, an expression typically has a semantic value that is a tree
structure describing the meaning of the expression.
In order to be useful, a program must do more than parse input; it must
also produce some output based on the input. In a Bison grammar, 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.
See section 3.5.3 Actions.
Most of the time, the purpose of an action is to compute the semantic value
of the whole construct from the semantic values of its parts. For example,
suppose we have a rule which says an expression can be the sum of two
expressions. When the parser recognizes such a sum, each of the
subexpressions has a semantic value which describes how it was built up.
The action for this rule should create a similar sort of value for the
newly recognized larger expression.
For example, here is a rule that says an expression can be the sum of
two subexpressions:
expr: expr '+' expr { $$ = $1 + $3; }
;
The action says how to produce the semantic value of the sum expression
from the values of the two subexpressions.
When you run Bison, you give it a Bison grammar file as input. The output
is a C source file that parses the language described by the grammar.
This file is called a Bison parser. Keep in mind that the Bison
utility and the Bison parser are two distinct programs: the Bison utility
is a program whose output is the Bison parser that becomes part of your
program.
The job of the Bison parser is to group tokens into groupings according to
the grammar rules--for example, to build identifiers and operators into
expressions. As it does this, it runs the actions for the grammar rules it
uses.
The tokens come from a function called the lexical analyzer that you
must supply in some fashion (such as by writing it in C). The Bison parser
calls the lexical analyzer each time it wants a new token. It doesn't know
what is "inside" the tokens (though their semantic values may reflect
this). Typically the lexical analyzer makes the tokens by parsing
characters of text, but Bison does not depend on this. See section The Lexical Analyzer Function yylex.
The Bison parser file is C code which defines a function named
yyparse which implements that grammar. This function does not make
a complete C program: you must supply some additional functions. One is
the lexical analyzer. Another is an error-reporting function which the
parser calls to report an error. In addition, a complete C program must
start with a function called main; you have to provide this, and
arrange for it to call yyparse or the parser will never run.
See section Parser C-Language Interface.
Aside from the token type names and the symbols in the actions you
write, all variable and function names used in the Bison parser file
begin with `yy' or `YY'. This includes interface functions
such as the lexical analyzer function yylex, the error reporting
function yyerror and the parser function yyparse itself.
This also includes numerous identifiers used for internal purposes.
Therefore, you should avoid using C identifiers starting with `yy'
or `YY' in the Bison grammar file except for the ones defined in
this manual.
The actual language-design process using Bison, from grammar specification
to a working compiler or interpreter, has these parts:
Formally specify the grammar in a form recognized by Bison
(see section Bison Grammar Files). For each grammatical rule in the language,
describe the action that is to be taken when an instance of that rule
is recognized. The action is described by a sequence of C statements.
Write a lexical analyzer to process input and pass tokens to the
parser. The lexical analyzer may be written by hand in C
(see section The Lexical Analyzer Function yylex). It could also be produced using Lex, but the use
of Lex is not discussed in this manual.
Write a controlling function that calls the Bison-produced parser.
Write error-reporting routines.
To turn this source code as written into a runnable program, you
must follow these steps:
Run Bison on the grammar to produce the parser.
Compile the code output by Bison, as well as any other source files.
Link the object files to produce the finished product.
The input file for the Bison utility is a Bison grammar file. The
general form of a Bison grammar file is as follows:
%{
C declarations
%}
Bison declarations
%%
Grammar rules
%%
Additional C code
The `%%', `%{' and `%}' are punctuation that appears
in every Bison grammar file to separate the sections.
The C declarations may define types and variables used in the actions.
You can also use preprocessor commands to define macros used there, and use
#include to include header files that do any of these things.
The Bison declarations declare the names of the terminal and nonterminal
symbols, and may also describe operator precedence and the data types of
semantic values of various symbols.
The grammar rules define how to construct each nonterminal symbol from its
parts.
The additional C code can contain any C code you want to use. Often the
definition of the lexical analyzer yylex goes here, plus subroutines
called by the actions in the grammar rules. In a simple program, all the
rest of the program can go here.
This document was generated
by Frank B. Brokken on January, 28 2005
using texi2html
bisonc++-6.09.01/documentation/html/bison_ovr.html 0000664 0001750 0001750 00000005267 14700504612 020774 0 ustar frank frank
Bison 2.21.5: Short Table of Contents
This document was generated
by Frank B. Brokken on January, 28 2005
using texi2html
bisonc++-6.09.01/documentation/html/bison_toc.html 0000664 0001750 0001750 00000022653 14700504612 020751 0 ustar frank frank
Bison 2.21.5: Table of Contents
This document was generated
by Frank B. Brokken on January, 28 2005
using texi2html
bisonc++-6.09.01/documentation/html/bison_3.html 0000664 0001750 0001750 00000056347 14700504612 020335 0 ustar frank frank
Bison 2.21.5: Copying
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, 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 show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
one line to give the program's name and a brief idea of what it does.
Copyright (C) 19yyname of author
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) 19yyname of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details
type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show
the appropriate parts of the General Public License. Of course, the
commands you use may be called something other than `show w' and
`show c'; they could even be mouse-clicks or menu items--whatever
suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
signature of Ty Coon, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
Public License instead of this License.
This document was generated
by Frank B. Brokken on January, 28 2005
using texi2html
bisonc++-6.09.01/documentation/html/bison_15.html 0000664 0001750 0001750 00000062755 14700504612 020420 0 ustar frank frank
Bison 2.21.5: Index
This document was generated
by Frank B. Brokken on January, 28 2005
using texi2html
bisonc++-6.09.01/documentation/html/bison_7.html 0000664 0001750 0001750 00000077432 14700504612 020337 0 ustar frank frank
Bison 2.21.5: Interface
The Bison parser is actually a C function named yyparse. Here we
describe the interface conventions of yyparse and the other
functions that it needs to use.
Keep in mind that the parser uses many C identifiers starting with
`yy' and `YY' for internal purposes. If you use such an
identifier (aside from those in this manual) in an action or in additional
C code in the grammar file, you are likely to run into trouble.
You call the function yyparse to cause parsing to occur. This
function reads tokens, executes actions, and ultimately returns when it
encounters end-of-input or an unrecoverable syntax error. You can also
write an action which directs yyparse to return immediately without
reading further.
The value returned by yyparse is 0 if parsing was successful (return
is due to end-of-input).
The value is 1 if parsing failed (return is due to a syntax error).
In an action, you can cause immediate return from yyparse by using
these macros:
YYACCEPT
Return immediately with value 0 (to report success).
YYABORT
Return immediately with value 1 (to report failure).
The lexical analyzer function, yylex, recognizes tokens from
the input stream and returns them to the parser. Bison does not create
this function automatically; you must write it so that yyparse can
call it. The function is sometimes referred to as a lexical scanner.
In simple programs, yylex is often defined at the end of the Bison
grammar file. If yylex is defined in a separate source file, you
need to arrange for the token-type macro definitions to be available there.
To do this, use the `-d' option when you run Bison, so that it will
write these macro definitions into a separate header file
`name.tab.h' which you can include in the other source files
that need it. See section Invoking Bison.
The value that yylex returns must be the numeric code for the type
of token it has just found, or 0 for end-of-input.
When a token is referred to in the grammar rules by a name, that name
in the parser file becomes a C macro whose definition is the proper
numeric code for that token type. So yylex can use the name
to indicate that type. See section 3.2 Symbols, Terminal and Nonterminal.
When a token is referred to in the grammar rules by a character literal,
the numeric code for that character is also the code for the token type.
So yylex can simply return that character code. The null character
must not be used this way, because its code is zero and that is what
signifies end-of-input.
Here is an example showing these things:
yylex ()
{
...
if (c == EOF) /* Detect end of file. */
return 0;
...
if (c == '+' || c == '-')
return c; /* Assume token type for `+' is '+'. */
...
return INT; /* Return the type of the token. */
...
}
This interface has been designed so that the output from the lex
utility can be used without change as the definition of yylex.
If the grammar uses literal string tokens, there are two ways that
yylex can determine the token type codes for them:
If the grammar defines symbolic token names as aliases for the
literal string tokens, yylex can use these symbolic names like
all others. In this case, the use of the literal string tokens in
the grammar file has no effect on yylex.
yylex can find the multi-character token in the yytname
table. The index of the token in the table is the token type's code.
The name of a multi-character token is recorded in yytname with a
double-quote, the token's characters, and another double-quote. The
token's characters are not escaped in any way; they appear verbatim in
the contents of the string in the table.
Here's code for looking up a token in yytname, assuming that the
characters of the token are stored in token_buffer.
In an ordinary (nonreentrant) parser, the semantic value of the token must
be stored into the global variable yylval. When you are using
just one data type for semantic values, yylval has that type.
Thus, if the type is int (the default), you might write this in
yylex:
...
yylval = value; /* Put value onto Bison stack. */
return INT; /* Return the type of the token. */
...
When you are using multiple data types, yylval's type is a union
made from the %union declaration (see section The Collection of Value Types). So when
you store a token's value, you must use the proper member of the union.
If the %union declaration looks like this:
%union {
int intval;
double val;
symrec *tptr;
}
then the code in yylex might look like this:
...
yylval.intval = value; /* Put value onto Bison stack. */
return INT; /* Return the type of the token. */
...
If you are using the `@n'-feature (see section Special Features for Use in Actions) in
actions to keep track of the textual locations of tokens and groupings,
then you must provide this information in yylex. The function
yyparse expects to find the textual location of a token just parsed
in the global variable yylloc. So yylex must store the
proper data in that variable. The value of yylloc is a structure
and you need only initialize the members that are going to be used by the
actions. The four members are called first_line,
first_column, last_line and last_column. Note that
the use of this feature makes the parser noticeably slower.
When you use the Bison declaration %pure_parser to request a
pure, reentrant parser, the global communication variables yylval
and yylloc cannot be used. (See section A Pure (Reentrant) Parser.) In such parsers the two global variables are replaced by
pointers passed as arguments to yylex. You must declare them as
shown here, and pass the information back by storing it through those
pointers.
yylex (lvalp, llocp)
YYSTYPE *lvalp;
YYLTYPE *llocp;
{
...
*lvalp = value; /* Put value onto Bison stack. */
return INT; /* Return the type of the token. */
...
}
If the grammar file does not use the `@' constructs to refer to
textual positions, then the type YYLTYPE will not be defined. In
this case, omit the second argument; yylex will be called with
only one argument.
If you use a reentrant parser, you can optionally pass additional
parameter information to it in a reentrant way. To do so, define the
macro YYPARSE_PARAM as a variable name. This modifies the
yyparse function to accept one argument, of type void *,
with that name.
When you call yyparse, pass the address of an object, casting the
address to void *. The grammar actions can refer to the contents
of the object by casting the pointer value back to its proper type and
then dereferencing it. Here's an example. Write this in the parser:
%{
struct parser_control
{
int nastiness;
int randomness;
};
#define YYPARSE_PARAM parm
%}
Then call the parser like this:
struct parser_control
{
int nastiness;
int randomness;
};
...
{
struct parser_control foo;
... /* Store proper data in foo. */
value = yyparse ((void *) &foo);
...
}
In the grammar actions, use expressions like this to refer to the data:
((struct parser_control *) parm)->randomness
If you wish to pass the additional parameter data to yylex,
define the macro YYLEX_PARAM just like YYPARSE_PARAM, as
shown here:
%{
struct parser_control
{
int nastiness;
int randomness;
};
#define YYPARSE_PARAM parm
#define YYLEX_PARAM parm
%}
You should then define yylex to accept one additional
argument--the value of parm. (This makes either two or three
arguments in total, depending on whether an argument of type
YYLTYPE is passed.) You can declare the argument as a pointer to
the proper object type, or you can declare it as void * and
access the contents as shown above.
You can use `%pure_parser' to request a reentrant parser without
also using YYPARSE_PARAM. Then you should call yyparse
with no arguments, as usual.
The Bison parser detects a parse error or syntax error
whenever it reads a token which cannot satisfy any syntax rule. A
action in the grammar can also explicitly proclaim an error, using the
macro YYERROR (see section Special Features for Use in Actions).
The Bison parser expects to report the error by calling an error
reporting function named yyerror, which you must supply. It is
called by yyparse whenever a syntax error is found, and it
receives one argument. For a parse error, the string is normally
"parse error".
If you define the macro YYERROR_VERBOSE in the Bison declarations
section (see section The Bison Declarations Section), then Bison provides a more verbose
and specific error message string instead of just plain "parse
error". It doesn't matter what definition you use for
YYERROR_VERBOSE, just whether you define it.
The parser can detect one other kind of error: stack overflow. This
happens when the input contains constructions that are very deeply
nested. It isn't likely you will encounter this, since the Bison
parser extends its stack automatically up to a very large limit. But
if overflow happens, yyparse calls yyerror in the usual
fashion, except that the argument string is "parser stack
overflow".
The following definition suffices in simple programs:
yyerror (s)
char *s;
{
fprintf (stderr, "%s\n", s);
}
After yyerror returns to yyparse, the latter will attempt
error recovery if you have written suitable error recovery grammar rules
(see section 6. Error Recovery). If recovery is impossible, yyparse will
immediately return 1.
The variable yynerrs contains the number of syntax errors
encountered so far. Normally this variable is global; but if you
request a pure parser (see section A Pure (Reentrant) Parser) then it is a local variable
which only the actions can access.
Unshift a token. This macro is allowed only for rules that reduce
a single value, and only when there is no look-ahead token.
It installs a look-ahead token with token type token and
semantic value value; then it discards the value that was
going to be reduced by this rule.
If the macro is used when it is not valid, such as when there is
a look-ahead token already, then it reports a syntax error with
a message `cannot back up' and performs ordinary error
recovery.
In either case, the rest of the action is not executed.
`YYEMPTY'
Value stored in yychar when there is no look-ahead token.
`YYERROR;'
Cause an immediate syntax error. This statement initiates error
recovery just as if the parser itself had detected an error; however, it
does not call yyerror, and does not print any message. If you
want to print an error message, call yyerror explicitly before
the `YYERROR;' statement. See section 6. Error Recovery.
`YYRECOVERING'
This macro stands for an expression that has the value 1 when the parser
is recovering from a syntax error, and 0 the rest of the time.
See section 6. Error Recovery.
`yychar'
Variable containing the current look-ahead token. (In a pure parser,
this is actually a local variable within yyparse.) When there is
no look-ahead token, the value YYEMPTY is stored in the variable.
See section Look-Ahead Tokens.
`yyclearin;'
Discard the current look-ahead token. This is useful primarily in
error rules. See section 6. Error Recovery.
`yyerrok;'
Resume generating error messages immediately for subsequent syntax
errors. This is useful primarily in error rules.
See section 6. Error Recovery.
`@n'
Acts like a structure variable containing information on the line
numbers and column numbers of the nth component of the current
rule. The structure has four members, like this:
struct {
int first_line, last_line;
int first_column, last_column;
};
Thus, to get the starting line number of the third component, you would
use `@3.first_line'.
In order for the members of this structure to contain valid information,
you must make yylex supply this information about each token.
If you need only certain members, then yylex need only fill in
those members.
The use of this feature makes the parser noticeably slower.