pforth generating c++/c files

47 views
Skip to first unread message

Damien LeFerve

unread,
Sep 8, 2018, 11:17:55 PM9/8/18
to pfor...@googlegroups.com
Hi, thanks for letting me in the group.
 
I have a question about pforth. In the manual it talks about being able to generate a c/c++ file from the pforth program that you create. So if I understand this correctly it will generate a file that I can run in C++?

Phil Burk

unread,
Sep 9, 2018, 12:58:46 PM9/9/18
to pforthdev
Hello Damien,

PForth does not have a general purpose c/c++ code generator.

Normally pForth is built on the same machine where it runs. Then pForth will load its dictionary from the "pforth.dic" file. 
But sometimes we want to target-compile pForth to run on a smaller embedded processor that may not have a file system. So we compile pForth on the host and then just generate a standalone program for the target that does not need to load any files.

PForth can export its dictionary as 'C' code that can then be compiled directly into the Forth executable program. This dictionary can include your custom Forth code.

Instructions are here:

I sometimes do this even on host systems to make a standalone Forth. Then I don't have to worry about where the pforth.dic file is.

Phil Burk


On Sat, Sep 8, 2018 at 8:17 PM Damien LeFerve <dlef...@yandex.com> wrote:
Hi, thanks for letting me in the group.
 
I have a question about pforth. In the manual it talks about being able to generate a c/c++ file from the pforth program that you create. So if I understand this correctly it will generate a file that I can run in C++?

--
You received this message because you are subscribed to the Google Groups "pforthdev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pforthdev+...@googlegroups.com.
To post to this group, send email to pfor...@googlegroups.com.
Visit this group at https://groups.google.com/group/pforthdev.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages