Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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?


That's basically what bytecode is. :) You can think of a stack-based bytecode as basically an in-order serialization of a tree.


But byte code "destroy" the control flow/memory model of the host, and is necessary to recreate it with GOTOS and stacks or registers?


So you want bytecode + CFG?


Probably. 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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: