3 ms·
I'm thinking how viable is marry both. Make flattened AST that still allow to keep the easy of an AST walker yet with more dense representation?
by mamcx 8y ago
I'm thinking how viable is marry both. Make flattened AST that still allow to keep the easy of an AST walker yet with more dense representation?
- munificent 8y agoThat's basically what bytecode is. :) You can think of a stack-based bytecode as basically an in-order serialization of a tree.
- mamcx 8y agoBut byte code "destroy" the control flow/memory model of the host, and is necessary to recreate it with GOTOS and stacks or registers?
- tekknolagi 8y agoSo you want bytecode + CFG?
- mamcx 8y agoProbably. One thing with an AST walker is that the "walker" part come for free. Your control flow need minimal to none conversion and could leverage the host for it. With byte code, some stuff look easier and the performance boost is nice, but need to commit fully to become an "abstract machine". Thats cool if the host language not match the control flow you want, but is extra work otherwise.