mirror of
https://gitlab.cs.washington.edu/fidelp/frustration.git
synced 2024-12-25 21:58:11 +01:00
call
This commit is contained in:
parent
4a718a7cee
commit
b7c07685c3
1 changed files with 8 additions and 2 deletions
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue