Questions tagged [bison]

Bison is the GNU parser generator. It generates LALR parsers, but can also generate GLR parsers for grammars that are not LALR. It has a mode of compatibility with its old predecessor Yacc (yet another compiler compiler).

Bison is the GNU parser generator. It generates LALR parsers, but can also generate GLR parsers for grammars that are not LALR. In POSIX mode, Bison is compatible with Yacc (yet another compiler compiler). flex, an automatic lexical analyser, is often used with Bison, to tokenise input data and provide Bison with tokens.

Websites:

See also:

2588 questions
5
votes
2 answers

warning Bison compilation

am developping a compiler using flex/bison. I have this warning in my build output. warning: type clash ('s' '') on default action any help please?
Aymanadou
  • 1,200
  • 1
  • 14
  • 36
5
votes
3 answers

Help with Compiler Design

Possible Duplicate: Learning to write a compiler I need to come up with a dummy SQL like language which has very limited features. I have never done any compiler or parsing stuff before. Can anyone let me know a good point to start may be a link…
keeda
  • 2,605
  • 5
  • 28
  • 27
5
votes
1 answer

YACC rules not getting reduced

I'm trying to learn YACC and having a bit of trouble figuring out the warning messages it is giving me. Here is part of my file: define_character: WORD IS STRING COLOR { printf("%s's full name is %s and thier color is %s", $1, $3,…
John
  • 548
  • 7
  • 15
5
votes
3 answers

Interfacing a Yacc/Bison Parser with a C++ program

This is not a duplicate of this question because the solution was not to use a parser! I have a Bison parser I can run by doing ./parser < file_to_parse. I want to call the Bison parser from within my C++ program. What I don't want is to do…
ale
  • 11,636
  • 27
  • 92
  • 149
5
votes
1 answer

Yacc/Bison: The pseudo-variables ($$, $1, $2,..) and how to print them using printf

I have a lexical analyser written in flex that passes tokens to my parser written in bison. The following is a small part of my lexer: ID [a-z][a-z0-9]* %% rule { printf("A rule: %s\n", yytext); return RULE; } {ID} { printf( "An…
ale
  • 11,636
  • 27
  • 92
  • 149
5
votes
1 answer

yacc and bison in visual studio

I am going to port the C project that was for unix into windows. So far, I could make it compile but not build . The problem I am getting is , some of the functions which are declared in the header files are defined in the yacc files.so I am getting…
thetna
  • 6,903
  • 26
  • 79
  • 113
5
votes
2 answers

Bison: Shift Reduce Conflict

I believe I am having trouble understanding how shift reduce conflicts work. I understand that bison can look ahead by one, so I don't understand why I am having the issue. In my language a List is defined as a set of numbers or lists between […
Pieces
  • 2,256
  • 5
  • 25
  • 39
5
votes
2 answers

Trouble linking against LLVM with project including Flex and Bison

I've been working through a tutorial on writing compilers with Flex, Bison, and LLVM (http://gnuu.org/2009/09/18/writing-your-own-toy-compiler/), and attempting to compile the final binary fails with many of the following "undefined reference"…
Dylon
  • 1,730
  • 15
  • 14
5
votes
1 answer

Need a simple Bison grammar for HTML

I've looked at the Bison help and have written this, but I'm not sure it's completely correct. Also i need an yylex() that handle Lexical Analyzer (It should be Flex tool). I know some basic things about context-free grammars. But i don't know how…
Jalal
  • 6,594
  • 9
  • 63
  • 100
5
votes
1 answer

generate bison output into different folders

I currently using bison and flex in my project which has the following structure: Project | |--include/ |--src/ all the headers are going into the include directory, and all the source files are going into the src directory. I have my grammars and…
Exagon
  • 4,798
  • 6
  • 25
  • 53
5
votes
3 answers

Change yyin to argv[1] Flex & Bison

I'm working on a Flex & Bison project. I got my flex & bison perfectly working but I'm trying to give argv as the input (yyin). So I've changed yyin so that it took the argv[1] but it's actually not working. It seem that it took the argv[1] but then…
G.Courmont
  • 187
  • 2
  • 10
5
votes
1 answer

Ignore white space in flex and bison

I am trying to parse following lines: BEGIN WRAP WIO3 NAME lgCell_prg160_io CONDITION UNI_PLACE_GLOBAL && compBits ENDS WIO3 The Grammar which I used to parse above lines are…
shailavi shah
  • 171
  • 1
  • 4
  • 14
5
votes
1 answer

Bison grammar for collecting arguments

I have a bison grammar for collecting arguments of a function. This is what it is so far: args: arg {$$ = intArray($1);} //pseudo-code function | args arg {$$ = $1 + $2;} //pseudo-code array addition arg : NUM …
None
  • 3,875
  • 7
  • 43
  • 67
5
votes
3 answers

Are all Parsers made with yacc or bison (and lex/flex)?

I think Bison and Yacc are very often used for parsing grammars of programming languages. (and lex/flex for tokenizing...) My Question is: Are all compilers made with this tools or are there people who write their parsers from scratch? (I do it…
lukkkkkas
  • 61
  • 1
  • 2
5
votes
1 answer

Is it possible to make this YACC grammar unambiguous? expr: ... | expr expr

I am writing a simple calculator in yacc / bison. The grammar for an expression looks somewhat like this: expr : NUM | expr '+' expr { $$ = $1 + $3; } | expr '-' expr { $$ = $1 - $3; } | expr '*' expr { $$ = $1 * $3; } | expr '/' expr { $$ = $1 /…
wefwefa3
  • 3,872
  • 2
  • 29
  • 51