Start reimplementation in typescript

This commit is contained in:
2025-11-10 23:54:20 -06:00
parent 569bff2d3e
commit 144d90e871
30 changed files with 1347 additions and 0 deletions

21
src/index.ts Normal file
View File

@@ -0,0 +1,21 @@
import {log} from './log.js'
import {Lifecycle} from './util/lifecycle.js'
import {Input} from './vm/input.js'
import {Lexer} from "./vm/lexer.js";
import {Parser} from "./vm/parser.js";
import {commands} from "./vm/commands/index.js";
const lifecycle = new Lifecycle()
const input = new Input()
input.adoptLifecycle(lifecycle)
input.subscribe(line => log.verbose('input', { line }))
const lexer = new Lexer(input)
lexer.subscribe(token => log.verbose('token', token))
const parser = new Parser(lexer, commands)
parser.subscribe(exec => log.verbose('exec', exec))
input.setupPrompt()
process.on('SIGINT', () => lifecycle.close())