flex-lexer Questions

2

Solved

I am writing lex for a specific language where operations are carried out in prefix notation : (+ a b) --> (a + b) An integer is defined as follows : An integer can have a negative sign (–) bu...
Helix asked 13/2, 2016 at 23:44

1

What does this instructions mean in flex (lex) : #define yywrap() 1 and this [ \t]+$ i find it in the code below: (%% [ \t]+ putchar('_'); [ \t]+% %% input "hello world" output "hello_world" ...
Consternation asked 27/12, 2015 at 11:19

1

Solved

What is the meaning of yytext[0]? And why should we use in the lex and yacc program? I'm learner so don't mind if it is a silly question.
Intercommunicate asked 21/11, 2015 at 11:33

8

Solved

I'm trying to use flex and bison to create a filter, because I want get certain grammar elements from a complex language. My plan is to use flex + bison to recognise the grammar, and dump out the l...
Gorlicki asked 18/3, 2009 at 1:49

1

Solved

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.I...
Ret asked 1/9, 2015 at 22:57

3

Solved

I am making a Lexical Analyzer using Flex on Unix. If you've ever used it before you know that you mainly just define the regex for the tokens of whatever language you are writing the Lexical Analy...
Cohabit asked 21/1, 2011 at 6:15

1

Solved

I met a problem when trying to flex abcd.l. I wanted to redirect the output to a new file instead of the default one lex.yy.c I looked up it in manual finding an option -o(--output=FILE) so I chang...
Crumpton asked 25/8, 2015 at 6:45

1

Solved

I have flex code that copies a string lexeme using strdup(). %{ #include "json.tab.h" #define YY_DECL extern "C" int yylex() %} %option noyywrap %% [ \t\n]+ ; \"[a-zA-Z]+\" {yylval.sval = st...
Vacuity asked 28/6, 2015 at 20:14

5

I am trying to translate my .spl file into a C file (because there is no compiler). I have an example "Hello World" .spl file, and I have downloaded the Shakespeare Programming Language .tar and ex...

2

Solved

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 wi...
Latreshia asked 6/3, 2011 at 0:14

3

I'm using Bison & Flex for 1 month more or less, so I'm sorry if I don't see something obvious (but I don't think it is). I have a problem about freeing memory with Flex Bison. Here is what my...
Convergence asked 20/3, 2014 at 13:48

2

I am trying to create a lexical analyzer for a compiler.But I have a problem using regular expressions to find things like keywords and real numbers.. for example some definitions : id [aA-zZ][aA-...

1

Solved

I look here ANSI C grammar . This page includes a lot of regular expressions in Lex/Flex for ANSI C. Having a problem in understanding regular expression for string literals. They have mentioned...
Petes asked 31/1, 2015 at 3:50

3

Is there a parser available in the open ? Else, i'm planning to write one using the grammar rules in http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-262.pdf Thanks.
Tolu asked 1/8, 2012 at 8:8

1

Solved

I created a simple Flex file to read and return tokens from a file. I generated the scanner file using the command flex -c++ scanner.l. When trying to compile the generated lex.yy.cc file I am gett...
Garibold asked 10/9, 2014 at 6:34

2

Solved

I am converting my build system from configure/make to a cmake system The system has some autogenerated files, from bison/flex. The original makefile commands are: bison --defines=tokens.h --outp...
Barca asked 16/10, 2013 at 8:3

1

Solved

I am trying to write a simple YAML parser, I read the spec from yaml.org, before I start, I was wondering if it is better to write a hand-rolled parser, or use lex (flex/bison). I looked at the li...
Raynell asked 19/9, 2011 at 19:18

1

Solved

i am working in a small language/IDE. And I need to know how to configure flex and bison to work together but without using any global or static variable. I need to pass to bison my AST pointer. I ...
Lincolnlincolnshire asked 28/2, 2014 at 22:39

1

Solved

I need to match EOF in flex this is the main error part of my code lex.l %{ %} %% <<EOF>> {printf("match EOF\n");} %% int main(){ yylex(); } i use flex lex.l ; gcc lex.yy.c -o lex...
Soften asked 9/5, 2014 at 2:40

2

Solved

I apologize if this is a dumb question, but I have 0 experience with this tool and wanted to know if I'm going about using it properly. I've downloaded flex which, upon compiling my lex file, produ...
Jahdol asked 2/2, 2013 at 19:34

1

Solved

When I tried to use regex in flex as following to define an int type: int (?<!\w)(([1-9]\d*)|0)(?!\w) I meant to make this invalid: int a = 123; int b = 123f; //the '123' should not filtered...
Littell asked 11/3, 2014 at 12:56

2

Solved

I'm using Bison and Flex to make a reentrant scanner/parser pair but can't wrap my head around where everything is to be included and declared. First of all, I'm using reentrant Flex so I need to ...
Wire asked 30/9, 2011 at 15:6

1

Solved

this error : line 32: unrecognized rule is appearing in my code in this line : {OCTAL} printf("Kind= OCTAL, Word= %s, LineNumber= %d\n",yytext,LineNum); and i think the problem is here : OCTAL...
Borough asked 2/1, 2014 at 9:14

2

Solved

I have been trying to follow the tutorial at http://gnuu.org/2009/09/18/writing-your-own-toy-compiler/5/ (using flex, bison and llvm) but when typing the line g++ -o parser parser.cpp tokens.cpp...
Advance asked 23/9, 2013 at 18:4

2

Solved

I'm trying out some examples from O'Reilly Flex & Bison. The first Bison and Flex program I'm trying gives me next error when linking the sources: Undefined symbols for architecture x86_64: ...
Fortuneteller asked 11/3, 2013 at 20:53

© 2022 - 2024 — McMap. All rights reserved.