On Mon, 26 Feb 2018, Sven Schreiber wrote:
Am 26.02.2018 um 16:11 schrieb Riccardo (Jack) Lucchetti:
> On Mon, 26 Feb 2018, Sven Schreiber wrote:
> If we could have a LLVM front-end for Hansl, it'd be fantastic.
> Unfortunately, I believe we simply don't have the resources to undertake
> that project.
Yes and no, IMO. Indeed I don't think it makes much sense to reinvent the
wheel and have yet another llvm frontend. But I think the similarity of julia
with respect to hansl and the fact that it's a pretty self-contained JITting
package could be leveraged.
I have started work on a proof of concept that would take the code of a
number-crunching function written in pure (and maybe somewhat simplified)
hansl, would translate it to julia automagically and would thus use julia as
a JITting backend. Of course there's an overhead, but IMO it's negligible for
any significant computation time.
I also have a cool working title for this toy project, but I won't tell (yet)
;-)
Everybody is welcome to join in, of course.
This sounds like a lot of fun, but I have the feeling that in order to run
Hansl code on LLVM going through Julia may not be the best idea ('cause
that's what you'd be doing, since Julia runs on top of LLVM). I suspect
that producing a Hansl->Julia translator is going to be VERY tough, if we
want it to work in more than 90% of arbitrary hansl scripts that you have
out there in the wild.
Instead, we already have a perfecly good lexer+parser combo (genlex.c and
geneval.c in lib/src, if anyone's interested) for assignment and function
evaluation, plus an eccellent tokenizer. As far as my (limited)
understanding of the matter goes, writing a frontend would mean modifiying
those in order to produce IM (LLVM's "machine code"), which you then feed
into the virtual machine.
That said, I am fairly certain that the only person qualified to make a
credible guess on how hard that would be to do is Allin. My guess is that
it'd require several months of very-high-skilled work.
If anyone on the list had some money to spare for a 12-month post-doc
position for a CompSci guy, that'd be just perfect.
-------------------------------------------------------
Riccardo (Jack) Lucchetti
Dipartimento di Scienze Economiche e Sociali (DiSES)
Università Politecnica delle Marche
(formerly known as Università di Ancona)
r.lucchetti(a)univpm.it
http://www2.econ.univpm.it/servizi/hpp/lucchetti
-------------------------------------------------------