This commit is contained in:
Peter Fidelman 2022-03-26 15:05:00 -07:00
parent 4a718a7cee
commit b7c07685c3

View file

@ -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: 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 {