Monday, December 17, 2018

Macro invokation

Macros getdefine right on ars list, went over that?
name arg1 arg2...

Standard liinux format, no problem, the efault syntax, wen enabled, will  searched via its entry point. In he search, it checks he command name against the symbol table. Do default and console loop are extremely integrated, everything is simple, all the same word list, and most of that pointing back into source code. Reading a file is loading persistent objects util another file is read. Nothing new, just all adapted to the Bus wiih a few lines of code.

The integrations is reusable by other syntax engines.  Not yet, but soon the token table can be reloaded for both shunt and tokenizer. So any syntax can at least get its tokens via console loop. The net cost of Default, over the other functions, is about 450 lines of code. Shunt needs a tag table anyhow, and all hte Default executable recycle through the standard command search sequence. The language built to reuse he Bus architecture. Here, it is expanding a macro.  If the name is in th symbols table,  then arg is replace with a new ponter into args and execute the universal entry function. Simple because my executable format is the command line itself. In name scoping, this list is the last one called, so use unique names. Notice, no error checking. Defining a macro is simple, a look at the code reveals.

int DefaultMacros(int*argc,void *args[]) {
PSym s= GetName(args[*argc]);
int base; 
if(s) {   // If this is an expansion, just restart
*argc= args[*argc+1];
base = *argc;
Entry(arcg,args);
*argc = base + 1;
return(SUCCESS);
}
return(NOTFOUND);
}


The package runs, and works as usual but Default, itself, mostly gives syntax errors at the moment.Easy stuff to fix since it no longer crashes and one can get to the error right away.

Loading modues as threads

Make it an option later. Makes sense t have threaded modules as a general option. Especially since the args list is the shared medium, hanging mutexesor interlocking messages is a breeze.

No comments: