Parsing with bison and flex
-
Hello I'm interested in coding my own parser for various files using bison and flex. Does anyone know of any good information/tutorials about these tools? Andy
I learnt with "Lex & Yacc" by John Levine, Tony Mason & Doug Brown, by O'Reilly press. It's fairly comprehensive and makes a good reference book, but is simple enough to learn from. There are a couple of substantial examples to explain things (a SQL parser and a menu generation language). Hope this helps Ryan Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact" -
I learnt with "Lex & Yacc" by John Levine, Tony Mason & Doug Brown, by O'Reilly press. It's fairly comprehensive and makes a good reference book, but is simple enough to learn from. There are a couple of substantial examples to explain things (a SQL parser and a menu generation language). Hope this helps Ryan Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact" -
Bison: http://www.gnu.org/software/bison/bison.html[^] Flex (GNU lex): http://www.gnu.org/software/flex/flex.html[^] It's for linux, but compiles under Windows (I've done it) Ryan Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact" -
Bison: http://www.gnu.org/software/bison/bison.html[^] Flex (GNU lex): http://www.gnu.org/software/flex/flex.html[^] It's for linux, but compiles under Windows (I've done it) Ryan Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact" -
Thanks, my unix is a bit rusty do i need to get make and all that to compile it or can I do it under VisC++? :-) Andy
VC++ compiles it just fine. If it throws up an error about missing "unistd.h", just create a blank file and put it in your include directory. It's not a necessary file, but it saves from messing with the source :). I can't remember if it asks for it or not. I think that the generated lex or bison C files include it, but it's not necessary and a blank dummy file works fine. Ryan Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact"