3 ms·
> Why is it that [...] when we want to produce a new compiler, we don't write an interpreter and pass it through a high quality, general partial evaluator? As
by dtech 8y ago
> Why is it that [...] when we want to produce a new compiler, we don't write an interpreter and pass it through a high quality, general partial evaluator?
As far as I know, it has been tried numerous times and has been an area of active research in the past, but results turned out unsuccessful. Mainly because error reporting and performance, both compile-time and run-time, is hard to achieve.
It's a little bit like pure functional programming. Super elegant in principle, hard to get right and usable in practice.
- deleted 8y ago[deleted]
- chrisseaton 8y ago> As far as I know, it has been tried numerous times and has been an area of active research in the past, but results turned out unsuccessful. TruffleRuby is a Ruby implementation that works exactly by writing an interpreting and passing it through a general partial evaluator. It's successful enough to pass almost all the Ruby spec and to run real Ruby applications including their C extensions. https://github.com/oracle/truffleruby https://github.com/oracle/truffleruby
- vanderZwan 8y ago> Mainly because error reporting and performance, both compile-time and run-time, is hard to achieve. Do you have more information on the error reporting bit? Is it due to losing important metadata during compilation? If so, couldn't a different, more metadata-rich representation than the basic AST most of us are familiar with help here?