Questions tagged [flex-lexer]

Flex (fast lexical analyzer generator) is a free software that generates lexical analyzers ("scanners" or "lexers").

Flex (fast lexical analyzer generator) is a free software that generates lexical analyzers ("scanners" or "lexers"). It is frequently used with the free Bison parser generator. Unlike Bison, flex is not part of the GNU Project. You can (and should) read the manual which can be found here.

See also:

2072 questions
0
votes
1 answer

Regex match lines except linebreaks (FLEX, BISON)

So we have a tutorial on flex,bison before we start our complation techniques course at university. The following test should be split into lines and newlines testtest test data second line in the data another line without a trailing newline This…
0
votes
1 answer

Should I be using parser generators for anything else but a language?

While trying to get my feet wet with lexical analysers and parser generators, I realized that most resources in the Internet (Tutorials, Forums, StackOverflow) only talk about languages. Is it because tools like Flex and Bison are only suitable for…
exilit
  • 1,156
  • 11
  • 23
0
votes
2 answers

Separating reserved identifiers in flex

I have a language I am making a parser for which contains function calls. A few function names are reserved and I would like to handle them differently in my grammer. In EBNF it would look like FunctionCall ::= FunctionName '('…
Akusete
  • 10,704
  • 7
  • 57
  • 73
0
votes
1 answer

Syntax error in lex & yacc file

I am pretty new to lex and yacc. I was trying out a grammar to recognize the input text: ESCREVER 1; or ESCREVER 1+2; but everytime I try it shows me syntax error , I think the problem is parsing the number or the word ESCREVER. Here is my flex/lex…
A. Dubosky
  • 53
  • 1
  • 7
0
votes
0 answers

Bison & flex linkage - yylval type

I have a school project, building a compiler. There is a header file given by the course staff, "proj.h" including a struct "Node", which should be used to build the parsing tree, and a set of functions. (That header does not include a #define for…
0
votes
0 answers

how to mingw64 cross compiling with flex and bison?

I have installed mingw64 on my ubuntu 14 trusty with the command: sudo apt-get install mingw64 Now I figured out there is no flex or bison linked to it? I have downloaded this flex: https://github.com/westes/flex.git and this bison:…
j35t3r
  • 1,254
  • 2
  • 19
  • 53
0
votes
1 answer

Bison custom syntax error

I have some grammar rules for a C compiler and translator to Matlab language. I want to capture the syntax error due to missing ';' at the end of a statement. For example I have the return statement: stmt_return : RETURN {...some…
Donato Micele
  • 15
  • 1
  • 5
0
votes
0 answers

How to store the value of a real (double) in the Symbol-Table

I am now working on a mini-project in which it is asked to provide a compiler that allows to read a source program file written using Language instructions and perform lexical and syntactic analysis and display the Outcome of the program. When I…
Amrouane
  • 143
  • 3
  • 16
0
votes
1 answer

Convert HTML table into plain text using Lex and Yacc

I have a an HTML table code, which needs to be converted into plain text, using the Flex utility in Linux systems. I've come up with a list of tokens in my .lex file, which are as follows: OPENTABLE CLOSETABLE
Syed Ali Hamza
  • 193
  • 1
  • 10
0
votes
1 answer

flex 2.5.35 gives error when ctrl-M used in lex file

I have a simple lex file. %{ #include %} space_char [ \t\^M] space {space_char}+ %% %% int yywrap(void) { return 1; } int main(void) { yylex(); return 0; } When I compile this file with flex-2.5.35, it…
Dharmendra
  • 384
  • 1
  • 5
  • 22
0
votes
1 answer

Header y.tab.h not found during compilation of lex.yy.c

I am trying to create a basic compiler and I am facing some problems. My flex code: %{ #include #include "SymbolTable.h" #include //extern "C" //{ // extern int yylex(void); // extern int…
desertSniper87
  • 795
  • 2
  • 13
  • 25
0
votes
0 answers

syntax error when executing flex bison program

I have created a mini compiler for c language which test an exemple of code entred in file . Each time i execute the program , it show me a "Syntaxe Error in line 1" and i didn't understand the source of error . This is the flex file : %{ #include…
0
votes
2 answers

flex/bison segmentation fault before main()

I wrote a simple assembler using flex and bison . It worked perfectly until I made a small change . Was a harmless additional rule in the lex and yacc specifications . After that it throws a segmentation fault each time I run it . I tried to trace…
abc def foo bar
  • 2,360
  • 6
  • 30
  • 41
0
votes
0 answers

A list of LEX expressions

Identify the lists of elements surrounded by <>, where elements can be : words formed with length multiply of 3 , even numbers with at least 3 digits . The lists contain at least 2 elements separated by ',' . Correct…
0
votes
1 answer

Bison loop for conflict

to solve the dangling else problem, I used the following solution: stmt : stmt_matched | stmt_unmatched ; stmt_unmatched : IF '(' exp ')' stmt | IF '(' exp ')' stmt_matched ELSE…
1 2 3
99
100