Skip to content
r3d3y3 edited this page Sep 13, 2014 · 3 revisions

Patrick's idea:

  1. Code Object
    1. We'll need to figure out all the components and it should be able to run its bytecode given a stack machine.
  2. Function Object?
  3. Bytecode Code Object Parser (mostly a dis port)
    1. Interface: Takes in the contents of a pyc file as a string and outputs code object.
    2. Like marshal.loads()?
  4. Stack Machine
    1. Implements all possible bytecode operations on its internal stack. Some operations require I/O like printing.
    2. Potential Problems:
      1. 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();
	});
};
Clone this wiki locally