I didn't really understand forth till I tried implementing eforth in c. https://github.com/tehologist/forthkit Managed to write a compiler/interpreter that could understand enough forth to implement the entire system. Less than 500 lines and only uses stdio.h and compiles using TCC https://bellard.org/tcc/ That was so much fun I built a second one in under 300 lines of javascript for experimenting with canvas api in…
What the hell is Forth? (2019)
71–80 of 138 posts
Re: What the hell is Forth? (2019)
#72I didn't really understand forth till I tried implementing eforth in c. https://github.com/tehologist/forthkit Managed to write a compiler/interpreter that could understand enough forth to implement the entire system. Less than 500 lines and only uses stdio.h and compiles using TCC https://bellard.org/tcc/ That was so much fun I built a second one in under 300 lines of javascript for experimenting with canvas api in…
Re: What the hell is Forth? (2019)
#73For example, I created many words to perform unit conversion, such as temperature:
: 2fahrenheit 9 * 5 / 32 + ;
: 2celsius 32 - 5 * 9 / ;
Furthermore, I can even pull in live currency conversion rates from Yahoo Finance to go between USD and CAD.Since my underlying Forth interpreter runs on Python[0], I get the full large integer and floating-point support that Python has.
Re: What the hell is Forth? (2019)
#74I sometimes can't grasped how my Forth-based languages work when processing larger code, but it could have been easily because I never invested thst much into learning Forth anyways, which is why my third one is a Lisp.
Still, Forth is a very simple and incredible language. It is simple to understand, but harder to process on larger code. It is incredibly easy to implement, and easily extendable. It is also very predictable with only a few exceptions, which makes it a favorite for first-time esolangers.
The only shortcomings from Forth's design is getting used to stack-based operators, but I feel like it's something that can be adapted over time.
[0]: https://github.com/HoangTuan110/Nooklang
Re: What the hell is Forth? (2019)
#75It has the most charming illustrations I've ever seen in a text book.
Re: What the hell is Forth? (2019)
#76I believe that any programmer should at least know a little about Forth. It's like Lisp. Just knowing about them is extremely enlightening, even if you don't use them in your daily life. Obligatory link: https://github.com/nornagon/jonesforth/blob/master/jonesfort... This well-written tutorial will have you implement a Forth in 500 lines of assembly and another 500 lines of Forth. You will feel like a different perso…
I agree. My introduction to Lisp was Seibold's Practical Common Lisp -- a very hot book back in the mid-to-late aughties, that I suspect introduced a lot of people to Lisp.
Forth feels like it's having a similar moment (by which I simply mean: a lot of people are talking about it in terms of enlightenment, not that it's going to replace JavaScript!). So I wonder. Think someone will write a Practical Forth?
Re: What the hell is Forth? (2019)
#77I started using Forth because I wanted a Reverse Polish Notation calculator at the command line. It turned out to be very practical and extensible. For example, I created many words to perform unit conversion, such as temperature: : 2fahrenheit 9 * 5 / 32 + ; : 2celsius 32 - 5 * 9 / ; Furthermore, I can even pull in live currency conversion rates from Yahoo Finance to go between USD and CAD. Since my underlying Forth…
Re: What the hell is Forth? (2019)
#78Re: What the hell is Forth? (2019)
#79I've written a ton of Forths over the years in different languages, and every time I run into an article about it I get the itch to do another one.
Re: What the hell is Forth? (2019)
#80Here are some great resources on Forth: http://www.call-with-current-continuation.org/articles/forth... https://git.sr.ht/~vdupras/duskos/tree/master/fs/doc/design/... https://www.youtube.com/watch?v=9TJuOwy4aGA Let me quote the first essay at length: > Writing "good" Forth code is very hard, or at least what I consider good Forth code, which may be different from what others consider good. Forth has been called a "w…
And Forth is nothing new as a low-level, bending-over-to-the-machine language [1], except that its users to have constant urges to decry everything else as bloat (first link), civilisation-threatening, training wheels (third link), and all those wonderful things. Just don't do anything [0], and hoorah, you can write nothing too.
[0] https://news.ycombinator.com/item?id=28771886 is a classic on that topic.
[1] Bemusingly this does not make it necessarily fast; some Forthen are too simple and too low-level for compilers to get much done, c.f. https://applied-langua.ge/posts/i-dont-want-to-go-to-chel-c.... for the video described in the third link.