Buy the book!
|[ < ]||[ > ]||[ << ]||[ Up ]||[ >> ]||[Top]||[Contents]||[Index]||[ ? ]|
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 non-reentrant program may not be safe to call from a signal handler. In systems with multiple threads of control, a non-reentrant 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
Alternatively, you can generate a pure, reentrant parser. The Bison
%pure-parser says that you want the parser to be
reentrant. It looks like this:
The result is that the communication variables
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
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.
|webmaster donations bookstore||delorie software privacy|
|Copyright © 2003 by The Free Software Foundation||Updated Jun 2003|