[HN Gopher] Forth: The programming language that writes itself: ...
___________________________________________________________________
Forth: The programming language that writes itself: The Web Page
Author : ingve
Score : 192 points
Date : 2023-07-16 15:24 UTC (7 hours ago)
(HTM) web link (ratfactor.com)
(TXT) w3m dump (ratfactor.com)
| snitty wrote:
| I learned Forth when it was the only language that had an
| interpreter than ran on PalmOS. So you could write and execute it
| on your PalmPilot while you were bored in class in the 90s.
| beanjuiceII wrote:
| really great read, thank you for putting this all together
| massifist wrote:
| I remember hearing about a computer called the Jupiter Ace that
| used Forth. I think it was similar to the ZX Spectrum.
| thesuperbigfrog wrote:
| Related Chuck Moore talk: "Programming a 144 Computer Chip to
| Minimize Power" (2013)
|
| https://www.youtube.com/watch?v=0PclgBd6_Zs
|
| How Forth powers ultra-low power computers:
|
| "GreenArrays is shipping its 144-core asynchronous chip that
| needs little energy (7 pJ/inst). Idle cores use no power (100
| nW). Active ones (4 mW) run fast (666 Mips), then wait for
| communication (idle)."
| agumonkey wrote:
| I genuinely wonder if this topology won't make a come back in
| the coming years.
| mananaysiempre wrote:
| To me GA144 looks less like a state-of-the-art CPU or DSP
| replacement and more like an FPGA replacement--and that would
| actually be lovely to see, given how inefficient and
| expensive FPGAs are nowadays compared to doing the same thing
| with a custom chip (if you only overlook the design cost for
| the latter). The "computer" marketing makes little sense to
| me.
|
| Unfortunately, GA don't seem to have gotten the memo about
| cheap entry-level dev tools that the microcontroller world
| has been circulating since 2010 or so. At the prices they
| charge for their devboards, you wouldn't really get one just
| to play with, even if the chips themselves are actually
| somewhat cheap compared to getting the same amount of compute
| on an FPGA.
|
| (It's $500 per devboard and $20 per chip, with each chip
| capable of 2e9 16-bit multiplies/sec. Somebody[1] is selling
| a breakout board with only the chip for a much more
| reasonable price of $35, but you'll need to figure out how to
| wire up the thing yourself.)
|
| Charles Moore is known for aggressively patenting his
| hardware, though. (Well, he and every other modern chip
| designer.) So we might not get to see anybody else do this
| stuff for a long, long time. Adapteva's Epiphany/Parallella
| design used a broadly similar idea with an explicit grid
| interconnect and also aimed for a piece of the FPGA/ASIC pie,
| but they had much beefier, synchronous cores with separate
| message routers attached to them.
|
| [1] https://schmartboard.com/schmartboard-ez-
| qfn-88-pins-0-4mm-p...
| agumonkey wrote:
| anecdata (and warning some people might not like that domain
| brought here), there's a mini vm in bitcoin that a subset of
| forth
|
| https://en.bitcoin.it/wiki/Script
|
| I just learned that this week
| cornholio wrote:
| It's a stack machine, but calling it a subset of Forth is maybe
| an exaggeration if you can't (afaik) define new words.
| agumonkey wrote:
| fair point, they say "forth like", I pushed it too far
| jacquesm wrote:
| By that rule the JVM is a 'subset of FORTH'.
| agumonkey wrote:
| yeah apologies, I can't edit my comment now or I would
| jacquesm wrote:
| I got the gist of it though, and I think you do have a
| point: FORTH showed the power of stack machines (and the HP
| calculators of course did too) in a way that not much else
| did and I'm pretty sure that the ease with which you can
| bring one up to bootstrap a new environment is part of the
| reason why they were (and still are) more popular than many
| people realize for embedded stuff and first silicon of new
| and experimental CPUs. You can bootstrap to an interactive
| system in an afternoon in FORTH and some of the JVM
| instructions are definitely reminiscent of FORTH.
|
| So it isn't all that farfetched to see the link between the
| Bitcoin embedded scripting language and the FORTH language,
| especially the stack section of the opcodes. I'd say
| they're of the same family, not necessarily a subset, and
| the lack of Turing completeness is of course a purposefully
| limiting factor.
|
| Stackmachines are fascinating, incredibly simple and yet
| quite powerful. There are a couple of such concepts in
| computing (NAND gates on the hardware side, the Lambda
| function on the software side and FORTH as well as
| for/if/jsr/load/store, and even brainfuck (and ook!)) which
| all allow you to build just about anything. Each of them
| warrants study.
| agumonkey wrote:
| Stack machines are really interesting. And Forth also had
| creative ways to think about code.
|
| I still need to read
| http://fpgacpu.ca/publications/Second-
| Generation_Stack_Compu... (amongst others)
| jacquesm wrote:
| A very interesting chip was the NOVIX:
| https://en.wikichip.org/wiki/novix/nc4016
| behnamoh wrote:
| Why did some ancient programming languages emphasize on CAPITAL
| LETTERS? Was there no "Shift" button on keyboards back then?
| pmcjones wrote:
| Lower-case was not common on printers and terminals in the
| 1950s and 1960s (and into the 1970s).
| Sindisil wrote:
| No, in some cases there were not. In addition, capitals served
| as a method of differentiation for language keywords and such.
| riidom wrote:
| Maybe worth to add that syntax highlighting was not a thing
| back then.
| alexwennerberg wrote:
| One of the most interesting Forth projects to me currently is
| Dusk OS, a 32-bit operating system written in Forth that includes
| its own C compiler, with various porting efforts under way
|
| https://duskos.org/
| LargoLasskhyfv wrote:
| That is indeed interesting. THX for making me aware of it.
| eggy wrote:
| I missed this one. Thanks for the link. I was just reading
| "Beyond the Collapse" and my Lisp and APL/J and C skills would
| not allow me to approach Forth's simplicity at the OS level.
| I'll definitely check this out by next weekend.
| weinzierl wrote:
| Open Firware uses Forth. It's sad, that it didn't win over UEFI.
|
| I also think to remember that it was used in movie productions to
| control movement and other parameters of props.
| idatum wrote:
| I forgot about dc! A NetBSD instance I have still has it. Love
| going back in time to these original utilities.
| fuzztester wrote:
| If you mean the calculator, bc is based on dc, IIRC.
|
| See you later, alliterator.
| idatum wrote:
| Yes, dc calculator, mentioned in this article. Here's the
| Wikipedia link also given:
| https://en.wikipedia.org/wiki/Dc_%28computer_program%29
|
| Here's the NetBSD man page: https://man.netbsd.org/dc.1
| fuzztester wrote:
| Yes, I knew about both of them (dc and bc) from before,
| having worked on Unixen for years.
|
| And have used bc a lot.
|
| Check out the useful bc -l option.
|
| Here is the page for bc:
|
| https://en.m.wikipedia.org/wiki/Bc_(programming_language)
|
| which is mentioned in the dc page's See Also section, which
| is what I alluded to in my earlier comment above, i.e. that
| bc is built on dc.
|
| See the History section of the bc page.
| fuzztester wrote:
| me 12/4
| spaintech wrote:
| It's interesting to note that even in Rust, there exists a Forth
| compiler, as depicted in these resources [1]. Its usage remains
| somewhat unclear to me [2], but its existence has been previously
| discussed here [3]. It boasts a robust implementation and, while
| it isn't a REPL Forth VM, it stands as an impressive VM
| implementation.
|
| I've been contemplating - given that FORTH is a VM - if there's a
| need for a compact and efficient system capable of managing
| streaming data, it could be the optimal choice for exceptional
| performance, close to the bare metal. There's no need to contend
| with the operating system. Isn't this essentially what FPGA's do,
| but on standard CPUs? I envision it as a specialized system,
| minus the requirement to create every driver for all the hardware
| you'd need to interface with.
|
| [1] https://docs.rs/rust-forth-
| compiler/latest/src/rust_forth_co...
|
| [2] https://docs.rs/fortraith/latest/fortraith/
|
| [3] https://news.ycombinator.com/item?id=23501474
| CyberDildonics wrote:
| Forth was influential, but it is somewhere between obsolete and
| niche. It is much more difficult to program in than even raw C,
| let alone C++ and offers no advantage in speed on modern hardware
| where memory access is the by far the highest priority.
| benhoyt wrote:
| My first programming languages were x86 assembly and Forth. My
| Dad was into Forth, and I learned programming from him. I wrote
| several x86 Forth systems for DOS as a teenager, culminating in a
| somewhat-polished ANS compatible one I called "Third":
| https://github.com/benhoyt/third -- it's kind of amazing being
| able to have a fully bootstrapped Forth compiler (including an
| assembler) in a couple thousand lines of code.
|
| Just the other day I transcribed an old article I had co-written
| for the _Forth Dimensions_ magazine. I still like the _ideas_ in
| Forth, but the stack manipulation quickly gets tedious and is
| very hard to read. Just look at the code examples in
| https://benhoyt.com/writings/forth-lookup-tables/ -- especially
| Search-Table. Yikes! Yes, naming things is hard, but apparently
| not naming them is even harder.
| 5- wrote:
| > but the stack manipulation quickly gets tedious
|
| it might just be that you (and i) are not chuck moore. his code
| generally has very little stack shuffling. e.g.
|
| http://www.merlintec.com/download/color.html
| vanderZwan wrote:
| Tangent: I remember reading this in its original presentation-
| prototype form, which is basically this article with much less
| text and more plotholes. The reason I'm mentioning it is because
| it's also a beauty of minimalism in terms of underlying website
| technology.
|
| [0] http://ratfactor.com/forth/forth_talk_2023.html
|
| [1] http://ratfactor.com/minslides/
| rwmj wrote:
| Is there something about writing your own FORTH _and_ writing
| your own simplified presentation software :-?
| https://www.mankier.com/1/techtalk-pse
| ttsiodras wrote:
| As soon as I met Forth, I felt I had to hack my own
| (https://github.com/ttsiodras/MiniForth/) - and did so over a
| single week, two years ago. I targeted the Blue Pill and the
| original Arduino, but developed via cross-compilers so that I
| could test my code in the host.
|
| I became so obsessed with the project that I was looking forward
| to tinkering with it after coming back from work every day; so it
| was hacked in 5 evenings and a weekend. It was _that much_ fun,
| to build a Forth.
|
| I highly recommend the process; I think the only other time I
| felt so enlightened was when I first met Lisp macros
| (https://www.thanassis.space/score4.html#lisp).
| lolinder wrote:
| > I became so obsessed with the project that I was looking
| forward to tinkering with it after coming back from work every
| day; so it was hacked in 5 evenings and a weekend. It was that
| much fun, to build a Forth.
|
| Yep. In my computer architecture class as a freshman, we were
| supposed to do a final project of our choosing for the LC-3 (a
| RISC instruction set with emulator). I had dabbled briefly in
| Forth (with the RedPower 2 Minecraft mod) and thought it'd be
| fun to implement one. It ate up essentially all of my free time
| that semester: There was one morning where I only realized I'd
| stayed up all night when the sun started to come up and I
| finally checked the clock.
|
| I've never found a practical use for Forth in my "real" life,
| but building one from scratch was an experience almost best
| described in religious terms. It was a pure distillation of
| Fred Brooks's description of programming:
|
| > The programmer, like the poet, works only slightly removed
| from pure thought-stuff. He builds his castles in the air, from
| air, creating by exertion of the imagination. Few media of
| creation are so flexible, so easy to polish and rework, so
| readily capable of realizing grand conceptual structures.
|
| > Yet the program construct, unlike the poet's words, is real
| in the sense that in moves and works, producing visible outputs
| seperate from the construct itself. It prints results, draws
| pictures, produces sounds, moves arms. The magic of myth and
| legend has come true in our time. One types the correct
| incantation on the keyboard, and a display screen comes to
| life, showing things that never were nor could be.
| adastra22 wrote:
| In terms of practical usage, FYI both bitcoin script and
| postscript (for printers) are Forth based, as are some
| aerospace chips.
| optimalsolver wrote:
| A great introduction is the book Starting Forth [0].
|
| It has the most charming illustrations I've ever seen in a text
| book.
|
| [0] https://www.forth.com/starting-forth/
| vanderZwan wrote:
| There is also Thinking Forth, which is a kind of sequel
|
| [0] https://www.dnd.utwente.nl/~tim/colorforth/Leo-
| Brodie/thinki...
| Jtsummers wrote:
| https://thinking-forth.sourceforge.net/ <- A better source.
| The one you linked includes a number of typographical errors
| early on (OCR errors?) that were grating for me to try and
| read. None of the errors I noticed in your link were present
| in the copies I checked out here.
| vanderZwan wrote:
| Thank you for the correction, sadly my post can't be edited
| any more
| DonHopkins wrote:
| Reposting this about a historic project that Charles Moore
| himself worked on:
|
| https://news.ycombinator.com/item?id=29261868
|
| DonHopkins 8 months ago | parent | context | favorite | on: Forth
| vs Lisp
|
| Coco Conn and Paul Rother wrote this up about what they did with
| FORTH at HOMER & Assoc, who made some really classic music videos
| including Atomic Dog, and hired Charles Moore himself! Here's
| what Coco Conn posted about it, and some discussion and links
| about it that I'm including with her permission:
|
| Peter Conn:
|
| https://imgur.com/a/4Bmb4xu
|
| Homer & Associates (1982):
|
| http://leftbrain.us/rotherHistory/homer.html
|
| Peter Conn Papers at Stanford:
|
| https://library.stanford.edu/blogs/special-collections-unbou...
|
| https://oac.cdlib.org/findaid/ark:/13030/c8n303pn/entire_tex...
|
| George Clinton - Atomic Dog (Official Music Video) HD
|
| https://www.youtube.com/watch?v=LMVZ36VA0wg
|
| Steve Miller Band - Abracadabra
|
| https://www.youtube.com/watch?v=tY8B0uQpwZs
|
| Steve Miller Band - Bongo Bongo
|
| https://www.youtube.com/watch?v=_NrsRZdMI-A
|
| Flying Logos for 1989 Siggraph Electronic Theater:
|
| https://www.youtube.com/watch?v=9hIOfEiy4lc
|
| >First shown at the 1989 Siggraph Electronic Theater to a rave
| response, this 3 minute humourous film went on to win several top
| computer graphic awards that same year including Niccograph of
| Japan.
|
| >Coco: This was a show favorite at the SIGGRAPH film show that
| year. The year before the conference committee decided that
| showing demos wasn't the way to go anymore. Peter wrote Flying
| Logos as a way to sneak our demo reel into the show by turning it
| into a story. It worked and we made it into the film show.
|
| >Don: I truly believe that in some other alternate dimension,
| there is a Flying Logo Heaven where the souls of dead flying
| logos go, where they dramatically promenade and swoop and spin
| around each other in pomp and pageantry to bombastic theme music.
| It would make a great screen saver, at least! Somewhere the Sun
| Logo and the SGI Logo are still dancing together.
|
| ----
|
| Peter Conn and I [Coco Conn] had a company called HOMER & Assoc.
| which was located at the Sunset Gower Studios from 1977 until we
| closed shop in 1997. We made music videos, commercials & computer
| graphics/special effects for feature films. One cool note, we
| worked with Paul Verhoven on both RoboCop in 1986 and the x-ray
| scene for Total Recall in '89.
|
| HOMER was actually a real time visual mixing console that our in-
| house engineer spent 1978 - 1981 designing and building, from
| scratch. The name HOMER stood for "Hybrid Optical Montage
| Electronically Reproduced." I helped as well, soldering the LEDs
| on the console and running cables. Peter built his own optical
| printer and three years into the build we also bought an early
| computer paint system. Our engineer finished building the console
| and promptly decided to move to England. We hadn't used it
| because we still hadn't found the right software to run the
| system. Luckily that's when Paul Rother joined the company.
|
| The joy stick on our console would bump you to the next line of
| code (being a command or sequence of events: fade, cut, dissolve,
| etc.) The console had touch sensitive fader pads. There were no
| dials. I think they were made by Allison? Each channel (which
| controlled either a slide projector or a film projector) was
| touch sensitive. After recording a sequence we could then tweek
| the current version using additional effects the channels offered
| such as momentary, additive, on/off, etc. For instance if you
| wanted to crossfade two images, you could either program it or
| perform it. Of course everything you did was recorded and would
| play back on the next round. You literally performed a sequence
| of visual effects with your hands. Peter would do countless
| passes until everything was perfect. This performance would then
| be played back to IP film on the optical printer. Each slide tray
| or film real would be individually run, one by one, to IP film.
| Sometimes there would be 10-15 or more passes to get all the
| elements transferred. Once that was done we would then convert
| the IP film to video and do additional video editing and effects.
| A totally nuts analogue system. But it worked.
|
| ---------------
|
| HOMER Explained by Paul Rother, in-house programmer, (1982):
|
| The photo is Paul sitting in front of the Optical Printer 7-bit
| Paint system, Homer and Associates, circa 1982. Homer and
| Associates was really one of a kind kinda of company. Founded by
| Peter Conn, originally I got hired to program Homer II, a visual
| realtime mixing console. Homer I is another whole story, but
| before my time. Homer II consisted of 16 slide projectors, 4
| movie projectors, a 4 track tape recorder, 24 visual channels
| (each with its own Z80) touch sensitive sliders, a master Z80
| S100 bus system and featuring "the joy stick bumper " control,
| which looked liked the gear shift right out of a 1964 mustang
| convertible.
|
| The idea was that you would program a visual sequence, then play
| the sequence in sync with the sound track on the joystick,
| including cascades, bumps, cuts, etc. The whole thing would be
| recorded, and if you wanted to, like an audio mixer, go back and
| do over dubs, making corrections. Then once you had the perfect
| "hero" recording, you take the 8" floppy disc with the hero
| recording and the trays of slides to the optical printer, and
| record it to IP motion picture film, making multiple passes, one
| tray at a time. Now that I think about it, it was a crazy idea.
| We actually got the whole thing to work. And it worked great!
|
| Forth & Charles Moore
|
| We hired Forth, Inc. and got Charles Moore, the inventor of FORTH
| to program the console host computer. I learned FORTH and worked
| with Charles. I programmed the 2K byte EPROM in each visual
| channel. On the Master Z80 system we ran PolyForth a multi
| tasking system in 32K bytes. We had an extra 16K RAM for buffers
| and things. If I remember right, the system ran four tasks, but
| that was 20 years ago, my memory may be hazy.
|
| Anyway, I learn not only FORTH from Charles Moore, but also how
| to factor code in to small reusable routines, WORDs they're
| called in FORTH. I learned Object Oriented Programming without
| knowing it. Also a lot of use of vectors. Its a cool language.
| Charles Moore was a great inspiration to me, and really taught me
| a great deal that they never taught me in computer programming
| school.
|
| CAT-700
|
| After we got the basic Homer II working and were able to record
| on the optical printer, Peter had another idea. He wanted to be
| able to see the movement of the optical printer, and see a prior
| frame compared to the current frame. We already had a video
| assist on the Fries Mitchell 35mm. What we needed was a Frame
| Buffer. We heard of S100 video board called the CAT-100, which
| was 1-bit frame buffer, good enough for what we needed. Somehow
| we never found a 1-bit version, but we found 7-bit version in the
| recycler!
|
| We flew to Reno, rented a car and drove to a log cabin up in the
| hills of Truckie California. We got a demo of the thing. The guys
| were super secret and didn't want us to see the controlling
| program. It worked, so we bought it, and then flew onto Palo-Alto
| and met the French guy who designed it. They checked it out and
| it was OK. This was the days before computer designed boards, and
| all the traces on the board were curvy, kinda like a Van Gogh
| painting. We learned that it was 7-bit (CAT-700) because it would
| have been an 8-bit, but they could not get the 8th bit to work.
| We spent the night in Palo Alto with a Stanford friend of Peters
| working on a crazy secret Apple project, the Lisa. 32KByte Paint
| System
|
| So I got the CAT-700 frame buffer to work, programmed in FORTH.
| So in that 32K we had an optical printer control system, and a
| paint system, all in one. (Also the OS, compiler, debugger, etc.)
| We later hooked up a Summigraphic Bitpad (before the Watcom
| tablet) and were able to draw on top of digitized frames. It got
| to the point where we needed TWO optical printers, one to
| digitize from film, and the other to record to film. Rube
| Goldberg is not strong enough descriptive to describe the system,
| with the filter wheels and all on stepper motors, it made music.
| The first use of the system was effects for Steve Miller Music
| Video, Abracadabra. I also remember using it on the George
| Clinton Video, Atomic Dog.
|
| This photo was taken right after we got the system to work. I had
| hooked up an analog slider box, which controlled things like
| color. There were 4 color maps we could switch between instantly
| We did a lot of work in planes, using 2 planes for the original
| image to be rotoscoped, and the other 5 planes to draw onto. This
| photo was taken for an article in Millimeter Magazine. The photo
| ended up being a two page color spread, and I think Peter was
| pissed, cause I got premier exposure.
|
| TTL logic
|
| At Homer and Assoc. I also learned TTL logic and designed a
| number of computer boards for the S100 bus. One that controlled
| stepper motors with a timer chip (Motorola 6840). Another to
| control the Slide Projectors also using the same Motorola timer
| chip to control the lamp triacs. My favorite thing, about the
| system, was the use of the cassette storage interface as a cheap
| timecode reader/writer.
| loscoala wrote:
| I have implemented yet another forth by myself. It works a little
| bit different and it is not intended to be a true copy of the
| original idea.
|
| Since the post says you can discover Forth, here's my part:
|
| https://github.com/loscoala/goforth
|
| The main difference is that in this Forth variant, the source
| text is completely translated into bytecode and there is no
| runtime in the sense of classic Forth. This makes it easy to
| translate the bytecode to C.
|
| I use my own Forth to generate C code with it, which I then embed
| in other software.
| jacquesm wrote:
| That can be very productive and clever, but be - and stay -
| aware that such polyglot solutions tend to be maintenance
| headaches in the longer run.
|
| There is a really nice open source project out there that
| allows you to train your hearing and your sightreading, but
| it's written in the authors own language which in turn compiles
| to JavaScript and the headache to set up their toolchain is
| such that I haven't bothered fixing any of the bugs that I'm
| aware of (and there are plenty).
|
| https://sightreading.training/
|
| https://github.com/leafo/sightreading.training
|
| It's written in a language called 'Moonscript':
|
| https://github.com/leafo/moonscript
|
| Which compiles to Lua. Which compiles to JS.
|
| Madness. Nice madness, but still, it stopped me from being a
| contributor.
| nmz wrote:
| It's a little strange to talk about moonscript as something
| obscure, luarocks the main package manager for lua is written
| in it, not to mention itch.io. It's a proven language that's
| at least easier to learn than lua. (well, its at least more
| programmer friendly)
| jacquesm wrote:
| Sorry, but it just doesn't cross my threshold for
| 'mainstream', whereas Lua does at least get within striking
| distance.
| submeta wrote:
| If you wonder: How does it write itself? Isn't it just the
| ability to write functions?
|
| In a way, yes, but it's a bit more than that. Many programming
| languages allow you to define functions or methods, but Forth
| takes this concept further by allowing you to define new "words"
| that can become part of the language itself. These words can be
| used just like built-in operations, and they can even change the
| way the language behaves.
|
| Also, because Forth is an extensible language, you can create
| words that define new control structures or modify the language's
| syntax. This is a level of flexibility that's not commonly found
| in other languages. In this sense, Forth can be seen as a
| language that "writes itself" because it allows programmers to
| customize and extend the language in a very fundamental way.
|
| The ability to extend Forth by defining new words is somewhat
| similar to the macro system in Lisp. Both provide a way to extend
| the language and customize it to suit your needs.
|
| In Lisp, macros allow you to define new syntactic constructs in
| the language. They work by transforming your program at compile-
| time, essentially letting you create your own domain-specific
| language within Lisp. This is a powerful feature that makes Lisp
| highly flexible and adaptable.
|
| Similarly, in Forth, you can define new words that become part of
| the language and can be used just like built-in words. This
| allows you to extend the language's syntax and functionality,
| making Forth highly extensible and customizable.
| mighmi wrote:
| Ah, what beautiful paradigms there are which we toil away
| without. Retro (a modern Forth) looks very interesting. The
| textbook Thinking Forth is near SICP in terms of opening your
| mind to a new paradigm.
|
| Is anyone using Forth in production these days with stories to
| tell?
| eggy wrote:
| I only wrote some file munging and reporting programs in
| Factor, a batteries-included Forth. Nobody would need these
| tools, so I was free to make and use for myself. They had
| people scraping HTML and Excel reports to do their reporting
| before. I exported my results to HTML and Excel. Sneaky fun for
| myself!
| Gordonjcp wrote:
| Probably not. It turns out that it doesn't map to modern
| computer processors terribly well.
|
| It's an amazing and elegant language, but anything that does
| register-to-register operations is always going to be faster
| than register-to-memory.
| astrobe_ wrote:
| There's a bunch a vendors still alive, mainly the historic
| Forth, Inc. and MPE. Both publish complete systems and native
| compilers that apparently perform well enough. If raw
| execution speed was all that matters, I can name a bunch of
| popular programming languages that wouldn't have survived
| long enough to be saved by JIT, or to become to big to fail
| (that is, their ecosystem).
| slavapestov wrote:
| Stack code can be mapped to register code trivially if you
| impose some restrictions (each word has a static effect and
| both branches of a conditional have the same effect). Then
| lowering to SSA form performs an "abstract interpretation"
| where evaluating a word pops SSA values from a "abstract
| stack", creates an SSA node and pushes its output values on
| the stack.
| vanderZwan wrote:
| I wouldn't say that sounds trivial exactl...
|
| > _slavapestov_
|
| ... ok, fair enough: it probably is trivial for you, lol.
|
| (For the uninitiated: Slava Pestov created Factor, a modern
| concatenatvie language which (IIRC) did a lot of innovative
| stuff regarding optimizations in that domain)
|
| [0] https://factorcode.org/slava/
| carapace wrote:
| Ha!
|
| Whenever I work on compiling Joy code I have to fight the
| urge to just write Joy-in-Factor and lean on all that
| crunchy goodness.
|
| (I wrote Joypy (mentioned in TFA), now Thun (someone took
| Joypy on PyPI so I renamed it) which includes
| interpreters in C, Nim, OCaml, and Prolog. I made a few
| feints at compiling Joy so far, but it's just kid's play
| compared to Factor. "I am but an egg.")
| jacquesm wrote:
| > Probably not.
|
| Probably yes.
| Gordonjcp wrote:
| In which case, I'm sure you can give some examples.
| jacquesm wrote:
| Is Google down again? Bummer.
|
| FORTH is still used to bring up new silicon because of
| its tiny core, you only need a couple of working assembly
| instructions to bootstrap yourself into a working system,
| you could do this entirely in cache or a small static RAM
| if you don't have a working memory controller yet.
|
| It is also used all over the place in embedded
| controllers, https://arduino-forth.com/ , http://www.picl
| ist.com/techref/microchip/language/forths.htm ,
| https://github.com/nimblemachines/muforth , from PICs to
| ARMs and everything in between.
|
| You won't see a lot of hype around it and repos tend to
| be old because they 'just work', typically a user of such
| a system would download it and customize it to the point
| that sharing it would be pointless, the whole idea is to
| extend the language to become the application.
___________________________________________________________________
(page generated 2023-07-16 23:00 UTC)