diff --git a/bootstrap/ISBPL.java b/bootstrap/ISBPL.java index dfc3dfa..5282c5b 100644 --- a/bootstrap/ISBPL.java +++ b/bootstrap/ISBPL.java @@ -15,6 +15,10 @@ import java.util.function.Supplier; */ public class ISBPL { + // TODO: fully implement JIO + // public static final boolean ENABLE_JINTEROP = true; + + static boolean debug = false; public ISBPLDebugger.IPC debuggerIPC = new ISBPLDebugger.IPC(); ArrayList types = new ArrayList<>(); @@ -846,6 +850,15 @@ public class ISBPL { } }; break; + case "def": + func = (stack) -> { + ISBPLObject str = stack.pop(); + ISBPLObject callable = stack.pop(); + String s = toJavaString(str); + callable.checkType(getType("func")); + addFunction(s, (ISBPLCallable) callable.object); + }; + break; default: func = natives.get(name); break; diff --git a/std.isbpl b/std.isbpl index ecf04e2..fc94e3d 100644 --- a/std.isbpl +++ b/std.isbpl @@ -64,6 +64,7 @@ native % native ^ native fcall +native def func ++ { 1 + } func -- { 1 - }