Skip to content
Permalink
Browse files

resurrection!

  • Loading branch information...
jlongster committed May 4, 2016
1 parent 81b0d8a commit 4a6a2a66c6a08d9c36b98f8f12e740294bf83698
@@ -1,3 +1,6 @@

test:
node tests/run

bundle:
browserify -e main -s main.js -o browser/probe.js
@@ -0,0 +1,23 @@
#!/usr/bin/env node

var fs = require('fs');
var compiler = require(__dirname + '/../main');

var src = fs.readFileSync(process.argv[2], "utf-8");
var output = compiler(src, { includeDebug: true });
var finalSrc =
"var $Machine = require('./runtime/vm.js').$Machine;\n" +
"var $ContinuationExc = require('./runtime/vm.js').$ContinuationExc;\n" +
"var $Frame = require('./runtime/vm.js').$Frame;" +
"var $DebugInfo = require('./runtime/vm.js').$DebugInfo;" +
output.code +
"var VM = new $Machine();\n" +
"VM.on('paused', function() { VM.continue() });\n" +
"VM.on('error', function(e) { console.log('error', e) });\n" +
"VM.setDebugInfo(new $DebugInfo(__debugInfo));\n" +
"VM.execute($__global);"

fs.writeFileSync(
'a.out',
finalSrc
);
15 bin/run
@@ -0,0 +1,15 @@
#!/usr/bin/env node

var Machine = require('../runtime/vm.js').$Machine;
var VM = new Machine();

VM.on("error", function(e) {
console.log('Error:', e.stack);
});

VM.on("paused", function(e) {
console.log('you broke it', VM.getLocation());
VM.continue()
});

VM.loadScript(process.argv[2]);

0 comments on commit 4a6a2a6

Please sign in to comment.
You can’t perform that action at this time.