[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
updating bison 1 pure parser calls
From: |
Mark Brethen |
Subject: |
updating bison 1 pure parser calls |
Date: |
Mon, 23 Nov 2015 19:15:34 -0600 |
I’m attempting to compile elkhound source, which uses bison 1 era pure parser
calls, but get these errors:
:info:build bison -d -v agrampar.y
:info:build mv -f agrampar.tab.c agrampar.tab.cc
:info:build grep -C 2 TOK agrampar.tab.h > agrampar.codes.h
:info:build c++ -c -o agrampar.tab.o agrampar.tab.cc -g -Wall -Wno-deprecated
-D__UNIX__ -O2 -DNDEBUG -I../smbase
:info:build agrampar.tab.c:1275:16: error: no matching function for call to
'agrampar_yylex'
:info:build yychar = yylex (&yylval);
:info:build ^~~~~
:info:build ./agrampar.h:60:15: note: expanded from macro 'yylex'
:info:build #define yylex agrampar_yylex
:info:build ^~~~~~~~~~~~~~
:info:build ./agrampar.h:59:5: note: candidate function not viable: requires 2
arguments, but 1 was provided
:info:build int agrampar_yylex(union YYSTYPE *lvalp, void *parseParam);
:info:build ^
:info:build agrampar.y:116:39: error: use of undeclared identifier 'parseParam'
:info:build { (yyval.file) = *((ASTSpecFile**)parseParam) = new
ASTSpecFile((yyvsp[0].formList)); }
:info:build ^
:info:build agrampar.tab.c:1840:7: error: use of undeclared identifier
'parseParam'
:info:build yyerror (YY_("syntax error"));
:info:build ^
:info:build ./agrampar.h:56:40: note: expanded from macro 'yyerror'
:info:build #define yyerror(m) agrampar_yyerror(m, YYPARSE_PARAM)
:info:build ^
:info:build ./agrampar.h:33:23: note: expanded from macro 'YYPARSE_PARAM'
:info:build #define YYPARSE_PARAM parseParam
:info:build ^
:info:build agrampar.tab.c:1984:3: error: use of undeclared identifier
'parseParam'
:info:build yyerror (YY_("memory exhausted"));
:info:build ^
:info:build ./agrampar.h:56:40: note: expanded from macro 'yyerror'
:info:build #define yyerror(m) agrampar_yyerror(m, YYPARSE_PARAM)
:info:build ^
:info:build ./agrampar.h:33:23: note: expanded from macro 'YYPARSE_PARAM'
:info:build #define YYPARSE_PARAM parseParam
:info:build ^
:info:build 4 errors generated.
A little research indicates that the call and parameters passed have changed
since then. Line 23 in agrampar.y has this declaration:
/* ================== bison declarations =================== */
// don't use globals
%pure_parser
while agrampar.h has:
// caller interface to Bison-generated parser; starts parsing
// (whatever stream lexer is reading) and returns 0 for success and
// 1 for error; the extra parameter is available to actions to use
#define YYPARSE_PARAM parseParam
int agrampar_yyparse(void *YYPARSE_PARAM);
Based on what I have read, I need to replace the declaration with:
/* ================== bison declarations =================== */
// don't use globals
%pure-parser
But I’m not sure I understand how to pass the arguments using bison 3 as was
done in agrampar.h.
Mark
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- updating bison 1 pure parser calls,
Mark Brethen <=