Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.compilers > #1894 > unrolled thread
| Started by | peteolcott <peterolcott2@gmail.com> |
|---|---|
| First post | 2017-06-15 15:30 -0700 |
| Last post | 2017-06-15 15:30 -0700 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.compilers
Debug Trace Mode in (YACC & BISON) and (Lex & Flex) peteolcott <peterolcott2@gmail.com> - 2017-06-15 15:30 -0700
| From | peteolcott <peterolcott2@gmail.com> |
|---|---|
| Date | 2017-06-15 15:30 -0700 |
| Subject | Debug Trace Mode in (YACC & BISON) and (Lex & Flex) |
| Message-ID | <17-06-013@comp.compilers> |
lex & yacc by Levine, Mason & Brown very clearly and concisely explain the minimal required steps to invoke YACC/BISON Debug Trace Mode:
YYDEBUG must be defined in the declaration section of the "Y" file:
%{
#define YYDEBUG 1
%}
yydebug must be initialized in the main() of the "Y" file:
yydebug = 1;
BISON documentation clearly explains what YACC / BISON debug trace mode does:
YACC or BISON DEBUG TRACE PROVIDES:
(1) Each time the parser calls yylex, what kind of token was read.
(2) Each time a token is shifted, the depth and complete contents
of the state stack (see Parser States).
(3) Each time a rule is reduced, which rule it is, and the complete
contents of the state stack afterward.
This feature has worked since the 1.25 (1995) through the current 3.0.4 (2016) versions of Bison.
Flex only requires a comment line option of -d or --debug.
The -d option is supposed to also work with Lex.
This produces a list of each matched token and the corresponding "L" file line number where the match occurred.
[Uh, yes. Was there a question? -John]
Back to top | Article view | comp.compilers
csiph-web