ckrause / loda

LODA is an assembly language, a computational model and a tool for mining integer sequence programs.
Apache License 2.0
20 stars 5 forks source link

Use `$0` for output register #139

Closed neoneye closed 3 years ago

neoneye commented 3 years ago

Currently $1 is the output register.

It will affect all programs.

Multiple outputs: What if someday a second output value is to be returned (rational number, complex number, coordinates). Should it then be placed in $2. Or some other day, what if 3 output values are to be returned (3d vector).

Multiple inputs: It would be nice with programs that takes multiple inputs such as bitwise operators. So if the input goes into $0, $1. Then it it's awkward that the output is in the $1 register.

I think $0 for output, is consistent and future proof.

ckrause commented 3 years ago

I already made some preparations a while ago to make this configurable, but there are still some issues in the miner. I'm not fully sure if we should change it. We will need to inject a mov $0,$1 at the end of all programs.

neoneye commented 3 years ago

Indeed, impacts all programs.

ckrause commented 3 years ago

done