Re: Translate once, run anywhere.

new topic     » goto parent     » topic index » view thread      » older message » newer message
mitgedanken said...

I suggest to use LLVM as backend. It's portable. But it needs time. So, I guess it will be done for 5.0?

I'm not sure what the cost/benefit trade-off looks like for something like LLVM. I think we'd effectively just be adopting LLVM as a platform with a front-end for ingesting Euphoria code to LLVM IR (intermediate representation).

Euphoria already has its own IR, but we call it IL (intermediate language) and it's very much purpose-built for Euphoria, while LLVM IR is meant as an abstracted layer between any language and any architecture.

Don't get me wrong, LLVM is great and I'd love to see somebody build a Euphoria front-end for LLVM at some point. It'd be a neat project! But I think it would be a new dialect of the language (like Phix) and not "Euphoria" per se.

Other similar projects I've looked at are QBE which is lighter-weight but sadly only supports x64, and TinyCC which supports various platforms and is relatively portable and supports many architectures.

If anything, what I may do in the future is package TinyCC with Euphoria so the translator always has something to use out of the box, and users could still choose GCC if they want. Hypothetically it could also provide JIT-style execution.

mitgedanken said...

Oh, and for Windows we could use FlexDLL. Then it will be easier to write portable DLLs which we could use now.

I'm not sure I understand what problems we have that this project would solve?

I don't think Shawn was proposing we make portable binaries just that the C code coming out of the translator be identical regardless of where it's run from, and then rely on the compiler to make the platform-specific executable or library.

One thing I'd really like to see is being able to "load" a DLL built with the translator as if it were an include file. That would require exporting a symbol and then having a way to import it again later.

-Greg

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu