|Debug Trace Mode in (YACC & BISON) and (Lex & Flex) firstname.lastname@example.org (peteolcott) (2017-06-15)|
|Date:||Thu, 15 Jun 2017 15:30:22 -0700 (PDT)|
|Injection-Info:||miucha.iecc.com; posting-host="news.iecc.com:2001:470:1f07:1126:0:676f:7373:6970"; logging-data="8843"; mail-complaints-to="email@example.com"|
|Keywords:||yacc, lex, debug, comment|
|Posted-Date:||15 Jun 2017 18:51:06 EDT|
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]
Return to the
Search the comp.compilers archives again.