1. Translate once, run anywhere.

It has been a problem that once we have code in C it is fixed to one platform and architecture or another. To me the code produced by the translator should be portable. Testing this is rather adhoc though. Is there anyone around with 32-bit systems or UNIX systems that are not Linux who would like to participate in experiments of getting a translated to C helloworld program to compile so the buildsys can eventually do the right thing and create portable C code?

new topic     » topic index » view message » categorize

2. Re: Translate once, run anywhere.

SDPringle said...

It has been a problem that once we have code in C it is fixed to one platform and architecture or another. To me the code produced by the translator should be portable. Testing this is rather adhoc though. Is there anyone around with 32-bit systems or UNIX systems that are not Linux who would like to participate in experiments of getting a translated to C helloworld program to compile so the buildsys can eventually do the right thing and create portable C code?

I would love to accomplish this because it's been itching at me for a while. The current Makefile is huge, uses a lot of recursion, and repeats itself often.

I think it would be best to set the current Makefile aside build a new one, while updating the backend code to be as platform-agnostic as possible.

Most of the macros that are set by configure can simply be inferred by the backend automatically and overridden when necessary.

Here is a good resource for predefined macros: https://sourceforge.net/p/predef/wiki/Home/

-Greg

new topic     » goto parent     » topic index » view message » categorize

3. Re: Translate once, run anywhere.

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

new topic     » goto parent     » topic index » view message » categorize

4. Re: Translate once, run anywhere.

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

new topic     » goto parent     » topic index » view message » categorize

5. Re: Translate once, run anywhere.

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 message » categorize

6. Re: Translate once, run anywhere.

I wonder what about using eu4 transñater with eu3.1 source. Is possible to use it to compile the euphoria-only source to win or linux with 64 bits?

new topic     » goto parent     » topic index » view message » categorize

7. Re: Translate once, run anywhere.

The eu3.1 code is written with assumptions about pointer size. Simply translating it to C wouldn't have fixed that. Why would you want to use 3.1?

new topic     » goto parent     » topic index » view message » categorize

8. Re: Translate once, run anywhere.

Walk before you run. Ideally, a man would be able to download the translated C source of the Euphoria interpreter which could have been translated on Windows, and then just run 'configure;make' on his NetBSD system. I'm starting with trivial programs.

If anyone would like to volunteer, you don't need to know how to code C. You do need a C compiler; either some GNU variant or Watcom.

https://github.com/OpenEuphoria/translator-generated

The repo is for code the translator generates. check it out. In the hello subdirectory try 'sh configure;make' or 'wmake'.

To get your own portable C, checkout the branch here: https://github.com/OpenEuphoria/euphoria/tree/translator-portable-c

For this part you would need to know how to compile Euphoria binaries. It's pretty much 'configure;make' on Linux.

new topic     » goto parent     » topic index » view message » categorize

9. Re: Translate once, run anywhere.

Hi there,

I come from this other thread; I would be interested in making sure that all sources to build Euphoria can be generated from scratch; as I understand that requires the pre-translated sources.

Unfortunately I cannot manage to generate them using Ubuntu/Debian.

Would anyone be interested in helping out to achieve this?

new topic     » goto parent     » topic index » view message » categorize

10. Re: Translate once, run anywhere.

gdm85 said...

Hi there,

I come from this other thread; I would be interested in making sure that all sources to build Euphoria can be generated from scratch; as I understand that requires the pre-translated sources.

Unfortunately I cannot manage to generate them using Ubuntu/Debian.

Would anyone be interested in helping out to achieve this?

Let's keep this discussion in that thread and I will try to help you there.

-Greg

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu