Thursday, December 20, 2018

Consuming an expression from the shunt:

int binop(Val op,PStack stk) {
Val r;  // Uinion of just about everything long
r.l = pull(stk);
if(!r.l) return(ERROR);
if(r.s[0] == ';')  return(SUCCESS);
if(ispunct(r.s[0])) {
binop(r,stk);
return(SUCCESS);
}
r.l = ValToken(r.s);
if(op.s[0] == '*' ) DefaultBase.Accum *= r.l;
else if(op.s[0] == '/') DefaultBase.Accum /= r.l;
else if(op.s[0] == '+') DefaultBase.Accum += r.l;
else if(op.s[0] == '-') DefaultBase.Accum -= r.l;
else syntax_tags_error("Operator unknown\n",op.s);
return(SUCCESS);
}

You get four operations, version me, someone else can improve that.

I pop the opcodes right off a stack, but the set up has already mapped a stack to the args list. Args list mapping is an amazing way for modules to communicate.

 The complete Default expression, is a linux command, linux command, in procedural string) is:

Default while(1+a){}

That linux command, executed at the console, will compute the expression. My source code for Default is intercepted, and transformed into a set of linux commands that execute of over the Bus as    void*args[], in standard main (*int argc, char* argv[]) form, except the int is a pointer, each subsystem is part of the 'microprocessor, and must bump the  'program counter'.

With the machine up, running actually, through the loops, incorrectly; but it is a big deal. It is the fist iteration in finally, getting the enterprise under common semantics. The enterprise knows that, no matter what, their is a simple tool that can load modules having a  standard interface.

No comments: