diff --git a/frustration.rs b/frustration.rs index c7153cd..95c3c08 100644 --- a/frustration.rs +++ b/frustration.rs @@ -51,9 +51,10 @@ struct TableEntry { } // NOTE: lazy_static or SyncLazy would allow nicer init -const PRIMITIVES: [TableEntry; 12] = [ +const PRIMITIVES: [TableEntry; 13] = [ TableEntry {f: ret , name: ShortName {bytes: *b"ret", length: 3}, dict: false, immediate: false}, - TableEntry {f: lit , name: ShortName {bytes: *b"lit", length: 3}, dict: false, immediate: false}, + TableEntry {f: lit , name: ShortName {bytes: *b"lit", length: 3}, dict: false, immediate: false}, + TableEntry {f: call , name: ShortName {bytes: *b"cal", length: 4}, dict: true, immediate: false}, TableEntry {f: dot , name: ShortName {bytes: *b". ", length: 1}, dict: true, immediate: false}, TableEntry {f: comma_ , name: ShortName {bytes: *b", ", length: 1}, dict: true, immediate: false}, TableEntry {f: store , name: ShortName {bytes: *b"! ", length: 1}, dict: true, immediate: false}, @@ -180,6 +181,11 @@ fn from_r(c: &mut Core) -> u16 { return c.rstack[c.trs]; } +fn call(c: &mut Core) { + to_r(c, c.ip); + c.ip = pop(c); +} + // note: this is an inline primitive, not a dict entry fn ret(c: &mut Core) { if c.trs == 0 {