Skip to content

Commit 97fd59c

Browse files
committed
expose ability to define intrinsics
1 parent 37aa1ac commit 97fd59c

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/interpreter/interpreter.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { Parser } from "../parser/parser";
55
import { Statement } from "../parser/parserModel";
66
import { Code } from "../vm/code";
77
import { Context } from "../vm/context";
8+
import { HashMap } from "../vm/hashmap";
89
import { Processor, TxtCallback } from "../vm/processor";
910

1011
export type DebuggerCallbacks = {
@@ -53,6 +54,14 @@ export class Interpreter {
5354
return this.vm.globalContext;
5455
}
5556

57+
addIntrinsic(signature: string, implFn: Function): void {
58+
this.vm.addIntrinsic(signature, implFn);
59+
}
60+
61+
addMapIntrinsic(map: HashMap, signature: string, implFn: Function): void {
62+
this.vm.addMapIntrinsic(map, signature, implFn);
63+
}
64+
5665
debugSrcCode(srcCode: string, callbacks: DebuggerCallbacks): Debugger | null {
5766
const code = this.compileSrcCode(srcCode);
5867
if (code) {

0 commit comments

Comments
 (0)