matanuska

A chill BASIC to shell to 💃

MPL-2.0 License

Stars
0

Matanuska BASIC

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.

Install

There currently aren't any installable packages for Matanuska. If you would like to try it today, follow the instructions for development.

Development

Matanuska BASIC uses npm for all of its tasks. Refer to package.json for details.

ADRs

Architectural decisions are documented in ./adrs. Notes on future decisions I haven't made yet are in ./adrs/draft.

Current Status and Next Steps

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.

Prioritized Backlog

  • for/while/goto
    • ADR for for/while/goto
  • Logical operators
    • Support through the parser
  • Complete Print syntax
    • Print can take multiple arguments
    • Print can also 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
    • 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 and SET PS2?
    • also HISTSIZE and HISTFILESIZE
  • Type-checking compiler
    • Implement type analogues to operations
    • Simulated stack in the compiler

Up Next

  • citree vite/rollup plugin
  • 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
  • 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 and assert 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 and cont commands to control break-in behavior
    • Will need to intercept and handle ctrl-c from readline (ctrl-stop in
      MSX BASIC)
  • Symbol dump
  • Profiling
    • Line-based for users
    • Opcode-based for me
  • Performance tests
    • Benchmarks
    • Profile slow benchmarks
  • Editor plugins
  • Generated "exceedingly large" script tests

The Future

  • String templates
  • Module system
  • Package manager
  • Partial rewrite in Rust and/or C/C++
  • Implement entry point in Rust or C/C++
  • Rollup "release build"?
  • 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

Resources