Live data from Hacker News

What the hell is Forth? (2019)

blog.information-superhighway.net

61–70 of 138 posts

Re: What the hell is Forth? (2019)

#61
post #43

Earlier quoted context omitted.

The part about the language being a little bootstrap and then mostly implemented in its own language... Are there other languages like this? At least any mainstream ones?

Lisps, can be, and sometimes are, implemented in a similar way. Trying to figure out the exact number of Lisp primitives required to write the rest of Lisp in Lisp is seemingly a hobby for some. A compiler for a functional language usually transforms the program into another functional language, an intermediate representation, one much more friendly to machine-implementation. (The classic model has four pointers to f…

https://github.com/udem-dlteam/ribbit

And https://piumarta.com/software/maru/

Are two good examples. Maru is interesting in that it can implement a full-fat language/os/vm/compiler in under 2kloc

Bluebottle is another barbecues and up OS: https://github.com/btreut/a2

Re: What the hell is Forth? (2019)

#62
post #44

The author complains about not having local variables, but most decent Forth environments have them. It is not difficult to have local variables in Forth, just use a library or compiler that provides them.

The language has, perhaps, a bit too much Chuck Moore: Don't reuse code, don't make code reusable, and don't try to anticipate anything. The knob is turned all the way over to the "simplicity of implementation" end of things, and all else be damned. http://www.cs.uni.edu/~wallingf/blog/archives/monthly/2017-1...

Yeah, but it goes to 11!

Re: What the hell is Forth? (2019)

#64
post #34
post #5

Earlier quoted context omitted.

Agree with the parent, it's a language worth knowing like LISP is worth knowing, but (unlike LISP) it is not a good language choice for almost all use cases in 2023 (almost all use cases are not that memory constrained any more, even embedded systems), for the same reason you shouldn't use Perl (it is very hard to read code). I was going to say "its main disadvantage is that the only way to find out what a piece of c…

> it is not a good language choice for almost all use cases in 2023 I think I agree with this. But it’s fun to think about wild scenarios where it would make sense. Like some dystopian future where people are trying to cobble found hardware together to make something.

> Like some dystopian future where people are trying to cobble found hardware together to make something.

https://git.sr.ht/~vdupras/duskos

http://collapseos.org/

Re: What the hell is Forth? (2019)

#68
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 web browser. Single file doesn't require a server, you can drag and drop code onto text window.

https://github.com/tehologist/ecma6-forth

Runs standalone, I want to get back to it again.

Re: What the hell is Forth? (2019)

#69

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…

Along similar lines, i once watched this guy on YouTube implement a Python-based Forth _compiler_ (not interpreter) and optimize the crap out of it. It was a great video, if anyone’s interested it was called “Porth” and i think his GitHub page has a link to the video.

Re: What the hell is Forth? (2019)

#70

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…

Along similar lines, i once watched this guy on YouTube implement a Python-based Forth _compiler_ (not interpreter) and optimize the crap out of it. It was a great video, if anyone’s interested it was called “Porth” and i think his GitHub page has a link to the video.

Found the video you referenced.

https://www.youtube.com/watch?v=8QP2fDBIxjM&list=PLpM-Dvs8t0...

I met the creator Charles Moore a few times. When I lived in the bay area and used to go to the svfig (silicon valley forth interest group) meeting. He would often talk about forth was like solving a puzzle, likened it to sudoku. It is a good exercise for the brain and I highly recommend it.

https://www.forth.com/starting-forth/

Post reply on HN