From: Brian Candler Date: 2009-03-24T00:48:50+09:00 Subject: Re: Writing a language converter in Ruby ? Dylan Evans wrote: > It's a good idea to use a parser generator, it will simplify your code > and > make it easier to work with. Of course you can just start reading the > basic > files and parse them with a bunch of logic. Parsing is only half the answer. Once you have parsed, you will normally have built some internal structure representing the input. You then usually need a code generator to output code in the target language. It's possible to generate naive code as you parse, but it will usually be of poor quality. It may be possible to perform transformations on this output to improve it, e.g. as a "peephole" optimiser does. Recommended venerable book: "Compilers: Principles, Techniques and Tools" by Aho, Sethi, Ullman - aka "The Dragon Book". I believe it has been recently revised. -- Posted via http://www.ruby-forum.com/.