Code Comments
Programming Forum and web based access to our favorite programming groups.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
Post Follow-up to this messagegirvinator@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]
Post Follow-up to this messagegirvinator@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/
Post Follow-up to this messagetoby 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]
Post Follow-up to this messageGirvo 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]
Post Follow-up to this message
Show a Printable Version
Email This Page to Someone!
Receive updates to this thread
Powered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.