Diff
Not logged in

Differences From Artifact [57b0a5dd9a9946f6]:

To Artifact [aeb12eeaab91afb4]:


76 76 // @macro run!!! 77 77 if( lay == MacroLayer ) 78 78 return macroEval(ast.funbody, ctx, false); 79 79 /*TODO memo*/ AST macroMemo; 80 80 if( macroMemo is null ) { 81 81 // .prototype!, forced macro cannot access parameters 82 82 ctx.kill = true; scope(exit)ctx.kill=false; 83 - macroMemo = tableToAST(ValueLayer,macroEval(ast.funbody, ctx, true)); 83 + auto tbl = macroEval(ast.funbody, ctx, true); 84 + macroMemo = tableToAST(ValueLayer,tbl); 84 85 } 85 86 auto v = eval(macroMemo, ctx, true, lay); 86 87 87 88 //auto v = eval(e.funbody, ctxNeo, true, lay); 88 89 // auto memoization 89 90 // if( lay != ValueLayer && lay != MacroLayer ) 90 91 // memo[lay][args] = v; ................................................................................ 340 341 case "var": 341 342 if(auto v = t.access!StrValue(theLayer, "name")) 342 343 return new VarExpression(pos, v.data); 343 344 throw genex!RuntimeException(cast(LexPosition)null, `Invalid AST {is:"var", name:(not string)}`); 344 345 case "lay": 345 346 if(auto v = t.access!StrValue(theLayer, "layer")) 346 347 if(auto e = t.access!Table(theLayer, "expr")) 347 - return new LayeredExpression(pos, v.data, tableToAST(theLayer,e)); 348 + return new LayExpression(pos, v.data, tableToAST(theLayer,e)); 348 349 else 349 350 throw genex!RuntimeException(cast(LexPosition)null, `Invalid AST {is:"lay", expr:(not table)}`); 350 351 throw genex!RuntimeException(cast(LexPosition)null, `Invalid AST {is:"lay", layer:(not string)}`); 351 352 case "let": 352 353 if(auto n = t.access!StrValue(theLayer, "name")) 353 354 if(auto e = t.access!Table(theLayer, "init")) 354 355 if(auto b = t.access!Table(theLayer, "expr")) ................................................................................ 360 361 if(auto l = t.access!StrValue(theLayer, "layer")) 361 362 lay = l.data; 362 363 return new LetExpression(pos, nn, lay, ee, bb); 363 364 } 364 365 throw genex!RuntimeException(cast(LexPosition)null, `Invalid AST {is:"let", name:"???", init:"???", expr:"???"}`); 365 366 case "app": 366 367 if(auto f = t.access!Table(theLayer, "fun")) 367 - if(auto a = t.access!Table(theLayer, "arg")) 368 + if(auto a = t.access!Table(theLayer, "args")) 368 369 return new FuncallExpression(pos, tableToAST(theLayer,f), tableToASTList(theLayer,a)); 369 - throw genex!RuntimeException(cast(LexPosition)null, `Invalid AST {is:"app", fun:???, arg:???}`); 370 + throw genex!RuntimeException(cast(LexPosition)null, `Invalid AST {is:"app", fun:???, args:???}`); 370 371 case "fun": 371 - if(auto p = t.access!Table(theLayer, "param")) 372 - if(auto b = t.access!Table(theLayer, "body")) 372 + if(auto p = t.access!Table(theLayer, "params")) 373 + if(auto b = t.access!Table(theLayer, "funbody")) 373 374 { 374 375 Parameter[] ps; 375 376 foreach(v; tableAsConsList(theLayer, p)) 376 377 { 377 378 if(auto tt = cast(Table)v) 378 379 if(auto ss = tt.access!StrValue(theLayer, "name")) 379 - if(auto ll = tt.access!Table(theLayer, "layer")) 380 + if(auto ll = tt.access!Table(theLayer, "layers")) 380 381 { 381 382 Layer[] ls; 382 383 foreach(lll; tableAsConsList(theLayer, ll)) 383 384 if(auto l = cast(StrValue)lll) 384 385 ls ~= l.data; 385 386 else 386 387 throw genex!RuntimeException(cast(LexPosition)null, sprintf!`Invalid AST {bad fun params %s}`(lll));