Re: Using Flex and Bison (Hans Aberg)
26 Oct 2005 14:26:01 -0400

          From comp.compilers

Related articles
Using Flex and Bison (2005-10-23)
Re: Using Flex and Bison (2005-10-26)
Re: Using Flex and Bison (toby) (2005-10-26)
Re: Using Flex and Bison (Girvo) (2005-10-27)
Re: Using Flex and Bison (toby) (2005-10-29)
| List of all articles for this month |

From: (Hans Aberg)
Newsgroups: comp.compilers
Date: 26 Oct 2005 14:26:01 -0400
Organization: Mathematics
References: 05-10-155
Keywords: tools, practice
Posted-Date: 26 Oct 2005 14:26:01 EDT 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]

Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.