Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Author here! This was a super fun project that consumed over a month of evenings and weekends. In the past couple of days I finished the examples, and I'm glad to finally put it out there.

I don't quite remember how I fell into the Forth rabbit hole, but I think I first heard about Collapse OS. Then I read yosefk's "My history with Forth & stack machines" [0], which is actually very critical of Forth. But when I saw if/then/else being defined in Forth itself, I was hooked.

I've always been fascinated by the idea of having a minimal kernel of primitives from which "everything" can be built. Before Forth, I had only seen that in the form of Lisp's "Maxwell equations of software", which is cool, but always left me a little disappointed because it is too abstract to build something that you can actually interact with - you can't break out of its esoteric nature. The same applies to brainf*ck and other extremely small environments.

With Forth, however, you can start from almost nothing, and start adding things like ifs, loops, strings, etc., things that look more like your day-to-day programming. I find that there's a lot of beauty in that.

Anyways, I hope the examples in the repository do not look too awful to experienced Forth programmers :D

[0] https://yosefk.com/blog/my-history-with-forth-stack-machines...



This is a cool project! You might also like

https://golangnews.org/2020/09/bootstrapping/

... a non-exhaustive list of projects that create super-minimal interpreters, compilers, or maybe operating systems with very few dependencies or prerequisites.


> a non-exhaustive list of projects that create super-minimal interpreters

One of the items on that page is described as "25k lines of asm". That's the problem with 'tiny'. It means different things to different people. This FORTH thing however appears to be an exception. You know you're playing the game at a different level when your entire app can be statically linked with all its dependencies and still be small enough to fit inside the master boot record of a floppy disk (i.e. less than 512 bytes). I just wish I could figure out how to use the thing.


> I just wish I could figure out how to use the thing.

We've talked over email. Hope my pointers were enough to get you unblocked :)


Here's the follow-up to our email efforts: https://justine.storage.googleapis.com/forth.mp4 It works!


This just appears to be a copy of the bootstrappable wiki:

https://bootstrappable.org/ https://bootstrapping.miraheze.org/

Any idea why it was copy-pasted to the Golang News blog without attribution?


No, sorry for linking to a source that wasn't original!


I'd really like to revive https://github.com/nathell/lithium sometime. It can't bootstrap itself yet, but "no dependencies, runnable on bare metal" was a goal from the start.


Here's my "one line" (very long) command to run it:

  nbdkit -U - data base64='6h54UAAAAAFAW/8363YFdwEhW48H620OdwNzcEBU62QXdwNycEBV61sgdwIwPViFwA+VwEiYUOtLKXcBK1tYAdhQ60A5dwRuYW5kW1gh2PfQUOswRHcEZXhpdIflXofl6yJUdwN0aWJqAOsYYncFc3RhdGVoABDrC2x3Az5pbmgCEOsArf/geXcEaGVyZWiTd+vxAHmHdwZsYXRlc3Roo3fr4f53lXcDa2V5tADNFlDr0qV3BGVtaXRY6CIB68WydwE66LcAVon+iz6Td6Gjd4k+o3eriMgMQKrzpLj/Jqu4/HeriT6Td8YGABABXuuUh+VWh+WDwASJxuuI8He/d4E7ix6jd4BnAr/GBgAQALhbd4s+k3eriT6Td+lm//wODg4fBxfrC7ghCbsEALkCAM0Qvf52vP7/sAC5BBC/AADzqug4AIseo3eF23Taid6trIjCqEB1DiQfOMh1CFFX86ZfWXQEix/r4Inwvnt4gOKAChYAEP7KdJn/4EJ4iz4CELn//7Ag865PgD0AdBC5///yrk+JPgIQ99FJKc/DsA3oPACwCug3AL8AALQAzRY8DXQdPAh0BuglAKrr7oP/AHTpT+gZALggCrkBAM0Q69u4IACr6AgAxwYCEAAA655QtwC0A80QWLQOswfNEDwIdQyE0nUItAKyT/7OzRDDVao=' --run 'qemu-system-i386 -hda $nbd'
Although HN breaks the lines awkwardly if you copy and paste it should work.


I tried to do something “interesting” with my own little lisp based on the “Maxwell’s Equations of Software” paper. I don’t know if I succeeded exactly (and like most such projects I left it in a somewhat unfinished state), but I did achieve the same “now we’ve defined comments!” kind of mystical experience as the author of the linked article.

Have fun! https://github.com/breckinloggins/vau

(Check out the prelude for satisfying doses of meta)


It's a very different kind of simplicity and self-hosting. Vau uses rich features of a managed programming language in order to achieve lispiness.

The true beauty of something like SectorForth is its mechanical empathy. It relies only on the machine code of the system, and while it has quirks and shortcomings to fit in 512 bytes, it has everything you would need to bootstrap into a fully-productive Forth.

Of course, if Oscar Toledo feels inclined to step in and furnish a 512 byte extensible Lisp that runs on an 8080, I won't be upset.


Yep. I was definitely cheating, and it’s more like “syntactical self hosting”. I’ve wanted to try my hand at a Forth like this but so far I haven’t started anything.


I also recently hacked up a simple FORTH-like system, but mine just emulates the effects making IF/ELSE/THEN and DO/LOOP be built-in primitives.

In short I let you define words, and work in a FORTH-like manner, but without the real extensibility of an actual FORTH system. That will be something I tackle next:

https://github.com/skx/foth/

Nice to see more FORTH stuff posted here!


I actually came across your project yesterday :) Great work!


This is awesome! I've had a similar history very recently and am trying to write a forth with a type system (I think I've found a way to do it with nearly zero overhead) for Civboot.org I have a few notes about it on the github page, and I've just made it through the jobesforth tutorial. Learning asm ain't easy!


Very cool! Does it have any games yet?


This guy has written a bunch of boot sector games, although not boot sector games in forth ... https://github.com/nanochess/Invaders




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: