Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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.


Really?

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.


Did 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.


Hmm, 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.


That'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.


> That's fair. But in my world “compiler” and “optimizing compiler” are very different things

Ah, ok. In that case, I'd agree.


Agreed. fortunately, there's LLVM for the back end now. And XL for the front end/AST




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: