LMH01 / alpha_tui

My attempt to write a runtime environment and debugger for the Alpha-Notation used in my SysInf lecture.
GNU General Public License v3.0
15 stars 1 forks source link

Accumulators and Memory cells should be created on demand in playground mode #43

Closed LMH01 closed 6 months ago

LMH01 commented 6 months ago

Currently a runtime error occurs when a value is assigned to an accumulator or a memory cell that does not exist in the playground mode. Instead of the runtime error, the accumulator or memory cell should be created on demand, before the value is assigned. This should only be the case in the playground mode (maybe the whole behavior should be disableable using a cli argument).

To implement it, I think I could utalize the Settings struct in the RuntimeArgs struct, to add a new field that stores if memory cells/ accumulators should be created on demand. This could then also be used in the normal load mode, when enabled via command line argument.

Maybe the cli argument to enable that in the load mode could be something like --memory-on-demand. This should probably not conflict with any other parameters, as this would allow for all fields to be empty, when the program starts and that required fields are then only created if needed.

For the playground mode, disabling this automatic creation when needed, the argument could be --no-memory-on-demand.

The runtime settings are then set, according to the command issued and the parameters provided.

LMH01 commented 6 months ago

I decided against adding command line arguments, instead the accumulator/memory cells are now automatically created when required, except for when --disable-memory-detecion is set.

Implemented.