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

You can solve this by having one "language" that can represent all intermediate stages. This has a nice side effect of allowing you to easily change the ordering of passes if that turns out to produce better results.


In my experience such languages are very dangerous and it is better to have a chain of more restrictive languages instead. Most passes only make sense in a fixed sequence anyway. LLVM is infanously broken in this regard, btw., there are too many implicit pass dependencies.

E.g., there is no point in keeping a one-handed 'if' in a language after a pass which lowers it into a two-handed 'if'. There is no point in keeping a 'lambda' node in your AST after lambda lifting is done.


You will still have different de-facto languages for each intermediate stages.

E.g. even if "x = 1; y = lambda { puts x } " is technically legal in all stages, if one of the stages is responsible for "lowering" the above to an explicit environment allocation and rewriting accesses to x, then anything below that which tries to use the "lambda {}" syntax would fail to compile.




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

Search: