Bison Syntax Error Unexpected Identifier Expecting String
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring syntax error unexpected expecting identifier t_string developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask
Syntax Error Unexpected List T_list Expecting Identifier T_string
Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join syntax error unexpected identifier expecting class them; it only takes a minute: Sign up Bison unexpected indentifier error up vote 0 down vote favorite %{ #include
Near Syntax Error Unexpected Expecting Identifier Or Type_identifier
{ yyparse(); } %} %token TOKMACHINE TOKLOGIN TOKPASSWORD VALUE SPACE NEWLINE input: auth input | input; delim: SPACE | NEWLINE; auth: TOKMACHINE delim VALUE delim TOKLOGIN delim VALUE delim TOKPASSWORD delim VALUE delim { printf("Found auth {%s,%s,%s}", $1,$3,$5); }; Here is simple bison grammar, with which I want to parse .netrc file. But I get error on input line: netrc.y:23.1-5: syntax error, unexpected identifier: I am new to Flex/Bison, but this example near literal copy from here c bison syntax error unexpected identifier mongodb share|improve this question edited Aug 24 '12 at 18:28 Jens 36.2k863104 asked Aug 24 '12 at 18:18 KAction 1,035718 Line 23 is input: auth input | input;; columns 1-5 are the identifier input, which seems to be what it's complaining about. I don't remember bison well enough to figure out the problem. –Keith Thompson Aug 24 '12 at 18:25 This is anything but a near literal copy. Look at the original example exactly and you'll spot a handful of differences, all resulting in various errors. Yacc is unforgiving. –Jens Aug 24 '12 at 18:46 @Jens Of course, this question is about Bison, not Yacc, but they are part of the same bestiary... ;-) –twalberg Aug 24 '12 at 20:00 add a comment| 2 Answers 2 active oldest votes up vote 2 down vote accepted Looks like you are missing the %% delimiter. Make that %} %token ... %% input : ... share|improve this answer answered Aug 24 '12 at 18:38 Jens 36.2k863104 I tried that myself on the OP's code. It gets rid of the error message but introduces several more, including fatal error: start symbol input does not derive any sentence. –Keith Thompson Aug 24 '12 at 18:41 That would spark another few questions, I guess :-) Contrary to the poster's claim, the referenced copy is vastly different. –Jens Aug 24 '12 a
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up syntax error, unexpected identifier, expecting type. yacc. bison up vote 0 down vote favorite I am making a calculator with the sum and subtraction operations this is my code... Calc.y %{ #include http://stackoverflow.com/questions/12114673/bison-unexpected-indentifier-error %} %union{ double dval; } %token NUMERO %token SUMA RESTA %token ABRIR CERRAR %token END %left SUMA RESTA %left NEG %type Expresion %start Input %% Input: Line | Input Line ; Line: END | Expresion END { printf("Resultado: %f\n",$1); } ; Expresion: NUMERO { $$=$1; } | Expresion SUMA Expresion { $$=$1+$3; } | Expresion RESTA Expresion { $$=$1-$3; } | RESTA Expresion %prec NEG { $$=-$2; } | ABRIR Expresion CERRAR { $$=$2; } ; %% int yyerror(char *s) http://stackoverflow.com/questions/20296057/syntax-error-unexpected-identifier-expecting-type-yacc-bison { printf("%s\n",s); } int main(void) { yyparse(); } And this is the error Calc.y:16.7-15: syntax error, unexpected identifier, expecting type bison yacc share|improve this question asked Nov 30 '13 at 3:11 user3051124 12 add a comment| 1 Answer 1 active oldest votes up vote 1 down vote The syntax of the %type directive is %type
Support Search GitHub This repository Watch 7 Star 43 Fork 18 xkbcommon/libxkbcommon Code Issues 4 Pull requests 2 Projects 0 Pulse Graphs New issue https://github.com/xkbcommon/libxkbcommon/issues/2 Fail in make project #2 Closed acacioegas opened this Issue Sep 17, 2013 · 10 comments Projects None yet Labels None yet Milestone No milestone Assignees No one assigned 4 participants acacioegas commented Sep 17, 2013 /src/xkbcomp/parser.y:48.17-24: syntax error, unexpected identifier, expecting string xkbcommon member bluetech commented Sep 18, 2013 Are you building from git? If not, which version? Can you attach syntax error the file 'config.log' from the build root? Thanks. xkbcommon member bluetech commented Sep 28, 2013 So I can only assume you're using some yacc which is not bison. I just made some commits which adds support for recent byacc as well. I'm not aware of any other widely used yacc's. Anything more than that is unlikely - either bison or byacc should syntax error unexpected be sufficient. Feel free to reopen if this is not the case. bluetech closed this Sep 28, 2013 ballifatih commented Nov 29, 2015 Hi, When trying to build library, I am getting similar error. I am using OS X Yosemite, and trying to port this library to MacPorts, as it is required as dependency. I attached the config.log file. YACC src/xkbcomp/parser.c /Users/blue/Downloads/libxkbcommon-0.5.0/src/xkbcomp/parser.y:220.5-9: syntax error, unexpected type, expecting string or identifier make: *** [src/xkbcomp/parser.c] Error 1 As for yacc, checking the version returns: bison (GNU Bison) 2.3 Written by Robert Corbett and Richard Stallman. I am using the version 5.0 from http://lists.freedesktop.org/archives/wayland-devel/2014-October/017836.html nuko8 commented Nov 30, 2015 As @bluetech pointed out in Issue #23, Bison 2.3 is too old to compile parser.y. I've successfully built libxkbcommon with Bison 3.0.4 on both Mavericks and El Capitan. I installed that Bison via MacPorts :-) ballifatih commented Nov 30, 2015 Yeah, after getting updated version of Bison, finally it passed the yacc parsing problem. (It took some time to realize almost every tool coming default with OS X is older versions). But now I am getting complaints that CCL