News for hackers. Stuff that matters.
Re:Compilers for Free by dtech on Friday January 25, 2019 @02:31AM (#18996196)
> 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.

Re:Compilers for Free by chrisseaton on Friday January 25, 2019 @05:58AM (#18997037)
> 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

Re:Compilers for Free by vanderZwan on Friday January 25, 2019 @09:00AM (#18997882)
> 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?