Path: csiph.com!feeder.erje.net!2.us.feeder.erje.net!weretis.net!feeder6.news.weretis.net!news.glorb.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!news.iecc.com!.POSTED.news.iecc.com!nerds-end From: peteolcott Newsgroups: comp.compilers Subject: Debug Trace Mode in (YACC & BISON) and (Lex & Flex) Date: Thu, 15 Jun 2017 15:30:22 -0700 (PDT) Organization: Compilers Central Lines: 28 Sender: news@iecc.com Approved: comp.compilers@iecc.com Message-ID: <17-06-013@comp.compilers> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: miucha.iecc.com; posting-host="news.iecc.com:2001:470:1f07:1126:0:676f:7373:6970"; logging-data="8843"; mail-complaints-to="abuse@iecc.com" Keywords: yacc, lex, debug, comment Posted-Date: 15 Jun 2017 18:51:06 EDT X-submission-address: compilers@iecc.com X-moderator-address: compilers-request@iecc.com X-FAQ-and-archives: http://compilers.iecc.com X-Received-Bytes: 2013 X-Received-Body-CRC: 1580653926 Xref: csiph.com comp.compilers:1894 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]