You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Today every demo in `examples/dN_*.bas` is hand-assembled bytecode:
the driver POKEs bytecodes into scratch RAM, then `GOSUB 12000`
dispatches them through the VM. This costs ~30-60 lines of fragile
BASIC per demo and means new demos spend more time on loader
plumbing than on the logic they're trying to show.
A Smalltalk-source compiler — parser + codegen producing the same 14
Tinytalk bytecodes — would let future demos be `.st` files. Concretely:
`examples/fibonacci.st` instead of `examples/d8_fibonacci.bas`.
Replace per-demo `image_dN.bas` POKE / DATA tables with the
compiler's output: class table + method dictionaries + bytecode
pool in a single image format the VM loads.
CLI: `stc examples/foo.st > image/foo.bin` or similar.
Where to host
In Smalltalk — dogfooded; v1+v2 unlock enough to self-host.
Bootstrap by hand-assembling the compiler once, then it
self-hosts.
In Pascal or Rust — pragmatic for the v0..v2 era; ship
`tools/stc.pas` (or in `pa24r` style, a Rust crate) that
produces an image at CLI time.
(2) ships sooner and unblocks demos; (1) is the philosophically
correct end state.
Higher-tier demos (`eliza-lite`, `mud-room`, `caesar-cipher`,
`roman-numerals`, `test-runner`) can be written in real
Smalltalk syntax once v1 strings + this compiler exist.
D5 calc could grow into a real source-driven REPL: user types
Smalltalk, compiler emits bytecode, VM runs it.
Today every demo in `examples/dN_*.bas` is hand-assembled bytecode:
the driver POKEs bytecodes into scratch RAM, then `GOSUB 12000`
dispatches them through the VM. This costs ~30-60 lines of fragile
BASIC per demo and means new demos spend more time on loader
plumbing than on the logic they're trying to show.
A Smalltalk-source compiler — parser + codegen producing the same 14
Tinytalk bytecodes — would let future demos be `.st` files. Concretely:
`examples/fibonacci.st` instead of `examples/d8_fibonacci.bas`.
Scope
Lexer / parser
binary selector (`+ - * / < > = , ;` etc.), block delimiters
`[ ]`, statement terminator `.`.
keyword messages with standard Smalltalk precedence
(unary > binary > keyword).
class X with instance variables A B C and methods M N P.
Codegen
per-method symbol table.
Image build
compiler's output: class table + method dictionaries + bytecode
pool in a single image format the VM loads.
Where to host
Bootstrap by hand-assembling the compiler once, then it
self-hosts.
`tools/stc.pas` (or in `pa24r` style, a Rust crate) that
produces an image at CLI time.
(2) ships sooner and unblocks demos; (1) is the philosophically
correct end state.
Demos this unlocks
`roman-numerals`, `test-runner`) can be written in real
Smalltalk syntax once v1 strings + this compiler exist.
Smalltalk, compiler emits bytecode, VM runs it.
Web demo
`web-sw-cor24-smalltalk`
would either:
build time from `.st` sources via the compiler, or
user-typed Smalltalk to bytecode — a real REPL.
The latter is the killer-app version of the live demo.
Related: dialect roadmap (#2), v1 strings (#4).