definition, which is kept in the header @file{calc.h}, is as follows. It
provides for either functions or variables to be placed in the table.
-@c FIXME: ANSIfy the prototypes for FNCTPTR etc.
@smallexample
@group
+/* Fonctions type. */
+typedef double (*func_t) (double);
+
/* 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 */
+ union
+ @{
+ double var; /* value of a VAR */
+ func_t fnctptr; /* value of a FNCT */
@} value;
struct symrec *next; /* link field */
@};
/* The symbol table: a chain of `struct symrec'. */
extern symrec *sym_table;
-symrec *putsym ();
-symrec *getsym ();
+symrec *putsym (const char *, func_t);
+symrec *getsym (const char *);
@end group
@end smallexample
struct init
@{
char *fname;
- double (*fnct)();
+ double (*fnct)(double);
@};
@end group
@group
struct init arith_fncts[] =
@{
- "sin", sin,
- "cos", cos,
+ "sin", sin,
+ "cos", cos,
"atan", atan,
- "ln", log,
- "exp", exp,
+ "ln", log,
+ "exp", exp,
"sqrt", sqrt,
0, 0
@};
/* The symbol table: a chain of `struct symrec'. */
-symrec *sym_table = (symrec *)0;
+symrec *sym_table = (symrec *) 0;
@end group
@group
called @file{foo.tab.c} by default. As a consequence, the verbose
output file is called @file{foo.output}.@refill
-@item %raw
-The output file @file{@var{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.)
-
@item %token_table
Generate an array of token names in the parser file. The name of the
array is @code{yytname}; @code{yytname[@var{i}]} is the name of the
@itemx --no-parser
Pretend that @code{%no_parser} was specified. @xref{Decl Summary}.
-@item -r
-@itemx --raw
-Pretend that @code{%raw} was specified. @xref{Decl Summary}.
-
@item -k
@itemx --token-table
Pretend that @code{%token_table} was specified. @xref{Decl Summary}.
\line{ --no-lines \leaderfill -l}
\line{ --no-parser \leaderfill -n}
\line{ --output-file \leaderfill -o}
-\line{ --raw \leaderfill -r}
\line{ --token-table \leaderfill -k}
\line{ --verbose \leaderfill -v}
\line{ --version \leaderfill -V}
--no-lines -l
--no-parser -n
--output-file=@var{outfile} -o @var{outfile}
---raw -r
--token-table -k
--verbose -v
--version -V
Bison declaration to request a pure (reentrant) parser.
@xref{Pure Decl, ,A Pure (Reentrant) Parser}.
-@item %raw
-Bison declaration to use Bison internal token code numbers in token
-tables instead of the usual Yacc-compatible token code numbers.
-@xref{Decl Summary}.
-
@item %right
Bison declaration to assign right associativity to token(s).
@xref{Precedence Decl, ,Operator Precedence}.