no valueFunctions

This commit is contained in:
Chris Wanstrath 2025-10-26 12:29:06 -07:00 committed by Chris Wanstrath
parent 59fe509889
commit c8362e106d
2 changed files with 5 additions and 5 deletions

View File

@ -1,7 +1,7 @@
#!/usr/bin/env bun
import { Compiler } from '../src/compiler/compiler'
import { colors, formatValue, nativeFunctions, valueFunctions } from '../src/prelude'
import { colors, formatValue, nativeFunctions } from '../src/prelude'
import { VM, Scope, bytecodeToString } from 'reefvm'
import * as readline from 'readline'
import { readFileSync, writeFileSync } from 'fs'
@ -48,7 +48,7 @@ async function repl() {
return
}
vm ||= new VM({ instructions: [], constants: [] }, nativeFunctions, valueFunctions)
vm ||= new VM({ instructions: [], constants: [] }, nativeFunctions)
if (['/exit', 'exit', '/quit', 'quit'].includes(trimmed)) {
console.log(`\n${colors.yellow}Goodbye!${colors.reset}`)
@ -211,7 +211,7 @@ async function loadFile(filePath: string): Promise<{ vm: VM; codeHistory: string
console.log(`${colors.dim}Loading ${basename(filePath)}...${colors.reset}`)
const vm = new VM({ instructions: [], constants: [] }, nativeFunctions, valueFunctions)
const vm = new VM({ instructions: [], constants: [] }, nativeFunctions)
await vm.run()
const codeHistory: string[] = []

View File

@ -1,7 +1,7 @@
#!/usr/bin/env bun
import { Compiler } from '../src/compiler/compiler'
import { colors, nativeFunctions, valueFunctions } from '../src/prelude'
import { colors, nativeFunctions } from '../src/prelude'
import { VM, fromValue, bytecodeToString } from 'reefvm'
import { readFileSync, writeFileSync, mkdirSync } from 'fs'
import { randomUUID } from "crypto"
@ -12,7 +12,7 @@ async function runFile(filePath: string) {
try {
const code = readFileSync(filePath, 'utf-8')
const compiler = new Compiler(code)
const vm = new VM(compiler.bytecode, nativeFunctions, valueFunctions)
const vm = new VM(compiler.bytecode, nativeFunctions)
await vm.run()
return vm.stack.length ? fromValue(vm.stack[vm.stack.length - 1]) : null
} catch (error: any) {