-
Notifications
You must be signed in to change notification settings - Fork 0
Interpreter Design
r3d3y3 edited this page Sep 13, 2014
·
3 revisions
Patrick's idea:
- Code Object
- We'll need to figure out all the components and it should be able to run its bytecode given a stack machine.
- Function Object?
-
BytecodeCode Object Parser(mostly a dis port)- Interface: Takes in the contents of a pyc file as a string and outputs code object.
- Like marshal.loads()?
- Stack Machine
- Implements all possible bytecode operations on its internal stack. Some operations require I/O like printing.
- Potential Problems:
- Are there stack operations that require async execution? If so, will closures allow us to only use callbacks within those async operations? Example in JS syntax:
StackMachine.prototype.asyncOp = function(parameters){
var sm = this;
doAsyncThing(parameters, function callback(err, result){
if(err){ console.log('oh no!'); }
dealWithResult...
sm.executeNextOperation();
});
};