Friday, December 21, 2018

Macro expansion of linux arguments

Went over this, Default does not know linux arguments, they pass through, it only expands on the linux command word, which is what ExecCommand is about.

Compile() {
gcc -c test.c;
}
.
.
# Then call it:
Compile     # executes the call.

But the arguments remain untouched.  ExecCommand can expand the arguments if configured, so that means a configuration call for console loop.  We give Console loop an expansion operator, or none for Default expansion. Then we get:

Compile() {
gcc str test.c;
}
.
.
str ="-c";
Compile     # Exec must be in expand args mode.

Argument expansion is a console lop operation as the entire system is about the command word, how to search and execute. The command word causes a fundamental search, outside of any syntax. So the partiuclar syntax engine needs to set a console control byte on start up.

Simple arrays in Default:

str1="word1"
str2="word2";
str3="word3";

Array() { str1; str2; str3;}

Array = Array+1;
Array  # produce the second str on exec

It works by accident, no type checking an the parser will identify the expression first and the macro expansion second, they each execute properly.  Many things do not work, some things seem funny but work. This because there is no type checking, at all, at the Default layer, the Default action if something fails is to report syntax error. If a symbol value is undefined, Val tok defines it and gives it a zero. If something needs finding, it can be stuffed in the symbol table, and you get name conflicts if not careful.  Default is not likely to expand in capability because much better c syntax interpreters are available. Default remains the boot syntax, good for some command line interaction, good for getting environment installed, good for simple batch jobs. The one goes for the power of Python.

All syntax engines should be prepared to configure console loop tokenizer with a marker list and console loop for argument expansion.




No comments: