I managed to get some coding in today, maybe that’s why I’m feeling a bit better. On the down side though, my cable connection seems to be running half as fast as normal lately, games were nearly unplayable for much of this afternoon for some reason.
I think my shells codegen branch has lived to the virtual extent of it’s usefulness. Today I sorted a few minor things and enabled nested control flow for statements using the ‘then’ and ‘do’ keywords, e.g. control flow statements can contain control flow statements as well as commands within their block. There are still a few kinks to iron out but the most important are done; I’m currently uncertain if the remaining problem lays in the code generation phase or somewhere further up the processing chain, but I expect it lays in generating the perl code.
Basic conditional flow and looping is ready, which was the primary purpose of this branch of development: to explore implementing the shells scripting language by dynamically generating Perl code for it, as well as replacing the static command sequence executor by generating it as well.
Oddly, the main things that need doing in the short-term are actually script related, rather then interactive. But then again, tpsh has always been meant for interactive usage first and support for batch jobs as a secondary concern. Main points of lacking at the moment, is a concept of “exit status”, in Bourne shell parlance the $? variable isn’t used for a hill of beans yet. Likewise all $variable expansion is done on the fly during tokenization, so:
for X in 1 2 3; do echo $X; done
The value of $x in the loop body would be expanded before the code is evaluated, resulting in the following:
for X in 1 2 3; do echo; done
because X is not defined at the time the statements are being parsed, the expansion is “”.
I haven’t decided how this will be solved yet. Solving it however, is well outside the scope of the codegen branch. I would say the only thing left to do in the branch, is implement the break num and continue num to enable a way out of the while/until loops. The former will take a bit more testing but the latter, is not likely to be to hard. Perl supports a robust way of breaking out of loops that can be easily used. Once that stuff is done, I’ll likely merge the branch into master and move on to other tasks.
Since I’ve been stuck working more often on the NT machine, development of tpsh gets a slightly higher priority lol.