Hey. I was wondering if anyone here could help me with a little problem I'm having. I'm trying to create a "source-to-source" compiler, but I really can't figure it out. Everyone has told me to "Use Yacc/Lex
" (or various variants of them), but I really don't understand how they're useful. I have a basic understanding of what they do (scan a file looking for certain things defined in the language grammar, tokenize, etc), but not so much as to how this is actually useful, or even how to use it.
I've tried searching, reading, rereading, and I've got absolutely no where.

I'd really appreciate any help on understanding all this.

Recommended Answers

All 2 Replies

>Everyone has told me to "Use Yacc/Lex" (or various variants
>of them), but I really don't understand how they're useful.

Then you don't know enough about how compilers work or how they're implemented. In such a case it's a bad idea to use tools because even if you end up with a usable result, you probably still won't understand it. You should get your hands dirty and write a compiler (even a simple one) by hand at least once.

Alright. I'll look into that first, then.
Thanks.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.