11 ms·
Jonesforth: Implementing Forth in Assembly
- pgt 7y agoOn Linux you will encounter: jonesforth.S:1154:10: fatal error: 'asm/unistd.h' file not found". Here is the solution: https://stackoverflow.com/a/53686051/198927 https://stackoverflow.com/a/53686051/198927
- pgt 7y agoStruggling to get this so build on OSX, so I've posted a question on SO: https://stackoverflow.com/questions/61077637/how-to-compile-jonesforth-on-osx-mojave https://stackoverflow.com/questions/61077637/how-to-compile-...
- pgt 7y agoThis port of JONESFORTH compiles on OSX: https://github.com/ruda/jonesforth-macintel https://github.com/ruda/jonesforth-macintel
- tgvaughan 7y agoFunnily enough for something that's made such a huge impact on my life, I never managed to get Jonesforth to compile either. It's such a good read that it hardly matters whether you actually run it. (Instead I used it as the basis for a FORTH-83 implementation in Julia and ran that instead.)
- mikekchar 7y agoWow. I love the license: "I, the copyright holder of this work, hereby release it into the public domain. This applies worldwide. In case this is not legally possible, I grant any entity the right to use this work for any purpose, without any conditions, unless such conditions are required by law." I wonder if that is good enough. I'm temped to use that for my extremely permissive stuff.
- Tomte 7y agoCC0 is another way to do it, much wordier, but with legal advice behind it: https://creativecommons.org/share-your-work/public-domain/cc0/ https://creativecommons.org/share-your-work/public-domain/cc... I still like the JonesForth version of a public domain release.
- flixic 7y agoSpecifically to make it "good enough", CC0 was created: > CC0 helps solve this problem by giving creators a way to waive all their copyright and related rights in their works to the fullest extent allowed by law https://creativecommons.org/share-your-work/public-domain/cc0/ https://creativecommons.org/share-your-work/public-domain/cc...
- rwmj 7y agoI copied that from Wikipedia (back in 2007 obviously) public domain release statement, which is written by a lawyer so I've no reason to believe it's not watertight, at least in the US. The intent is to make it public domain, but unfortunately you can't "place something in the public domain" in most jurisdictions, contrary to popular belief. Therefore you have to provide the back-up extremely liberal license. Nowadays as others have said you'd be better off using CC0.
- a7b3fa 7y agoJonesforth is insanely cool. The linked mirror seems to be missing 'jonesforth.f'. Maybe try check out this one[1] for the full implementation. I recently tried porting Jonesforth to UEFI[2], so I could run it directly on my hardware without needing an operating system. I was actually surprised by how easy it turned out to be. Okay, admittedly I ended up rushing a bit towards the end, and the final result is very bare-bones - it can do "Hello, World!", Fibonacci numbers, and then that's pretty much it. Still, it was a lot of fun, and I would totally recommend a project like this, especially if you don't usually work with "low-level" development. I also ended up writing a blog post[3] to help people get started writing assembly for UEFI. The best resource is probably the OS Dev wiki, though. It has a ton of great resources. [1]: https://github.com/nornagon/jonesforth https://github.com/nornagon/jonesforth [2]: https://github.com/c2d7fa/jonasforth https://github.com/c2d7fa/jonasforth [3]: https://johv.dk/blog/bare-metal-assembly-tutorial.html https://johv.dk/blog/bare-metal-assembly-tutorial.html [4]: https://wiki.osdev.org/Expanded_Main_Page https://wiki.osdev.org/Expanded_Main_Page
- voldacar 7y agoIs jonesforth singlethreaded or does it utilize all available cpu cores? I only ask because a lot of these little baremetal languages just do the bare minimum needed to boot to a repl without exploiting the full capabilities of the hardware
- rwmj 7y agoIt's single-threaded because it's a learning tool not a forth you'd ever want to use in an environment where performance would matter. Single-threaded or not, forth interpreters [not compilers] have terrible interaction with branch prediction - they will never perform well on modern CPUs. Virtually every other instruction executed is a jmp that cannot be predicted and thus will collapse the pipeline.
- voldacar 7y agoSo basically the opposite of APL.
- TurboHaskal 7y agoI had my third go at Forth this year and I can say it finally clicked, to the point that I ended up buying a license for a commercial compiler for non trivial stuff. If I may hijack this conversation: I'll be trying T3X [0] next, and know about the usual suspects B, BCPL and MCPL. They seem fun but not as malleable as Forth. Can HN recommend other (don't care if obscure) typeless programming languages? [0] https://t3x.org/t3x/index.html https://t3x.org/t3x/index.html
- e12e 7y agoWhich compiler, and for what purpose - did you end up buying? What does it give you beyond the many open implementations? On a side note - anyone know if greenarrays is still delivering hw? Those multicore forth chips really seemed nice (and crazy).
- TurboHaskal 7y agoMostly performance. GForth is slow compared to the optimising compilers (I know about gforth-fast already). Also I don't care that much about open source. I'm old enough not to be opposed to the idea of buying compilers. I ended up with iForth which is well priced, targets 64bit and has a simple license. Here's a feature list http://users.bart.nl/users/mhx/i4faq.html http://users.bart.nl/users/mhx/i4faq.html SwiftForth and VFX are awesome as well but 32bit only and can't justify paying that much at this point.
- e12e 7y agoHm, I hadn't really thought about optimizing compilers for forth... I wonder if the strategies are different than for eg c or Pascal compilers. I guess the situation is simalar for other closed compilers (Intel c, high perf Java compiler/VMs etc).
- exikyut 7y agoI've always been really, really curious about the GA144 devkit for a while: http://www.greenarraychips.com/home/products/ http://www.greenarraychips.com/home/products/, http://www.greenarraychips.com/home/documents/greg/DB014-190520-EVB002.pdf http://www.greenarraychips.com/home/documents/greg/DB014-190... The only small caveat is that it's basically $500 for a PCB with two chips on it. (And a prototyping area, SRAM, an Ethernet PHY, SD, and USB...) I'll probably continue to remain curious for some time, heh.
- 9214 7y agoFor those trying to grok Forth implementation, I cannot recommend Brad Rodriguez' "Moving Forth" [1] series enough. But my favorite one is "1st, 3rd and almost 4th" [2]. Oh, and Loeliger's classic book on the subject [3]. [1] https://www.bradrodriguez.com/papers/ https://www.bradrodriguez.com/papers/ [2] http://www.ioccc.org/1992/buzzard.2.design http://www.ioccc.org/1992/buzzard.2.design [3] https://archive.org/details/R.G.LoeligerThreadedInterpretiveLanguagesTheirDesignAndImplementationByteBooks1981 https://archive.org/details/R.G.LoeligerThreadedInterpretive...
- DonHopkins 7y agoThere should be a book (or comedy skit) about the people who use Forth, called "Who's on FORTH?" What are you asking me for??? I don’t know!!! https://www.youtube.com/watch?v=kTcRRaXV-fg https://www.youtube.com/watch?v=kTcRRaXV-fg
- dang 7y agoWe changed the URL from http://git.annexia.org/?p=jonesforth.git;a=blob_plain;f=jonesforth.S;hb=HEAD http://git.annexia.org/?p=jonesforth.git;a=blob_plain;f=jone..., by the request of Forthjones himself, whose home server was being pummelled.
- DonHopkins 7y agoReally beautifully written and documented code! https://github.com/nornagon/jonesforth/blob/master/jonesforth.f https://github.com/nornagon/jonesforth/blob/master/jonesfort...