[OT] Re: Andrei's list of barriers to D adoption

ketmar via Digitalmars-d digitalmars-d at puremagic.com
Sat Jun 11 05:31:26 PDT 2016


On Friday, 10 June 2016 at 15:35:32 UTC, jmh530 wrote:
> On Friday, 10 June 2016 at 15:14:02 UTC, ketmar wrote:
>>
>> 1. this is heavily OT. ;-)
>
> I didn't forget to mark it! :-)
>
>> 2. you may take a look at my gml engine. it has clearly 
>> separated language parser and AST builder (gaem.parser), and 
>> AST->VM compiler (gaem.runner/compiler.d).
>
> I couldn't for the life of me find a link to this.

sorry. Wyatt kindly fixed that for me. ;-)

also, you can replace code generation in compiler with direct 
execution, and you will get AST-based interpreter. just create a 
new AA with local variables on NodeFCall (this will serve as 
"stack frame"), and make `compileExpr` return value instead of 
stack slot index. then it is as easy as:

   (NodeBinarySub n) => compileExpr(n.el)-compileExpr(n.er);

and so on. also, fix `compileVarAccess` and `compileVarStore` to 
use your "stack frame" AA.

this whole bussines is not hard at all. i'd say it is easier than 
many other programming tasks.


More information about the Digitalmars-d mailing list