Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

Using Flex and Bison
Hi there everyone.
I am fairly new to programming compilers, although not to programming
in general.

I downloaded Parser Generator (http://www.bumblebeesoftware.com/) which
is simply an IDE for Lex and YACC.

I was just wondering, which way is the best to work on a compiler. Work
on the Lex file first, then the YACC file, and compile? Or the other
way round. I have read many tutorials, and some of the do it the other
way to others.

Also, does anyone know of a good tutorial that I could read, that will
actually COMPILE! All of the ones I have read have needed MAJOR changes
to even attempt to compile!

Anyways, thanks for everything.

-Girvo

Report this thread to moderator Post Follow-up to this message
Old Post
girvinator@gmail.com
10-23-05 12:56 PM


Re: Using Flex and Bison
girvinator@gmail.com wrote:

> I was just wondering, which way is the best to work on a compiler. Work
> on the Lex file first, then the YACC file, and compile? Or the other
> way round. I have read many tutorials, and some of the do it the other
> way to others.

Just compile the file you have edited, be it the .l or the .y
file. Often these two hangs together, so that they often need to be
edited together, so that both needs to be compiled. So might want
writing a "make" script to automate it.

> Also, does anyone know of a good tutorial that I could read, that will
> actually COMPILE! All of the ones I have read have needed MAJOR changes
> to even attempt to compile!

The book by Aho, Sethi & Ullman, "Compilers..." (the "Dragon book")
has a simple Lex/Yacc calculator example, which can easily be made
working with Flex/Bison. Play around with it. Look into the Bison
manual, which shows how to use operator precedents. Then just move
along, either by building or to more advanced examples.

--
Hans Aberg
[The examples from lex&yacc in the comp.compilers archive work.  You
may have to remove -ll and -ly from the Makefiles if you have a modern
version of lex and yacc without the separate libraries. -John]


Report this thread to moderator Post Follow-up to this message
Old Post
Hans Aberg
10-27-05 12:01 AM


Re: Using Flex and Bison
girvinator@gmail.com wrote:
> Hi there everyone.
> ...
>
> Also, does anyone know of a good tutorial that I could read, that will
> actually COMPILE! All of the ones I have read have needed MAJOR changes
> to even attempt to compile!

'info flex' and 'info bison' are valuable introductions - also see:
http://www.gnu.org/software/flex/manual/ &
http://www.gnu.org/software/bison/manual/

I have an example flex/bison project here that should build easily:
http://www.telegraphics.com.au/svn/exprparser/trunk/

Report this thread to moderator Post Follow-up to this message
Old Post
toby
10-27-05 12:01 AM


Re: Using Flex and Bison
toby wrote:
> girvinator@gmail.com wrote: 
>
> 'info flex' and 'info bison' are valuable introductions - also see:
> http://www.gnu.org/software/flex/manual/ &
> http://www.gnu.org/software/bison/manual/
>
> I have an example flex/bison project here that should build easily:
> http://www.telegraphics.com.au/svn/exprparser/trunk/

Also, what is the bset compiler to use? GCC? I am using Dev-C++ and it
comes up with errors for any Lex of YACC file i compile.
[Lex and yacc produce quite portable C.  I suspect there are errors in
your action code. -John]

Report this thread to moderator Post Follow-up to this message
Old Post
Girvo
10-28-05 08:57 AM


Re: Using Flex and Bison
Girvo wrote:
> toby wrote: 
>
> Also, what is the bset compiler to use? GCC? I am using Dev-C++ and it
> comes up with errors for any Lex of YACC file i compile.

(According to http://www.bloodshed.net/devcpp.html) Dev-C++ is MinGW
based, which means it is in fact gcc. I have built flex/bison projects
with MinGW, native gcc, CodeWarrior, motorola mrc, and probably others.

--Toby

> [Lex and yacc produce quite portable C.  I suspect there are errors in
> your action code. -John]

Report this thread to moderator Post Follow-up to this message
Old Post
toby
10-30-05 01:56 AM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

Compilers archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 12:43 AM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.