[slim-vim] Blue sky, shoot the moon: compile Vim-script to Lisp and thence to C

Brad Beveridge brad.beveridge at gmail.com
Thu May 25 17:25:54 CDT 2006


On 5/25/06, Larry Clapp <larry at theclapp.org> wrote:
> So I'm working on the Lisp->Vim FFI, and wondering if I can eventually
> work it out so that
>
>   (vim:append 12345 "some-string")
>
> calls Vim's internal f_append() function directly (instead of building
> a string that says "append( 12345, \"some-string\" )" and calling
> "exec" on it, which Vim then has to parse, look up "append" in its
> table (binary search -- fast, but slower than a pointer-indirection),
> and THEN call f_append()).
My turn to nitpick :)  Wouldn't that be ml_append()?  f_append is the
function that Vim script calls, which in turn calls ml_append.

>
> I don't know yet :) , but it occurred to me that if I can, and if I
> can compile it (and why wouldn't I?), then we'll be C "all the way
> down".  And then, perhaps, we can really make a name for ourselves by
> writing a Vim-script -> Lisp -> native code compiler.

That sounds very cool, having Vim controllable from Lisp in a somewhat
complete fashion would be extremely useful IMHO.
So you are proposing having the Vim deep internals exposed to Lisp.
It appears to me there are two really nice things about ECL that will
help here
1) The ECL compiler transates Lisp -> C
2) ECL lets you embed C code in Lisp.

I'm thinking it is possible to write the FFI in Lisp and call the Vim
internals directly.  During a build of Vim you would first process the
Lisp code to get C, then compile the resulting file into Vim.  The
embedded ECL interpreter can then call the Lisp FFI.  Is this what
you're planning on doing?

Cheers
Brad


More information about the slim-vim mailing list