T3chnique is an experimental, work-in-progress, attempt to implement a TADS3 virtual machine in clojure. Right now this is just an occasional, spare time, iterative sketching out of an implementation.
As yet this lacks a coherent approach to several major aspects of the VM (notably: metaclass inheritance, unified exception / error handling, recursive calls into the VM, implementation sharing between constant strings and lists and their dynamic counterparts). In some cases this is following the OO reference implementation way too closely to be idiomatic Clojure. In particular, the metaclass approach will need a shake up once I fully understand what TADS3 is trying to achieve with some of it.
t3chnique uses a broadly monadic approach to the virtual machine state, though parking / yield semantics in intrinsic functions is likely to be handled via core.async rather than the continuation monad.
If it were ever finished, it would doubtless perform extremely poorly.
And it’s unlikely to ever be finished; the TADS3 virtual machine is a monster. Not so much in the VM itself but in the bundled platform - it has its own regex engine, random number generators, data structures and so on. All of these are significant obstacles to alternative implementations. This implementation is primarily for my own interest and investigation.
This source tree contains items for testing purposes which are copyright Michael J Roberts and Eric Eve. (Anything .t3)
Github projects for reference:
- QTads contains most of the C++ reference implementation (apart from tests) and is useful for reference.
- ZMPP2 contains another unfinished TADS3 implementation (in Scala).
- primitives.clj and monad.clj provide the lowest level utilities
- parse.clj is building blocks for parsing image files and byte-code instructions
- metaclass.clj and bif.clj provide some wiring and protocols to make metaclasses and intrinsic function sets available to the VM
- vm.clj contains the representation of VM state and the primary means of manipulating it (i.e. computing new states - as this is pure functional)
- implementations of metaclasses and intrinsic function sets (of which there is basically nothing at the moment) are under metaclass and instrinsic respectively
- all.clj, loads all of the intrinsics and metaclasses up.
- a rough REST interface (server.clj) and CLI tooling (main.clj)
There’s a very crude and buggy visualisation of the VM available using pages served up by server.clj and the vm.js javascript functionality. This allows stepping instruction by instruction through the VM.) I have a better (ClojureScript) WebSockets-based UI in progress in a separate project…
- TADS3 Technical Manual
- TADS3 System Manual
- TADS Home Page
- Reference MWR Implementation Source Code Download - contains test .t source for the .t3 files included in this source tree
Copyright © 2014 Greg Hawkins
Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.