Open jeandrek opened 8 years ago
I wonder if it is possible to compile to pyc and piggyback of Python's bitcode interpreter...
Actually, a trivial implementation would be to just save the parsed token list to a file using the pickle module. Then the bytecode interpreter would really be just loading the pickle file and passing it to the normal evaluator. I have a feeling that's not what you were thinking of though...
The whole point of creating this is to learn, so I would be open to doing this the proper way.
The point of a bytecode interpreter is speed. Pickling the AST and then caching it may improve startup speed (depending on how long it takes to un-pickle vs parse) but not execution speed (? pretty sure).
But no, that's not what I was talking about :stuck_out_tongue: I meant compiling it to a low-level bytecode that can be interpreted fast (without parsing). (And it could be cached.)
Either will probably have advantages.
This (and a bytecode interpreter) will be a big job, so if you don't want to do it just ignore this :package: