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
0
votes
1 answer

Why isn't my bison printing the variable names?

So i'm using a flex/bison parser but the variable names arent printing correctly. It understands the number values. I've tried messing with everything but I'm lost. heres a link to the output. its where it prints "Data: 0" that i'm trying to get the…
0
votes
0 answers

Bison: Not able to resolve the user-param in .hpp

Bison is not able to resolve the user-param type in *.tab.hpp. Bison version: GNU Bison 2.7. .l file: { #include #include #include #include #include #include "pinMapTab.h" extern int…
kiran Biradar
  • 12,700
  • 3
  • 19
  • 44
0
votes
0 answers

FLEX program writing one too many "\n" on output file

The last token of each line from the "example.y" file is written with an extra "\n". We also found out that, if we get the string length of the buffer, when it contains the element of the last token of each line, that length is the size of that…
0
votes
2 answers

bison recursion error with struct pointer

I have a simple struct called Polyn like this: typedef struct Polyn { int sign; int coeff; int exp; struct Polyn *next; } Polyn; In my bison grammar for recursively building polynomials I only get the first and last element. I use these…
sidthekid
  • 7
  • 3
0
votes
1 answer

Troubles using Bison's recursive rules, and storing values using it

I am trying to make a flex+bison scanner and parser for Newick file format trees in order to do operations on them. The implemented grammar an explanation is based on a simplification of (labels and lengths are always of the same type, returned by…
Lightsong
  • 312
  • 2
  • 8
0
votes
1 answer

yylex errors for simple parser generator

I'm just doing a homework assignment where i have to make a simple polynomial parser generator. So it has to accept assignment like: a= 2x2+2 and also evaluation like a[2] will print 10. If a is entered alone it should print 2x2+2. It should work…
sidthekid
  • 7
  • 3
0
votes
1 answer

How do I debug a reduce/reduce error in my bnf notation in Jison

I'm writing bnf notation with Jison and getting an reduce/reduce conflict: Conflict at state: 26, token: SIMPLE_ASSIGN reduce by rule: PrimaryExpression -> Identifier reduce by rule: LeftHandSideExpression -> Identifier My State 26 looks like…
Johnston
  • 20,196
  • 18
  • 72
  • 121
0
votes
1 answer

Lex / bison won't generate an ast 2 + 2

I am just learning lex/bison/yacc etc and I am running it through a library called syntax This is through a tutorial on UDemy. I am just getting started and trying to get it to make it generate an AST for 2 + 2. Which seems like it should be…
Johnston
  • 20,196
  • 18
  • 72
  • 121
0
votes
1 answer

Bison parser not reporting error within case statement

I am getting the following output of running a bison parser : Bison parser output on a file In the above image i gave the compile executable generated using bison and provided the syntax5.txt. If you see it caught the error when => 2; properly it…
0
votes
1 answer

How should a Python module use code generation?

I have a Python module that is built around a native extension written in C. This extension includes code generated using the GNU Bison and (not GNU) Flex tools. That means the build process for my C extension involves calling these tools and then…
seanmk
  • 1,934
  • 15
  • 28
0
votes
1 answer

How to build C++ CMake project using Clion with flex and bison

I'm trying to build a git project I've cloned which use CMake for compilation and needs bison and flex. I'm using windows 10 and Clion IDE. I've download Win flex-bison from https://sourceforge.net/projects/winflexbison/ but I can't understand how…
0
votes
1 answer

Java cup: Shift/Reduce conflict

I'm trying to write a parser using JFlex and Cup, but I have some issues dealing with recursive pointed notation like function call with recursive properties access like : var x = obj.property1.functionCall(p1, p2).property2; Here is the related…
Polla Toube
  • 178
  • 3
  • 10
0
votes
2 answers

Warning: rule useless in grammar (Bison/Yacc)

I have been trying to solve this issue related to a current school assignment and would highly appreciate if anyone could explain to my why I am getting warnings from my compiler such as decafast.y:201.13-16: warning: rule useless in grammar…
Solezano
  • 15
  • 4
0
votes
1 answer

Rules & Actions for Parser Generator, and

I am trying to wrap my head around an assignment question, therefore I would very highly appreciate any help in the right direction (and not necessarily a complete answer). I am being asked to write the grammar specification for this parser. The…
Solezano
  • 15
  • 4
0
votes
2 answers

Crash in flex/bison parser code while reading parameters with visual studio (x64) working in x32

I'm trying to port a legacy 32 bit parser code generated from flex.bison. I must use Visual Studio 2019 and compile to x64 target. A crash occures (reading access violation) while parsing the parameters in this code : case 42: { registerTypedef(…
1 2 3
99
100