no valueFunctions
This commit is contained in:
parent
580af874c1
commit
f1367b64ef
6
bin/repl
6
bin/repl
|
|
@ -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[] = []
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user