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
6
votes
2 answers

Learning bison: What are context-free grammars and LALR(1)?

I am reading this bison introduction. I have two questions and it will be great if someone can help me understand: What does term context free grammar mean? From the link above: Not all context-free languages can be handled by Bison, only those…
hari
  • 9,439
  • 27
  • 76
  • 110
6
votes
1 answer

Bison - additional parameter to a push and pure parser

How can I pass one aditional parameter (not the token minor of type YYSTYPE) to the yypush_parse() function? The parser is indeed reentrant, but this one aditional variable is crucial for the thread-safety of the application I need to integrate my…
Flavius
  • 13,566
  • 13
  • 80
  • 126
6
votes
1 answer

Cannot configure CMake to look for Homebrew installed version of Bison

I'm running macOS 10.14 and I installed bison version 3.2 with brew, but it refuses to link: $ brew link bison --force Warning: Refusing to link macOS-provided software: bison If you need to have bison first in your PATH run: echo 'export…
Berk Özbalcı
  • 3,016
  • 3
  • 21
  • 27
6
votes
1 answer

Thread-safe / reentrant bison + flex

I would really prefer a working example to any explanation. Whatever I read so far on Bison's documentation site contradicts whatever Flex says. One says to declare yylex as int yylex (yyscan_t yyscanner); another one wants it to be: int…
wvxvw
  • 8,089
  • 10
  • 32
  • 61
6
votes
1 answer

Get Flex/Bison action result

I am using Flex/Bison/C++ to evaluate an expression Here is a sample bison file string res; yy_scan_string(expression.c_str()); yyparse(); cout<<"Result:"<
yodhevauhe
  • 765
  • 3
  • 11
  • 33
6
votes
1 answer

Is there any active Lex and Yacc IRC?

Please I am searching for an active Lex and Yacc or Bison IRC - (Internet Relay Chat). Any suggestions are highly appreciated. Thanks in advance for your help!
CompilingCyborg
  • 4,760
  • 13
  • 44
  • 61
6
votes
1 answer

How to pass the yytext from the lex file to yacc?

Please i am facing a simple problem.. here is the issue, In my lex file i have something similiar to: char *ptr_String; "name = " { BEGIN sName; } .+ { ptr_String = (char *)calloc(strlen(yytext)+1, sizeof(char)); …
CompilingCyborg
  • 4,760
  • 13
  • 44
  • 61
6
votes
1 answer

Does GNU/Flex C++ work at all?

Quoting the book flex & bison (O'Reilly, John Levine, 2009): "Bison can create parsers in C++. Although flex appears to be able to create C++, scanners, the C++ code doesn't work.[21] Fortunately, C scanners created by flex compile under C++ and…
6
votes
1 answer

Bison value moving / efficiency

I'm working on constructing my parse data structure from bison's semantic values. One particular structure is of type std::vector. I'm curious how the bison internals handle moving semantic values. I tried analyzing the c++.m4 file, and…
Zac
  • 876
  • 1
  • 8
  • 18
6
votes
0 answers

Converting "c-like language" to "custom language" with parser

I have a collection of files written in a language 'A' that need to be translated into corresponding files of a language 'B'. I want to create a program/parser that can automate this task (probably rather a toolchain than a single program).…
Ronin100
  • 85
  • 4
6
votes
2 answers

Undefined reference to yyparse (flex & bison)

I'm attempting to learn some flex/bison, and I'm reading Flex & Bison by John Levine (O'Reilly). There is an example that I need to get running, however I can't get it to run as I get the following error: /tmp/ccKZcRYB.o: In function…
Tom
  • 2,321
  • 2
  • 18
  • 29
6
votes
1 answer

simple makefile for lex yacc and C

I am trying to compile my program which has a lex file and a yacc file and a couple of C files.I came across this example in the Flex manual. I have a couple of questions regarding this makefile.It doesn't specify a compiler such as gcc how does the…
liv2hak
  • 14,472
  • 53
  • 157
  • 270
6
votes
2 answers

Utility to format a Bison/Yacc grammar file nicely?

Hello there: Do you folks know of any GNU/Linux utility to format a Bison grammar file, containing C code, nicely? I'm thinking of something along the lines of GNU Indent, but designed to beautify grammar files rather than C code.
user365636
6
votes
3 answers

C++: String and unions bison

I am building a compiler in flex and bison. The thing is that using char * is giving a lot of problems so I'm trying to migrate everything to string. The only problem left is that there is a union with strings. I know that this is not a standard,…
rforseck
  • 63
  • 1
  • 4
6
votes
5 answers

using qt : How To Build a Gui OnTop Of a Console Application?

i have a console application that generated from bison (a parser) and i want to build a simple gui for it so i can send input from this gui to the console and get output from the console into the gui . i tried to do that using java process class but…
Radi
  • 6,548
  • 18
  • 63
  • 91