Bison -d does not create tab.h
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
add a comment |
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
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 asparse23.y
andbison -d parse23.y
generatesparse23.tab.c
andparse23.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
add a comment |
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
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
bison
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 asparse23.y
andbison -d parse23.y
generatesparse23.tab.c
andparse23.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
add a comment |
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 asparse23.y
andbison -d parse23.y
generatesparse23.tab.c
andparse23.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
add a comment |
1 Answer
1
active
oldest
votes
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.
Works for me. How are you testing?
– rici
Nov 20 '18 at 23:05
@rici -bison -d lang.bison
, wherelang.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
|
show 2 more comments
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
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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.
Works for me. How are you testing?
– rici
Nov 20 '18 at 23:05
@rici -bison -d lang.bison
, wherelang.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
|
show 2 more comments
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.
Works for me. How are you testing?
– rici
Nov 20 '18 at 23:05
@rici -bison -d lang.bison
, wherelang.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
|
show 2 more comments
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.
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.
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
, wherelang.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
|
show 2 more comments
Works for me. How are you testing?
– rici
Nov 20 '18 at 23:05
@rici -bison -d lang.bison
, wherelang.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
|
show 2 more comments
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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
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
andbison -d parse23.y
generatesparse23.tab.c
andparse23.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