ForthHub/discussion

Is there C to Forth compiler or research?

zhoupeng opened this issue · 9 comments

Is there compiler, papers or reports about c to forth pls?

On 28/10/2018 at 8:06 AM, "zhoupeng" @.***> wrote: compiler, papers or report on c to forth? -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: #76
There are such things around. See http://www.mpeforth.com/ for details of their 'Sock-Puppet' which will handle c-code with the ease you can handle Forth words. There might also be some papers in the past EuroForth proceedings http://www.complang.tuwien.ac.at/anton/euroforth/. Regards Paul E. Bennett IEng MIET Systems Engineer Lunar Mission One Ambassador.

Thank you very much, it's helplful.
but I think Sock-Puppet give solution on how to call C libary from Forth, rather than compile C source to Forth directly, if my understanding wrong pls correct me.

I find a report https://github.com/daniRiesgo/C-to-Forth-compiler/blob/master/report.pdf, but unfortunately, it is not written in English.

Thanks,
Best,

There are such things around. See http://www.mpeforth.com/ for >details of their 'Sock-Puppet' which will handle c-code with the >ease you can handle Forth words. There might also be some papers >in the past EuroForth proceedings >http://www.complang.tuwien.ac.at/anton/euroforth/. Thank you Mr Paul very much, it's helplful. but I think Sock-Puppet give solution on how to call C libary from Forth, rather than compile C source to Forth directly, if my understanding wrong pls correct me. I find a report https://github.com/daniRiesgo/C-to-Forth- compiler/blob/master/report.pdf, but unfortunately, it is not written in English.
Yes, the C has to be compiled first, then Sock-Puppet acts like the linker for the C routines. The one you found looks like Spanish. I guess some time with a translator package might yield most of the sense out of it. Regards Paul E. Bennett IEng MIET Systems Engineer Lunar Mission One Ambassador -- ******************************************************************** Paul E. Bennett IEng MIET..... Forth based HIDECS Consultancy............. Mob: +44 (0)7811-639972 Tel: Due to relocation - new number TBA. Please use Mobile. Going Forth Safely ..... EBA. www.electric-boat-association.org.uk.. ********************************************************************

It's good, thank you very much.

You might want to have a look at the ELVM Compiler Infrastructure, even if it looks more like a proof of concept. The (very simple) Forth backend is here.

spelc commented

There's a community version from long ago at:
https://www.mpeforth.com/resource-links/downloads/
Look for C2Forth.

cwpjr commented
spelc commented

The code link at
https://www.mpeforth.com/resource-links/downloads/
disappeared a while back but has now been restored.