4 ms·
There's not much difference since generating the abstract syntax tree is usually the hardest part. Once you've done that, it's just a matter of generating a str
by noblethrasher 14y ago
There's not much difference since generating the abstract syntax tree is usually the hardest part. Once you've done that, it's just a matter of generating a string representation for each node in the tree for the given target language.
- chollida1 14y agoReally? I've worked on compilers for a long time and the AST generation is typically the easiest part. Optimizations, and different target backends are easily an order of magnitude harder. That's why every new language typically begins as a simple AST tree walker, that's the easy part. They can they "graduate" to byte codes and then to asm generation if appropriate.
- DoubleCluster 14y agoDid you ever try to translate one language into another? Usually it's just generating the AST that is the hard part, then you can just spit out code and let the compiler for the target language do the hard stuff.
- chollida1 14y agoHmm, for me it's always been tougher trying to determine what the source language should compile down into. AST generation is usually simple. It's the conversion to the other language that usually get's difficult.
- c3d 14y agoAgreed. fortunately, there's LLVM for the back end now. And XL for the front end/AST
- noblethrasher 14y agoThat's fair. But in my world “compiler” and “optimizing compiler” are very different things. Also, targeting different backends is drudgery but I never thought of it as being hard.
- chollida1 14y ago> That's fair. But in my world “compiler” and “optimizing compiler” are very different things Ah, ok. In that case, I'd agree.