logoalt Hacker News

anta40 • today at 1:58 PM • 2 replies • view on HN

Nice to see gforth is still being maintained.

BTW, on the other side, looks like gforth still lacks the ability to create native OS executable, something like:

gcc myprog.c -o myprog

?


Replies

jan_m_savage • today at 2:27 PM

That’s because Gforth is a threaded-code VM that saves dictionary images rather than compiling to native code.

As you prolly know, Forth blurs compile time and run time in general, and there’s no so-called clean compile, then link boundary like in C.

SwiftForth, VFX Forth, and iForth do emit real executables, and there are smaller native-code Forths for Linux too, but then the opportunity cost is losing Gforth’s portability and its standards-heavy library ecosystem.

nickcw • today at 3:26 PM

You may enjoy ccforth then which is a mostly gforth compatible compiler which compiles to native via C.

https://github.com/ncw/ccforth

I wrote it as an experiment in having both a forth interpreter and compiler running at the same time.