VM works in browser for simple examples.
This commit is contained in:
@@ -18,6 +18,7 @@ function getBytes(data) {
|
|||||||
|
|
||||||
// Data contains our file, but we want it as a string
|
// Data contains our file, but we want it as a string
|
||||||
var string_data = data.toString();
|
var string_data = data.toString();
|
||||||
|
console.log(string_data);
|
||||||
|
|
||||||
// Strip all the comments for easier parsing
|
// Strip all the comments for easier parsing
|
||||||
var without_comments = string_data.replace(new RegExp("#.*", "gi"), "");
|
var without_comments = string_data.replace(new RegExp("#.*", "gi"), "");
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ c0vm = require("./c0vm.js");
|
|||||||
// console.log(file.function_pool[0].code);
|
// console.log(file.function_pool[0].code);
|
||||||
|
|
||||||
$("#run").click(function() {
|
$("#run").click(function() {
|
||||||
var file = parser.parse($("#bytecode").text);
|
var input = $("#bytecode").html().replace(/(\r\n|\n|\r)/gm,"");
|
||||||
|
var file = parser.parse($("#bytecode").text());
|
||||||
$("#output").text(c0vm.execute(file));
|
$("#output").text(c0vm.execute(file));
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -60,6 +60,7 @@ function getBytes(data) {
|
|||||||
|
|
||||||
// Data contains our file, but we want it as a string
|
// Data contains our file, but we want it as a string
|
||||||
var string_data = data.toString();
|
var string_data = data.toString();
|
||||||
|
console.log(string_data);
|
||||||
|
|
||||||
// Strip all the comments for easier parsing
|
// Strip all the comments for easier parsing
|
||||||
var without_comments = string_data.replace(new RegExp("#.*", "gi"), "");
|
var without_comments = string_data.replace(new RegExp("#.*", "gi"), "");
|
||||||
@@ -404,7 +405,8 @@ c0vm = require("./c0vm.js");
|
|||||||
// console.log(file.function_pool[0].code);
|
// console.log(file.function_pool[0].code);
|
||||||
|
|
||||||
$("#run").click(function() {
|
$("#run").click(function() {
|
||||||
var file = parser.parse($("#bytecode").text);
|
var input = $("#bytecode").html().replace(/(\r\n|\n|\r)/gm,"");
|
||||||
|
var file = parser.parse($("#bytecode").text());
|
||||||
$("#output").text(c0vm.execute(file));
|
$("#output").text(c0vm.execute(file));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user