Bison -d does not create tab.h












0















I have a .y file that I trying to use with bison -d, but for some reason the .tab.h file is not being generated. Any suggestions?



My bison file in PasteBin:



%{
#include <stdio.h>
int yyerror(const char* err);
%}

%token G
%token INT
%token X
%token Y
%token Z
%token END
%token ZERO
%token EOL

%%

program: list_of_expr
;

list_of_expr: expr
| list_of_expr expr
;

expr: G INT X INT Y INT Z INT EOL
| ZERO EOL
| END
;

%%

int main(int argc, char** argv){
yyparse();
}
int yyerror(const char* err){
printf("%sn", err);
}









share|improve this question

























  • What exact command are you using? And what bison version?

    – rici
    Nov 20 '18 at 23:05













  • Which version of Bison are you using? Bison 2.3 on Linux (antique RHEL 5; Bison 2.3 is copyrighted 2006 — though it is also what's shipped with macOS 10.14.1 Mojave) takes your grammar as parse23.y and bison -d parse23.y generates parse23.tab.c and parse23.tab.h as you want (on both Linux and macOS). Which platform and which version of Bison are you using?

    – Jonathan Leffler
    Nov 20 '18 at 23:10













  • What is the name of your bison file?

    – rici
    Nov 20 '18 at 23:53
















0















I have a .y file that I trying to use with bison -d, but for some reason the .tab.h file is not being generated. Any suggestions?



My bison file in PasteBin:



%{
#include <stdio.h>
int yyerror(const char* err);
%}

%token G
%token INT
%token X
%token Y
%token Z
%token END
%token ZERO
%token EOL

%%

program: list_of_expr
;

list_of_expr: expr
| list_of_expr expr
;

expr: G INT X INT Y INT Z INT EOL
| ZERO EOL
| END
;

%%

int main(int argc, char** argv){
yyparse();
}
int yyerror(const char* err){
printf("%sn", err);
}









share|improve this question

























  • What exact command are you using? And what bison version?

    – rici
    Nov 20 '18 at 23:05













  • Which version of Bison are you using? Bison 2.3 on Linux (antique RHEL 5; Bison 2.3 is copyrighted 2006 — though it is also what's shipped with macOS 10.14.1 Mojave) takes your grammar as parse23.y and bison -d parse23.y generates parse23.tab.c and parse23.tab.h as you want (on both Linux and macOS). Which platform and which version of Bison are you using?

    – Jonathan Leffler
    Nov 20 '18 at 23:10













  • What is the name of your bison file?

    – rici
    Nov 20 '18 at 23:53














0












0








0








I have a .y file that I trying to use with bison -d, but for some reason the .tab.h file is not being generated. Any suggestions?



My bison file in PasteBin:



%{
#include <stdio.h>
int yyerror(const char* err);
%}

%token G
%token INT
%token X
%token Y
%token Z
%token END
%token ZERO
%token EOL

%%

program: list_of_expr
;

list_of_expr: expr
| list_of_expr expr
;

expr: G INT X INT Y INT Z INT EOL
| ZERO EOL
| END
;

%%

int main(int argc, char** argv){
yyparse();
}
int yyerror(const char* err){
printf("%sn", err);
}









share|improve this question
















I have a .y file that I trying to use with bison -d, but for some reason the .tab.h file is not being generated. Any suggestions?



My bison file in PasteBin:



%{
#include <stdio.h>
int yyerror(const char* err);
%}

%token G
%token INT
%token X
%token Y
%token Z
%token END
%token ZERO
%token EOL

%%

program: list_of_expr
;

list_of_expr: expr
| list_of_expr expr
;

expr: G INT X INT Y INT Z INT EOL
| ZERO EOL
| END
;

%%

int main(int argc, char** argv){
yyparse();
}
int yyerror(const char* err){
printf("%sn", err);
}






bison






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 20 '18 at 23:07









Jonathan Leffler

564k916771026




564k916771026










asked Nov 20 '18 at 21:49









Farid KaradshehFarid Karadsheh

207210




207210













  • What exact command are you using? And what bison version?

    – rici
    Nov 20 '18 at 23:05













  • Which version of Bison are you using? Bison 2.3 on Linux (antique RHEL 5; Bison 2.3 is copyrighted 2006 — though it is also what's shipped with macOS 10.14.1 Mojave) takes your grammar as parse23.y and bison -d parse23.y generates parse23.tab.c and parse23.tab.h as you want (on both Linux and macOS). Which platform and which version of Bison are you using?

    – Jonathan Leffler
    Nov 20 '18 at 23:10













  • What is the name of your bison file?

    – rici
    Nov 20 '18 at 23:53



















  • What exact command are you using? And what bison version?

    – rici
    Nov 20 '18 at 23:05













  • Which version of Bison are you using? Bison 2.3 on Linux (antique RHEL 5; Bison 2.3 is copyrighted 2006 — though it is also what's shipped with macOS 10.14.1 Mojave) takes your grammar as parse23.y and bison -d parse23.y generates parse23.tab.c and parse23.tab.h as you want (on both Linux and macOS). Which platform and which version of Bison are you using?

    – Jonathan Leffler
    Nov 20 '18 at 23:10













  • What is the name of your bison file?

    – rici
    Nov 20 '18 at 23:53

















What exact command are you using? And what bison version?

– rici
Nov 20 '18 at 23:05







What exact command are you using? And what bison version?

– rici
Nov 20 '18 at 23:05















Which version of Bison are you using? Bison 2.3 on Linux (antique RHEL 5; Bison 2.3 is copyrighted 2006 — though it is also what's shipped with macOS 10.14.1 Mojave) takes your grammar as parse23.y and bison -d parse23.y generates parse23.tab.c and parse23.tab.h as you want (on both Linux and macOS). Which platform and which version of Bison are you using?

– Jonathan Leffler
Nov 20 '18 at 23:10







Which version of Bison are you using? Bison 2.3 on Linux (antique RHEL 5; Bison 2.3 is copyrighted 2006 — though it is also what's shipped with macOS 10.14.1 Mojave) takes your grammar as parse23.y and bison -d parse23.y generates parse23.tab.c and parse23.tab.h as you want (on both Linux and macOS). Which platform and which version of Bison are you using?

– Jonathan Leffler
Nov 20 '18 at 23:10















What is the name of your bison file?

– rici
Nov 20 '18 at 23:53





What is the name of your bison file?

– rici
Nov 20 '18 at 23:53












1 Answer
1






active

oldest

votes


















0














With GNU Bison 3.0.4 (default Ubuntu 18 bison) ~



The -d option will only work if your bison grammar file has the .y extension, e.g: my_grammar.y.



But you can work around it by using bison --defines=my_tab.h my_grammar.whatever instead.



EDIT: Your bison grammar file must have the .y extension.






share|improve this answer


























  • Works for me. How are you testing?

    – rici
    Nov 20 '18 at 23:05











  • @rici - bison -d lang.bison, where lang.bison contains the OP's bison file.

    – Kingsley
    Nov 20 '18 at 23:31











  • .y is the correct extension.

    – rici
    Nov 20 '18 at 23:51











  • @ricl - Yes, that fixed it too. :D

    – Kingsley
    Nov 20 '18 at 23:53











  • You can use .y++, .ypp, .Y or even .yy if you're using C++. But there has to be a y.

    – rici
    Nov 21 '18 at 0:03











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53402099%2fbison-d-does-not-create-tab-h%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














With GNU Bison 3.0.4 (default Ubuntu 18 bison) ~



The -d option will only work if your bison grammar file has the .y extension, e.g: my_grammar.y.



But you can work around it by using bison --defines=my_tab.h my_grammar.whatever instead.



EDIT: Your bison grammar file must have the .y extension.






share|improve this answer


























  • Works for me. How are you testing?

    – rici
    Nov 20 '18 at 23:05











  • @rici - bison -d lang.bison, where lang.bison contains the OP's bison file.

    – Kingsley
    Nov 20 '18 at 23:31











  • .y is the correct extension.

    – rici
    Nov 20 '18 at 23:51











  • @ricl - Yes, that fixed it too. :D

    – Kingsley
    Nov 20 '18 at 23:53











  • You can use .y++, .ypp, .Y or even .yy if you're using C++. But there has to be a y.

    – rici
    Nov 21 '18 at 0:03
















0














With GNU Bison 3.0.4 (default Ubuntu 18 bison) ~



The -d option will only work if your bison grammar file has the .y extension, e.g: my_grammar.y.



But you can work around it by using bison --defines=my_tab.h my_grammar.whatever instead.



EDIT: Your bison grammar file must have the .y extension.






share|improve this answer


























  • Works for me. How are you testing?

    – rici
    Nov 20 '18 at 23:05











  • @rici - bison -d lang.bison, where lang.bison contains the OP's bison file.

    – Kingsley
    Nov 20 '18 at 23:31











  • .y is the correct extension.

    – rici
    Nov 20 '18 at 23:51











  • @ricl - Yes, that fixed it too. :D

    – Kingsley
    Nov 20 '18 at 23:53











  • You can use .y++, .ypp, .Y or even .yy if you're using C++. But there has to be a y.

    – rici
    Nov 21 '18 at 0:03














0












0








0







With GNU Bison 3.0.4 (default Ubuntu 18 bison) ~



The -d option will only work if your bison grammar file has the .y extension, e.g: my_grammar.y.



But you can work around it by using bison --defines=my_tab.h my_grammar.whatever instead.



EDIT: Your bison grammar file must have the .y extension.






share|improve this answer















With GNU Bison 3.0.4 (default Ubuntu 18 bison) ~



The -d option will only work if your bison grammar file has the .y extension, e.g: my_grammar.y.



But you can work around it by using bison --defines=my_tab.h my_grammar.whatever instead.



EDIT: Your bison grammar file must have the .y extension.







share|improve this answer














share|improve this answer



share|improve this answer








edited Nov 20 '18 at 23:54

























answered Nov 20 '18 at 22:19









KingsleyKingsley

2,61111225




2,61111225













  • Works for me. How are you testing?

    – rici
    Nov 20 '18 at 23:05











  • @rici - bison -d lang.bison, where lang.bison contains the OP's bison file.

    – Kingsley
    Nov 20 '18 at 23:31











  • .y is the correct extension.

    – rici
    Nov 20 '18 at 23:51











  • @ricl - Yes, that fixed it too. :D

    – Kingsley
    Nov 20 '18 at 23:53











  • You can use .y++, .ypp, .Y or even .yy if you're using C++. But there has to be a y.

    – rici
    Nov 21 '18 at 0:03



















  • Works for me. How are you testing?

    – rici
    Nov 20 '18 at 23:05











  • @rici - bison -d lang.bison, where lang.bison contains the OP's bison file.

    – Kingsley
    Nov 20 '18 at 23:31











  • .y is the correct extension.

    – rici
    Nov 20 '18 at 23:51











  • @ricl - Yes, that fixed it too. :D

    – Kingsley
    Nov 20 '18 at 23:53











  • You can use .y++, .ypp, .Y or even .yy if you're using C++. But there has to be a y.

    – rici
    Nov 21 '18 at 0:03

















Works for me. How are you testing?

– rici
Nov 20 '18 at 23:05





Works for me. How are you testing?

– rici
Nov 20 '18 at 23:05













@rici - bison -d lang.bison, where lang.bison contains the OP's bison file.

– Kingsley
Nov 20 '18 at 23:31





@rici - bison -d lang.bison, where lang.bison contains the OP's bison file.

– Kingsley
Nov 20 '18 at 23:31













.y is the correct extension.

– rici
Nov 20 '18 at 23:51





.y is the correct extension.

– rici
Nov 20 '18 at 23:51













@ricl - Yes, that fixed it too. :D

– Kingsley
Nov 20 '18 at 23:53





@ricl - Yes, that fixed it too. :D

– Kingsley
Nov 20 '18 at 23:53













You can use .y++, .ypp, .Y or even .yy if you're using C++. But there has to be a y.

– rici
Nov 21 '18 at 0:03





You can use .y++, .ypp, .Y or even .yy if you're using C++. But there has to be a y.

– rici
Nov 21 '18 at 0:03


















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53402099%2fbison-d-does-not-create-tab-h%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

'app-layout' is not a known element: how to share Component with different Modules

android studio warns about leanback feature tag usage required on manifest while using Unity exported app?

WPF add header to Image with URL pettitions [duplicate]