Tuesday, November 27, 2018

Consolidating scripting in linux

I have noticed something about the general format of command switches:
gcc -o out x.c -I.

OK, selected switches at random, but in gcc ordering is important, and some switches modify the function of previous switches.  The switches are presumed to be process left  to right. Command line switches in linux are a sort of scripting language, informally defined.

But, command shell, bash, has scripting:

while [n] 
do 
gcc -o %n.c
((n--))
done

Or something like this, I never wrote a while loop in bash until just now.

For a complete macro shell, I see no reason the two scripts cannot be intermixed into a single grammar allowing:

gcc -o while[n] do %n.c ((n--)) done

Which is different from the one above.  This one compiles the whole set of arguments all at once. But it demonstrates the basic idea.

Further.  Arguments can be delivered as an array of string pointers, a perfect instruction format for scripting languages.  This allows the macro pre-processor to expand macros along the way, my shell does this. The steps then become:

Text strings convert line by line or ; separated into an array of null terminated strings..  The string pre-processed on the fly, expanding macros and generating the array of argument pointers.  But we can add argument switches such as:

command %1 where %1 expands into args[1], the first argument in the argument list.  Thus command sequences can carry over arguments, and modify them. Also we have some variable control for output arguments, command sending results back to requester.

All the commands may be idiosyncratic, having nothing to do with each other, but they share a generic grammar regarding the argument list.  Thus the whole script grammar is lifted up, above the actual command function.

Anyway, this issue came up in trying out the simple macro shell I wrote, a lab version really.    But in the join system, I have a stack of join instances, pending on a stack.  I need array and loop functioning within the command arguments, especially when referring to cursors, there are lots of those.  I need to do a bit of iteration, not much more than bash, but inside the argument list, within a single command.  Then maybe reset the counter and repeat with another command.

The consolidated grammar would fall back to normal bash if it is not used. This consolidation adds nothing, really, it just takes advantage of the similarity of argument lists and bash macro sequences.

Regarding the AI model:

In my AI model, the bots are really this scripting layer, which could also be python.  But that script operates a massively parallel system. Whether a trading bot, a search graph, or text readers, the bot will be spawning script and other subsets of the problem, as they are all construed to be directed graphs and segments thus parceled out freely.  My entire enterprise text reader will be written in this scripting variant, it will just condition the source text via a series of intersections with word lists from the word smiths. Hundreds of differing word lists matched against the daily web new. A problem not much more complex then make, it just executes more iterations. Make sits on top of powerful compilers, reader bots sit on top of powerful join machines. Like gcc is multi-lingual, the join bots have access to tens of different grammars on op,key pairs.  BerkelyDB is the natural database structure and needs to be installed as a grammar atachment.

I do not see the architecture changing much for S&L operations, nor do I see any conflicts with the spectre standard.  Join is something we might want a co-processor to do. I think the key is plain structured text, and bots have dictionaries to deal with special join set up and control.

No comments: