Right now, all of the procedure arguments are directly pushed to the real stack which later requires it to be moved to a let variable which slows down the program a lot. To solve this, argument storing can be implemented.
Possible syntax:
proc procedure
int as let arg1 // This is stored to the local memory, and can be accessed like it is a 'let' variable. Immutable.
int as memory arg2 // This is also stored to the local memory, but it is accessed like it is a 'memory' variable. Mutable.
int // This is pushed directly to the real stack.
in
// Real stack now contains only 1 item, and there are two local variables defined named 'arg1' and 'arg2'.
// 'arg1' will return a value, 'arg2' will return the address of the value.
...
end
This may also help make procedure declaration statements clearer as we normally had to write the name and types of the arguments twice for clarity. Normally, writing a procedure that acts like this one would be like:
proc procedure
// int: arg1 int: arg2 int: arg3
int int int --
in
memory arg2 sizeof(int) in
swp arg2 !64
// 'arg2' is now stored as a 'memory' argument.
swp let arg1 in
// 'arg1' is now stored as a 'let' variable.
...
end
end
end
Right now, all of the procedure arguments are directly pushed to the real stack which later requires it to be moved to a
let
variable which slows down the program a lot. To solve this, argument storing can be implemented.Possible syntax:
This may also help make procedure declaration statements clearer as we normally had to write the name and types of the arguments twice for clarity. Normally, writing a procedure that acts like this one would be like: