Matanuska is a BASIC dialect designed for use as a shell. It asks what it would've been like if the classic 80s BASIC was better able to rise to the occasion when it came to disk features and/or competing with DOS.
Matanuska is still in development, and needs a lot of work before it's ready for regular use.
There currently aren't any installable packages for Matanuska. If you would like to try it today, follow the instructions for development.
Matanuska BASIC uses npm
for all of its tasks. Refer to package.json
for details.
Architectural decisions are documented in ./adrs. Notes on future decisions I haven't made yet are in ./adrs/draft.
The interpreter can run "hello world" in a REPL and evaluate simple expressions. Now is time to add some basic features and button up a few gaps.
- tokei for stats
- for/while/goto
- ADR for for/while/goto
- Logical operators
- Support through the parser
- Complete Print/Format syntax
- Support ECMA-55?
- Complete ADR
- Print can take a channel config
- Expanded list
list 10
list 10-20
- Functions
- ADR for functions (and maybe subroutines?)
- Local variables
- Closures
- Native functions
- Path navigation - cd, ls, etc
cd
is a builtin ("native function")ls
and others are on the PATH, actually
- Date/Time/Duration/TZData types
- Core library
- Host support
- (Language support can come later)
- Shell commands
- Will need to research jobs in Bash
- Investigate alt-shells
- Scanner and parser support for shell commands and "shell tokens"
- Compiler support for shell commands
- Host support for shell commands
- Runtime support for shell commands
- Support \j in prompt rendering
- (Pipes will come later)
- Shell variable export
- PS1/PS2 support
SET PS1
andSET PS2
?- also
HISTSIZE
andHISTFILESIZE
- Type-checking compiler
- Implement type analogues to operations
- Simulated stack in the compiler
- Add
tflint
andterraform validate
- Add trace events to parser and compiler
- Swap out
pino
for a different logger in grabthar- its async behavior means logs are in the wrong order
- Telemetry improvements/fixes
- Audit/document OTEL related environment variables
- read-eval-print appears to fire "twice"
- No special requirements for root spans, as far as I can tell
- No traces when running script
- Appears that shutdown doesn't flush all traces
- Calling forceFlush on everything doesn't seem to do the trick
- May need to set tracer provider timeouts to 0 - see https://github.com/jfhbrook/matanuska/blob/a325e0a045aac030222304aa621934c3727a3178/telemetry.ts
- Custom otel diagnostic logger
- Note: The SDK will automatically incorporate a
DiagConsoleLogger
if you setOTEL_LOG_LEVEL
: https://github.com/open-telemetry/opentelemetry-js/blob/887ff1cd6e3f795f703e40a9fbe89b3cba7e88c3/experimental/packages/opentelemetry-sdk-node/src/sdk.ts#L127-L133 - Also consider a
ConsoleSpanExporter
- They recommend "info" as a "default" - debug is too chatty
- Note: The SDK will automatically incorporate a
- Split matanuska into modules
- runtime/stack/etc
- bytecode
- compiler
- parser/scanner
- errors (exceptions/faults)
- constants
- type stubs
- vite configuration
- precompiler
MATBAS_BUILD
constant- jscc vite configuration
- values + operations
- host
- shell
- commands
- Get
npm run console
working again- ts-node seems to depend on a commonjs build
- Setting
"type": "module"
in the package.json breaks commonjs completely nodenext
module resolution requires that imports end in the file extension, but vite/swc have no such requirement, and it's a bitter pill to swallow- ts-node completely depends on tsc to do builds - making it use swc doesn't seem possible
- grabthar improvements
- swc cli build option
- automatically update package.json
- lint-staged and husky support
grabthar clean
- Use envinfo in runtime fault output
- Assert module
- Wrap 'node:assert'
- Throw RuntimeFault
- Investigate Node.js inspector
- Escaped newlines
- Arrays
- Including array literals - BASIC assigns each index one at a time, or uses the
data
command - Consider using eigen
- Including array literals - BASIC assigns each index one at a time, or uses the
- Implement Acey Ducey
center$(n)
rnd!
(random) function- If/then/goto
- functions
- no-arguments print
end
command
- Hashes
- Date/time language support
- Exception language support
- Test harness
test
andassert
commands- Runtime "test mode" and entrypoint subcommand
- Reporter, possibly based off node-tap
- File I/O
- Research garbage collection
- TypeScript is obviously garbage collected
- But the architecture may hang onto references I don't want
- Tab-complete support in the REPL
- Starship support
- Stream/pipe support
- Break-in
- MSX BASIC uses the
stop
andcont
commands to control break-in behavior - Will need to intercept and handle ctrl-c from readline (ctrl-stop in MSX BASIC)
- MSX BASIC uses the
- Symbol dump
- Profiling
- Line-based for users
- Opcode-based for me
- Performance tests
- Benchmarks
- Profile slow benchmarks
- Editor plugins
- Generated "exceedingly large" script tests
- Reimplement citree in Rust and chumsky
- String templates
- Module system
- Package manager
- Partial rewrite in Rust and/or C/C++
- Implement entry point in Rust or C/C++
- Port to bun?
- Nice FFI
- Support for bundled executable
- Object support
- Vector/matrix support for 1D/2D integer/float arrays
- Assembler mini-language
- Stack trace tests robust against different node versions
- Architecture Diagram on Google Drawings
- Crafting Interpreters by Robert Nystrom
Writing Interactive Compilers and Interpreters
by PJ BrownModern MSX BASIC Game Development
by Raul Portales- List of Java bytecode instructions
- Z80 Instruction Set (Complete)
- OpenJDK Architecture
- cpython internals
- MSX2 Technical Handbook
- MSX-BASIC Instructions - MSX Wiki
- An Introduction to Programming BBC BASIC
- BBC BASIC Reference Manual
- GW-BASIC User's Guide
- BASIC Computer Games Microcomputer Edition
- Fantasy BASIC Consoles
- Atto
- BASIC8 Manual
- MEG-4 Manual
- ECMA-55 Standard