On Tue, May 13, 2008 at 11:48 PM, john skaller
<[EMAIL PROTECTED]> wrote:
>  Yes, it will work easily. Just look at flx_gen.  We have to implement
>  each of the BEXE_* and BEXPR_* things in LLVM.
>
>  Control flow is simple, if I recall:
>
>         BEXE_goto label
>         BEXE_ifgoto (cond, label)
>
>  are all you need.

I've started hacking at it already :) Got any tips on how to break up
complex expressions like "a*a + 2*a*b + b*b" into a series of
temporary expressions? One hack I was thinking of doing was to change
Flx_egen.gen_expr to return a string list, where each item is one of
the sub expressions. Then, modify Flx_gen.gen_exe to convert n-1
arguments into temps, and the nth argument into whatever call it's
being passed to.



>   regexp, reglex, grammar stuff would work much like now, by making
>  C/C++ code, the only trick being to wrap the top level entry C/C++
>  code with LLVM binding (which presumably it has).

Yep, it's quite simple to call c code. You just specify the arguments like this:

declare double atoi(i8* %a)

And their linker should find it assuming you link to the right
library. There's also issues of calling convention, but I believe we
can avoid that for now. My ocaml/kaleidoscope tutorial I ported for
them goes into calling external functions.

> > In the long run, we still could go with the scheme-based FFI, but just
> > make no attempt to share the same variants as the c++ FFI.
> >
>
>  A better option is Ocaml 3.11 with dynamically loadable back end.. in the
>  mean time just copy the back end, rename it llvm_*, and use a simple
>  switch to select C++ or LLVM back ends.
>

Yep, makes sense. I originally was going to try to genericize the
backend, but then I decided it'd be more fun to clone it and see what
would come out of a couple simple hacks.

By the way, I'll be in #felix on irc.freenode.net if you want to talk
about it :) Although it might be interesting for others to read what's
going on here.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft 
Defy all challenges. Microsoft(R) Visual Studio 2008. 
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Felix-language mailing list
Felix-language@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/felix-language

Reply via email to