Compiler Compilers Resources - Programming On Unix

Users browsing this thread: 1 Guest(s)
sametsisartenep
Members
Hi there,

I was wondering about the books you'd recommend to learn about tools like lex and yacc, and its different successors (i.e. bison, flex, byacc, maybe some other here...).

I've found a couple of books, plus the manpages are always one of the best resources (if not the best), but with things like compiler design and architecture, context-free grammars and lexical analysis, I think there's a lot to get wrong.

I'm not thinking about building a very complex compiler, with optimization engines and the like, just something simple to manipulate text and perform some operations and I considered it was a very good time to learn lex and yacc properly, instead of using the common stream manipulation tools available on Unices.

What do you think? What are your experiences?


See you around :)
---
sam
josuah
Long time nixers
I do not know these tools, but I found these links over time:

- Flex (from lex) implementation: https://github.com/westes/flex
- Invisible-Island, home of some of the tools you quoted: http://invisible-island.net
- yasm (from nasm): http://yasm.tortall.net
- nasm (assembler): http://www.nasm.us
- explanations and book references: http://dinosaur.compilertools.net

Maybe you already know most of them. As I do not know these tools, I can not help much more...



If you want to have fun with a simple compiler (this one for C), you may have a look at scc development: http://git.suckless.org/scc
tudurom
Long time nixers
A good yacc/lex guide is the tutorial from TLDP http://www.tldp.org/HOWTO/Lex-YACC-HOWTO.html

With knowledge from the tutorial I made a program for window rules https://github.com/tudurom/ruler/blob/master/parser.y
You can see an example of a simple yacc grammar.
pranomostro
Long time nixers
"the unix programming environment" (in itself a book highly recommended) contains a description of developing a programmable calculator using lex and yacc in chapter 8.

mpu has compiled some resources for compiler writers here.

He also wrote miniyacc, whose repository contains some examples of yacc grammars.
sametsisartenep
Members
Thanks for the resources guys, especially pranomostro@; those resources are very high quality.

I have that book in my reading list, but I never got to read it, sadly. I'll try to prioritize it for summer though (I need to finish The Practice of Programming in the first place hehe.)