Right had my morning coffee.
MSPB, that’s super useful. It’s one of those calculations that’s a pain to do in your head. It would also be really useful with DEL and TR.TIME.
It’ll also be a really good OP to start with, as it’s a pure function. I’d add it to ops/maths.c. There are instructions on adding a new OP in the readme, let me know if you run into any problems, and I can use that info to improve the docs. Don’t forget to run the tests as there as some that check to see if all the values have been filled in properly.
If you can also add some docs for MSPB that would also be amazing, but if it’s too much to take in all at once that’s okay too. (Especially if you want to generate the PDFs, as you’ll need Latex/TexLive.)
(What Linux are you on?)
Remember there are symbolic options:
IF ! A: ...
IF > A 0: ...
I’m not so sure about these, I don’t think I would use them. Especially if the variable is hard coded. I’d be more keen on something that took a variable as input. Maybe we should also use a symbol? So:
?0 X: # if X is zero
?>0 X: # if X is greater than 0
?== X Y: # if X == Y
etc, etc
(I’m not sure I even like that)
Anyway, I’ll let others chip in, if they think they’ll find them useful.
As a slight aside, I’m in the process of adding a ternary OP (TER, with alias ?), along with some inline array and scale generation OPs:
See here for a description of the ternary OP:
+1 on STOP. I’d consider using a different name though, as STOP maybe be useful in other contexts (e.g. with PLAY). How about BREAK with HCF as an alias for the nerds amongst us (i.e. me).
I would add an extra field to exec_state_t:
typedef struct {
bool if_else_condition;
uint8_t exec_depth;
bool is_exiting; // or whatever you feel is best
} exec_state_t;
Then you need to figure out the best place to bail out. Possibly you’ll need to do the check in multiple places.
This OP feels like it needs a few tests added too. E.g. how it interacts with MODs and sub commands. And to also make sure that any future additions continue to play nicely with it.