As a pet-project, I'd like to attempt to implement a basic language of my own design that can be used as a web-scripting language. It's trivial to run a C++ program as an Apache CGI, so the real work lies in how to parse an input file containing non-code (HTML/CSS markup) and server-side code.
In my undergrad compiler course, we used Fl...
Hi
Can anyone recommend any good sites or good books for learning flex?
Thanks
Damien
...
Hi, I have this working definition:
IDENTIFIER [a-zA-Z][a-zA-Z0-9]*
I don't want to keep repeating the [a-zA-Z] and [0-9], so I made two new definitions
DIGIT [0-9]
VALID [a-zA-Z]
How can I rewrite the IDENTIFIER rule to use the DIGIT and VALID definitions?
I don't know how to do the "second" match, I'm stuck here:
IDENTI...
I am using a C lexer that is Flex-generated, and a C++ parser that is Bison-generated. I have modified the parser to acccept only string input.
I am calling the parser function yyparse() in a loop, and reading line by line of user input. I stop the loop if the input is "quit".
The problem I am facing is that when input doesn't match an...
I can't figure this one out. I can download a win32 binary of flex 2.5.4a from gnuwin32, but I'd like to build the latest version (2.5.35) using Visual Studio 2005. I suppose I could build in in cygwin, but where is the fun in that?
http://flex.sourceforge.net/
...
My day job includes working to develop a Pascal-like compiler. I've been working all along on optimizations and code generation.
I would also like to start learning to build a simple parser for the same language. I'm however, not really sure how to go about this. Flex and Bison seem to be the choice. But, isn't it possible to write a p...
I am a writing a lexer as part of a compiler project and I need to detect if an integer is larger than what can fit in a int so I can print an error. Is there a C++ standard library for big integers that could fit this purpose?
...
In flex, I want to return multiple tokens for one match of a regular expression. Is there a way to do this?
...
I'm trying to write a config-file parser for use in a non-standard C environment. Specifically, I can't rely on the utilities provided by <stdio.h>.
I'm looking to use Flex, but I need to use my own input structures rather than <stdio.h>'s FILE pointers.
...
What is the difference between Flex & Lex and Yacc & Bison. I searched the Internet wildly and I didn't find any solid answer.
Can I install pure Lex and Yacc on Ubuntu, or I can install only flex and bison. I am confused.
Is Lex or Yacc still being maintained by someone ?
Are all of them free ?
If Lex is not free why do I have it in...
I'm looking into setting up a CI environment for our flex projects. I have very little experience in setting up an environment like this, but have read a lot about it and think we could benefit a lot from this in our projects. I do have experience with ANT and we're currently using it for our building. I've been looking at Hudson for a w...
Hi,
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 recognize the grammar, and dump out the location of elements of interest. (Then use a script to grab text according the locations dumped.)
I found flex can support a bison feat...
Which lexer/parser generator is the best (easiest to use, fastest) for C or C++? I'm using flex and bison right now, but bison only handles LALR(1) grammars. The language I'm parsing doesn't really need unlimited lookahead, but unlimited lookahead would make parsing a lot easier. Should I try Antlr? Coco/R? Elkhound? Something else?
...
Hi Folks,
My problem is that I am trying to run a problem that I coded using a flex-bison scanner-parser. What my program is supposed to do is take user input (in my case, queries for a database system I'm designing), lex and parse, and then execute the corresponding actions. What actually happens is that my parser code is not correctly...
I created test.l, input to flex, which ends with the main function.
When the main function is implemented as:
int
main(void)
{
yylex();
return 0;
}
I have no problem.
I want to trick the parser into believing that the first character is always a semi-colon, so I implemented main as
int
main(void)
{
unput(';');
yylex(...
I'm writing an assembler for a custom micro controller I'm working on. I've got the assembler to a point where it will assemble instructions down to binary.
However, I'm now having problems with getting labels to work. Currently, when my assembler encounters a new label, it stores the name of the label and the memory location its referr...
I have an application where I already have a parser for one sort of grammar and I need to add a second different grammar for another purpose.
Is it possible to have more than one?
And if so how do you get another entry point?
Thanks
david allan finch
...
Hi,
I'm trying to figure out how I can display a message/prompt when using lex/yacc (flex/bison).
For instance, main looks like so:
int main(int argc, char *argv[])
{
yyparse();
}
Which calls yacc, which calls yylex(). This yields a blank line waiting on STDIN. How can i display a message like...
message $ _
instead of
_
Whe...
I have a project for school where we need to use flex and bison. I want to use C++ so that I have access to STL and my own classes that I wrote. We were provided with the following Makefile:
CC = gcc
CFLAGS = -g
OBJs = parse.tab.o symtab.o attr.o lex.yy.o
default: parser
parser: ${OBJs}
${CC} ${CFLAGS} ${OBJs} -o parser -lfl
...
I want to create a read-eval-print loop using flex/bison parser. Trouble is, the flex generated lexer wants input of type FILE* and i would like it to be char*. Is there anyway to do this?
One suggestion has been to create a pipe, feed it the string and open the file descriptor and send to the lexer. This is fairly simple but it feels ...