IRC channel logs

2026-09-02.log

back to list of logs

<matrix_bridge><Jeremiah Orians> Well yes; one only needs a few hundred KB to have a powerful scheme implementation
<xentrac>you might be able to make do with less. XLISP ran on CP/M, and I don't think it's inherently more memory-efficient than Scheme
<xentrac>also, a lot of modern microcontrollers and Flash chips can do QSPI at 48MHz, which is 24 megabytes per second with submillisecond latency, so you can very reasonably reload a 64KiB on-chip SRAM with stored data 500 times a second
<xentrac>and being able to do 50 MIPS means that you can get by with CPU-time/memory-space tradeoffs that are way over on the reducing-memory-space side of the equation than you could have on a CP/M machine
<matrix_bridge><Jeremiah Orians> Well; one either has to create a managed heap to hold the strings in the Lisp code or Cons lists of the characters (which would take up 8 times the space) and psyntax.pp in mescc is 604,439 bytes in size. So a couple megabytes is the bare minimum amount of RAM needed.
<janneke> https://lwn.net/Articles/1088279/
<xentrac>oh, maybe for mescc
<xentrac>you probably can't get useful execution speed on any arbitrary Scheme program in 64K
<xentrac>but I think you can get a useful Scheme system in 64K, even if there are some programs it can't run usefully
<xentrac>or some inputs that those programs can't handle at a useful speed in it
<xentrac>David A. Wheeler wrote a nice comment in that comment thread, janneke: https://lwn.net/Articles/1090995/
<notgulldotnet>Yeah there’s very few programming languages below C level that allow for both speed and functionality
<xentrac>What do you mean?
<xentrac>specifically by "below C level" and "allow for functionality"
<notgulldotnet>By below C level, I mean programming languages that can predate C, i.e. be implemented in ASM or earlier
<notgulldotnet>See: https://bootstrapping.miraheze.org/wiki/Below_C_Level
<notgulldotnet>By "allow for functionality" I mostly mean "allow us to do things and not be a complete pain to write"
<notgulldotnet>like Forth
<notgull>Some time ago I did manage to fit a workable Forth in the boot sector, and added some features to make it somewhat pleasant to write programs in
<notgull> https://codeberg.org/notgull/forthstrap
<notgull>However, a) I got hired and don’t really have the capacity to keep working on it
<notgull>b) It would be painful to write an OS in Forth with even the small subset of Unix syscalls used by m2libc/meslibc
<xentrac>that's cool!
<xentrac>I think you can write an interpreter or compiler for any programming language in assembly; it's just more effort than doing it in a higher-level language
<notgull>Eh, you technically *can*
<xentrac>I'm pleased to see my StoneKnifeForth linked on that page :-)
<notgull>Practically the list of higher level languages that can be implemented in assembly are Forth, Lisp, and C
<notgull>I’d even argue against C; cc_x86 barely implements it
<notgull>My plan was to take the algorithm used in cproc, translate it to Forth, and use it to write a C-to-forth transpiler
<notgull>From there you could transpile tinycc to Forth, use that to compile a full tinycc, then go from there
<notgull>Although, I think that people focus too much on the early part of the bootstrap chain and not the autotools/perl hell that makes up
<notgull>half of the code in live-bootstrap
<xentrac>I don't think that's true. for example, siraben has been exploring my term-rewriting language Qfitzah, seems to have gotten it to bootstrap a C compiler: https://github.com/siraben/qfitzah/tree/mes-bootstrap
<notgull>Oh, neat
<notgull>Although it’s very much cheating, scheme0.qfasm is generated code
<notgull>If the nyacc thing was an issue I think this is an issue too
<xentrac>qfitzah.s is 688 source lines of i386 assembly, and it implements a dynamically-typed programming language with not just implicit memory allocation, flexible polymorphic data structures, and higher-order functions, like Lisp, but also pattern-matching like Prolog or ML, and dynamically dispatched method calls like Python or Java, with multiple dispatch like CLOS or Dylan
<xentrac>and that assembly language was, I think, written entirely by hand (certainly my original version was)
<xentrac>it's a much smaller and simpler language than Forth, Lisp, or C
<notgull>It seems to require Python to write its programs, though
<notgull>In this case you can’t bootstrap to it without Python
<xentrac>no, you can write programs in Qfitzah by hand
<xentrac>siraben's original Lisp in Qfitzah was written by hand
<notgull>Mhmm
<xentrac>scheme0.qfasm is generated by bootstrap/gen-scheme0.scm (although previous versions were indeed generated by tools/build_scheme0.py)
<xentrac>so you need some kind of Scheme inteprreter or compiler to generate scheme0.qfasm
<xentrac>siraben has taken Qfitzah a lot farther than I ever did, to the point where I'm starting to think Qfitzah might have been a good idea
<xentrac>but I'm certainly not claiming it's the be-all and end-all
<xentrac>just that implementing languages other than Forth, C, and Lisp in assembly is an eminently feasible thing to do
<notgull>Yeah it’s interesting
<notgull>A sort of pre-Lisp
<xentrac>well, core Lisp lacks some of Qfitzah's features; it doesn't have pattern-matching or dynamically-dispatched method calls, much less multiple dispatch
<xentrac>and my hypothesis was that those features are particularly useful for writing compilers
<xentrac>so my intent was for it to be a better language for writing compilers in than Lisp (or especially C or Forth)
<xentrac>because you could program at a higher level of abstraction and gain flexibility that a Lisp program woldn't have
<matrix_bridge><Jeremiah Orians> Saw that; wished that there was a link to a video of the talk
<xentrac>yeah, does FOSSY video their talks?
<xentrac>Lisp (and, I think, C and Forth) predate the unification algorithm used for pattern-matching by Prolog (and Qfitzah), and in particular they greatly predate the Warren Abstract Machine and generational garbage collectors which made unification reasonably efficient (which Qfitzah doesn't use)
<xentrac>all of Lisp, C, and Forth embody a lot of concessions to running on what we would now consider very small, slow machines, concessions we can avoid if we're bootstrapping on a big, fast computer