Expr, Macro and While
Expr args .... // This command will calculate the reverse polish operand and op aeg list
Example: Expr + 1 4; // Places the value five in the arglist
Macro args ... // This is run time code, already compiles and is executed immediatel
Then I have one compound linux command:
While Expr args ... Macro args ...; // while Expr do Maro
Expressions know about simple variables, but cannot have macros inside. A macro is like a lmited function call that cannot appear in an Expr, yet. Maybe later. But that is how we get simple variable and macros. The macros are defined in the syntax implicitly within the while loop. I will likely make a macro key word for explicit definition, or go full frontal with the function call, dunno yet.
Shunt is not a Default method, but a general purpose reshuffler. It is not unloaded when Default is unloaded. The console loop exposes three for file input, load and unload modules. Thus, all the 750 lines of code do is generate 6 new linux system commands, all the rest is due to the commonality of the linux command format making it possible for system utilities to be loaded inside the script, not outside.
Here they are. They execute and define chunks of args.
int Default(int * argc, void * args[]); // loads Default syntax
int Assign(int *argc,void *args[]); // assign arg 0 as value of arg 1,
int While(int * argc,void * args[]); // Compound While Expr Macro
int Expr(int * argc,void * args[]); // Compute RPN formatted args list
int Macro(int *argc,void *args[]); // A list and count of args
There is also Shunt, but that is not special to Default. It is a Console utility.
Like Python or Forth, once you type Default you stay in the syntax. You can type linux commands, if they are not syntax, if you avoid key terms.
Default
a=5
while(a--) NewString "hello mom" 2 a;
bye
This should work, draw a series of string using XChars, assuming it is loaded. Then it returns you to no syntax mode, assembly language on the command line. What happens in the default case when no loaded subsystems responds to a linux command? That means console search linux itself for an unloaded copy and console will pipe to it. Undefined syntax looks like typing into the current linux command boxes, no syntax, just take do an excl with pipes. Bye exits the syntax engine. This is a shell, still.
Macros:
macro() { add somestuff}
Currently the parenth pair must be empty, no function calls with arguments. It is expanded with:
macro()
Making the function() form work brings us to 800 lines of code. The rule is that it should first appear in its definition with brackets, no arguments, then is executed from then on. Simple semantic.
No comments:
Post a Comment