tzo 1.0.18 → 1.0.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +284 -280
- package/bin/package.json +2 -2
- package/bin/tzo +3 -3
- package/bin/tzo.mjs +3 -3
- package/dist/browser/cli.d.ts +1 -1
- package/dist/browser/cli.js +34 -34
- package/dist/browser/cli.js.map +1 -1
- package/dist/browser/concisetext/ConciseTextLexer.d.ts +30 -30
- package/dist/browser/concisetext/ConciseTextLexer.js +122 -122
- package/dist/browser/concisetext/ConciseTextListener.d.ts +14 -14
- package/dist/browser/concisetext/ConciseTextListener.js +35 -35
- package/dist/browser/concisetext/ConciseTextParser.d.ts +99 -99
- package/dist/browser/concisetext/ConciseTextParser.js +438 -438
- package/dist/browser/getStackParams.d.ts +2 -2
- package/dist/browser/getStackParams.js +23 -23
- package/dist/browser/index.d.ts +5 -5
- package/dist/browser/index.js +17 -17
- package/dist/browser/interfaces.d.ts +42 -42
- package/dist/browser/interfaces.js +2 -2
- package/dist/browser/opcodes/and.d.ts +3 -3
- package/dist/browser/opcodes/and.js +8 -8
- package/dist/browser/opcodes/charCode.d.ts +3 -3
- package/dist/browser/opcodes/charCode.js +9 -9
- package/dist/browser/opcodes/closeBrace.d.ts +3 -3
- package/dist/browser/opcodes/closeBrace.js +6 -6
- package/dist/browser/opcodes/closeBrace.js.map +1 -1
- package/dist/browser/opcodes/concat.d.ts +3 -3
- package/dist/browser/opcodes/concat.js +8 -8
- package/dist/browser/opcodes/delContext.d.ts +3 -3
- package/dist/browser/opcodes/delContext.js +8 -8
- package/dist/browser/opcodes/dup.d.ts +6 -6
- package/dist/browser/opcodes/dup.js +12 -12
- package/dist/browser/opcodes/eq.d.ts +3 -3
- package/dist/browser/opcodes/eq.js +9 -9
- package/dist/browser/opcodes/exit.d.ts +3 -3
- package/dist/browser/opcodes/exit.js +6 -6
- package/dist/browser/opcodes/getContext.d.ts +3 -3
- package/dist/browser/opcodes/getContext.js +12 -12
- package/dist/browser/opcodes/goto.d.ts +3 -3
- package/dist/browser/opcodes/goto.js +19 -19
- package/dist/browser/opcodes/gt.d.ts +3 -3
- package/dist/browser/opcodes/gt.js +9 -9
- package/dist/browser/opcodes/hasContext.d.ts +3 -3
- package/dist/browser/opcodes/hasContext.js +13 -13
- package/dist/browser/opcodes/jgz.d.ts +3 -3
- package/dist/browser/opcodes/jgz.js +10 -10
- package/dist/browser/opcodes/jz.d.ts +3 -3
- package/dist/browser/opcodes/jz.js +10 -10
- package/dist/browser/opcodes/lt.d.ts +3 -3
- package/dist/browser/opcodes/lt.js +9 -9
- package/dist/browser/opcodes/min.d.ts +3 -3
- package/dist/browser/opcodes/min.js +10 -10
- package/dist/browser/opcodes/mul.d.ts +3 -3
- package/dist/browser/opcodes/mul.js +10 -10
- package/dist/browser/opcodes/nop.d.ts +6 -6
- package/dist/browser/opcodes/nop.js +9 -9
- package/dist/browser/opcodes/not.d.ts +6 -6
- package/dist/browser/opcodes/not.js +16 -16
- package/dist/browser/opcodes/openBrace.d.ts +3 -3
- package/dist/browser/opcodes/openBrace.js +20 -20
- package/dist/browser/opcodes/openBrace.js.map +1 -1
- package/dist/browser/opcodes/or.d.ts +3 -3
- package/dist/browser/opcodes/or.js +8 -8
- package/dist/browser/opcodes/pause.d.ts +3 -3
- package/dist/browser/opcodes/pause.js +6 -6
- package/dist/browser/opcodes/plus.d.ts +3 -3
- package/dist/browser/opcodes/plus.js +10 -10
- package/dist/browser/opcodes/pop.d.ts +3 -3
- package/dist/browser/opcodes/pop.js +6 -6
- package/dist/browser/opcodes/ppc.d.ts +6 -6
- package/dist/browser/opcodes/ppc.js +9 -9
- package/dist/browser/opcodes/randInt.d.ts +3 -3
- package/dist/browser/opcodes/randInt.js +9 -9
- package/dist/browser/opcodes/rconcat.d.ts +3 -3
- package/dist/browser/opcodes/rconcat.js +8 -8
- package/dist/browser/opcodes/setContext.d.ts +3 -3
- package/dist/browser/opcodes/setContext.js +8 -8
- package/dist/browser/opcodes/stacksize.d.ts +3 -3
- package/dist/browser/opcodes/stacksize.js +6 -6
- package/dist/browser/opcodes/stdout.d.ts +3 -3
- package/dist/browser/opcodes/stdout.js +6 -6
- package/dist/browser/util/builder.d.ts +12 -12
- package/dist/browser/util/builder.js +37 -37
- package/dist/browser/util/fix_antlr_grammar_ts.d.ts +1 -1
- package/dist/browser/util/fix_antlr_grammar_ts.js +7 -7
- package/dist/browser/util/tokenizer.d.ts +20 -20
- package/dist/browser/util/tokenizer.js +176 -176
- package/dist/browser/util/tokenizer.js.map +1 -1
- package/dist/browser/vm.d.ts +26 -26
- package/dist/browser/vm.js +201 -201
- package/dist/browser/vm.test.d.ts +1 -1
- package/dist/browser/vm.test.js +398 -355
- package/dist/browser/vm.test.js.map +1 -1
- package/dist/node/cli.d.ts +1 -1
- package/dist/node/cli.js +34 -34
- package/dist/node/cli.js.map +1 -1
- package/dist/node/concisetext/ConciseTextLexer.d.ts +30 -30
- package/dist/node/concisetext/ConciseTextLexer.js +122 -122
- package/dist/node/concisetext/ConciseTextListener.d.ts +14 -14
- package/dist/node/concisetext/ConciseTextListener.js +35 -35
- package/dist/node/concisetext/ConciseTextParser.d.ts +99 -99
- package/dist/node/concisetext/ConciseTextParser.js +438 -438
- package/dist/node/getStackParams.d.ts +2 -2
- package/dist/node/getStackParams.js +23 -23
- package/dist/node/index.d.ts +5 -5
- package/dist/node/index.js +17 -17
- package/dist/node/interfaces.d.ts +42 -42
- package/dist/node/interfaces.js +2 -2
- package/dist/node/opcodes/and.d.ts +3 -3
- package/dist/node/opcodes/and.js +8 -8
- package/dist/node/opcodes/charCode.d.ts +3 -3
- package/dist/node/opcodes/charCode.js +9 -9
- package/dist/node/opcodes/closeBrace.d.ts +3 -3
- package/dist/node/opcodes/closeBrace.js +6 -6
- package/dist/node/opcodes/closeBrace.js.map +1 -1
- package/dist/node/opcodes/concat.d.ts +3 -3
- package/dist/node/opcodes/concat.js +8 -8
- package/dist/node/opcodes/delContext.d.ts +3 -3
- package/dist/node/opcodes/delContext.js +8 -8
- package/dist/node/opcodes/dup.d.ts +6 -6
- package/dist/node/opcodes/dup.js +12 -12
- package/dist/node/opcodes/eq.d.ts +3 -3
- package/dist/node/opcodes/eq.js +9 -9
- package/dist/node/opcodes/exit.d.ts +3 -3
- package/dist/node/opcodes/exit.js +6 -6
- package/dist/node/opcodes/getContext.d.ts +3 -3
- package/dist/node/opcodes/getContext.js +12 -12
- package/dist/node/opcodes/goto.d.ts +3 -3
- package/dist/node/opcodes/goto.js +19 -19
- package/dist/node/opcodes/gt.d.ts +3 -3
- package/dist/node/opcodes/gt.js +9 -9
- package/dist/node/opcodes/hasContext.d.ts +3 -3
- package/dist/node/opcodes/hasContext.js +13 -13
- package/dist/node/opcodes/jgz.d.ts +3 -3
- package/dist/node/opcodes/jgz.js +10 -10
- package/dist/node/opcodes/jz.d.ts +3 -3
- package/dist/node/opcodes/jz.js +10 -10
- package/dist/node/opcodes/lt.d.ts +3 -3
- package/dist/node/opcodes/lt.js +9 -9
- package/dist/node/opcodes/min.d.ts +3 -3
- package/dist/node/opcodes/min.js +10 -10
- package/dist/node/opcodes/mul.d.ts +3 -3
- package/dist/node/opcodes/mul.js +10 -10
- package/dist/node/opcodes/nop.d.ts +6 -6
- package/dist/node/opcodes/nop.js +9 -9
- package/dist/node/opcodes/not.d.ts +6 -6
- package/dist/node/opcodes/not.js +16 -16
- package/dist/node/opcodes/openBrace.d.ts +3 -3
- package/dist/node/opcodes/openBrace.js +20 -20
- package/dist/node/opcodes/openBrace.js.map +1 -1
- package/dist/node/opcodes/or.d.ts +3 -3
- package/dist/node/opcodes/or.js +8 -8
- package/dist/node/opcodes/pause.d.ts +3 -3
- package/dist/node/opcodes/pause.js +6 -6
- package/dist/node/opcodes/plus.d.ts +3 -3
- package/dist/node/opcodes/plus.js +10 -10
- package/dist/node/opcodes/pop.d.ts +3 -3
- package/dist/node/opcodes/pop.js +6 -6
- package/dist/node/opcodes/ppc.d.ts +6 -6
- package/dist/node/opcodes/ppc.js +9 -9
- package/dist/node/opcodes/randInt.d.ts +3 -3
- package/dist/node/opcodes/randInt.js +9 -9
- package/dist/node/opcodes/rconcat.d.ts +3 -3
- package/dist/node/opcodes/rconcat.js +8 -8
- package/dist/node/opcodes/setContext.d.ts +3 -3
- package/dist/node/opcodes/setContext.js +8 -8
- package/dist/node/opcodes/stacksize.d.ts +3 -3
- package/dist/node/opcodes/stacksize.js +6 -6
- package/dist/node/opcodes/stdout.d.ts +3 -3
- package/dist/node/opcodes/stdout.js +6 -6
- package/dist/node/util/builder.d.ts +12 -12
- package/dist/node/util/builder.js +37 -37
- package/dist/node/util/fix_antlr_grammar_ts.d.ts +1 -1
- package/dist/node/util/fix_antlr_grammar_ts.js +7 -7
- package/dist/node/util/tokenizer.d.ts +20 -20
- package/dist/node/util/tokenizer.js +176 -176
- package/dist/node/util/tokenizer.js.map +1 -1
- package/dist/node/vm.d.ts +26 -26
- package/dist/node/vm.js +201 -201
- package/dist/node/vm.test.d.ts +1 -1
- package/dist/node/vm.test.js +398 -355
- package/dist/node/vm.test.js.map +1 -1
- package/jest.config.js +4 -4
- package/package.json +50 -50
- package/tsconfig-browser.json +8 -8
- package/tsconfig.json +28 -28
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
const glob = require("glob");
|
|
2
|
-
const fs = require('fs');
|
|
3
|
-
glob.sync("./src/concisetext/*.ts").forEach(fname => {
|
|
4
|
-
let src = fs.readFileSync(fname).toString();
|
|
5
|
-
src = `// @ts-nocheck\n${src}`;
|
|
6
|
-
fs.writeFileSync(fname, src, { encoding: 'utf-8' });
|
|
7
|
-
});
|
|
1
|
+
const glob = require("glob");
|
|
2
|
+
const fs = require('fs');
|
|
3
|
+
glob.sync("./src/concisetext/*.ts").forEach(fname => {
|
|
4
|
+
let src = fs.readFileSync(fname).toString();
|
|
5
|
+
src = `// @ts-nocheck\n${src}`;
|
|
6
|
+
fs.writeFileSync(fname, src, { encoding: 'utf-8' });
|
|
7
|
+
});
|
|
8
8
|
//# sourceMappingURL=fix_antlr_grammar_ts.js.map
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { Instruction } from "../interfaces";
|
|
2
|
-
import { InvokeFunctionInstruction, PushNumberInstruction, PushStringInstruction } from "../index";
|
|
3
|
-
export declare const pushNumber: (val: number, comment?: string) => PushNumberInstruction;
|
|
4
|
-
export declare const pushString: (val: string, comment?: string) => PushStringInstruction;
|
|
5
|
-
export declare const invokeFunction: (name: string, comment?: string) => InvokeFunctionInstruction;
|
|
6
|
-
export declare class Tokenizer {
|
|
7
|
-
parse(codeBlock: string): Instruction[];
|
|
8
|
-
/**
|
|
9
|
-
* @deprecated - use `parse()` instead
|
|
10
|
-
* @param codeBlock
|
|
11
|
-
* @returns
|
|
12
|
-
*/
|
|
13
|
-
tokenize(codeBlock: string): string[];
|
|
14
|
-
/**
|
|
15
|
-
* @deprecated - use `parse()` instead
|
|
16
|
-
* @param codeBlock
|
|
17
|
-
* @returns
|
|
18
|
-
*/
|
|
19
|
-
transform(tokens: string[]): Instruction[];
|
|
20
|
-
}
|
|
1
|
+
import { Instruction } from "../interfaces";
|
|
2
|
+
import { InvokeFunctionInstruction, PushNumberInstruction, PushStringInstruction } from "../index";
|
|
3
|
+
export declare const pushNumber: (val: number, comment?: string) => PushNumberInstruction;
|
|
4
|
+
export declare const pushString: (val: string, comment?: string) => PushStringInstruction;
|
|
5
|
+
export declare const invokeFunction: (name: string, comment?: string) => InvokeFunctionInstruction;
|
|
6
|
+
export declare class Tokenizer {
|
|
7
|
+
parse(codeBlock: string): Instruction[];
|
|
8
|
+
/**
|
|
9
|
+
* @deprecated - use `parse()` instead
|
|
10
|
+
* @param codeBlock
|
|
11
|
+
* @returns
|
|
12
|
+
*/
|
|
13
|
+
tokenize(codeBlock: string): string[];
|
|
14
|
+
/**
|
|
15
|
+
* @deprecated - use `parse()` instead
|
|
16
|
+
* @param codeBlock
|
|
17
|
+
* @returns
|
|
18
|
+
*/
|
|
19
|
+
transform(tokens: string[]): Instruction[];
|
|
20
|
+
}
|
|
@@ -1,177 +1,177 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.Tokenizer = exports.invokeFunction = exports.pushString = exports.pushNumber = void 0;
|
|
7
|
-
const unist_builder_1 = __importDefault(require("unist-builder"));
|
|
8
|
-
const ConciseTextLexer_1 = require("../concisetext/ConciseTextLexer");
|
|
9
|
-
const ConciseTextParser_1 = require("../concisetext/ConciseTextParser");
|
|
10
|
-
const ConciseTextListener_1 = require("../concisetext/ConciseTextListener");
|
|
11
|
-
const antlr4_1 = __importDefault(require("antlr4"));
|
|
12
|
-
const stringPushOperationRegexp = /^\"(.+)\"$/;
|
|
13
|
-
const numberPushOperationRegexp = /^(-?[0-9]+)$/;
|
|
14
|
-
const functionInvocationOperationRegexp = /^(\S+)$/;
|
|
15
|
-
const labelInstructionRegexp = /^\#(\S+)$/;
|
|
16
|
-
exports.pushNumber = (val, comment) => {
|
|
17
|
-
return unist_builder_1.default("push-number-instruction", { value: val, comment });
|
|
18
|
-
};
|
|
19
|
-
exports.pushString = (val, comment) => {
|
|
20
|
-
return unist_builder_1.default("push-string-instruction", { value: val, comment });
|
|
21
|
-
};
|
|
22
|
-
exports.invokeFunction = (name, comment) => {
|
|
23
|
-
return unist_builder_1.default("invoke-function-instruction", { functionName: name, comment });
|
|
24
|
-
};
|
|
25
|
-
class Tokenizer {
|
|
26
|
-
parse(codeBlock) {
|
|
27
|
-
function getTree(input) {
|
|
28
|
-
let inputStream = new antlr4_1.default.InputStream(input);
|
|
29
|
-
let lexer = new ConciseTextLexer_1.ConciseTextLexer(inputStream);
|
|
30
|
-
let tokenStream = new antlr4_1.default.CommonTokenStream(lexer);
|
|
31
|
-
let parser = new ConciseTextParser_1.ConciseTextParser(tokenStream);
|
|
32
|
-
return parser.instructions();
|
|
33
|
-
}
|
|
34
|
-
class Listener extends ConciseTextListener_1.ConciseTextListener {
|
|
35
|
-
constructor() {
|
|
36
|
-
super(...arguments);
|
|
37
|
-
this.instructions = [];
|
|
38
|
-
this.lastInstruction = null;
|
|
39
|
-
}
|
|
40
|
-
enterInstructions(context) {
|
|
41
|
-
this.lastInstruction = {
|
|
42
|
-
functionName: null,
|
|
43
|
-
type: null,
|
|
44
|
-
value: null,
|
|
45
|
-
comment: null,
|
|
46
|
-
label: null
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
enterPushNumber(context) {
|
|
50
|
-
this.lastInstruction = exports.pushNumber(
|
|
51
|
-
this.lastInstruction.label = context.label ? context.label.text : undefined;
|
|
52
|
-
}
|
|
53
|
-
enterPushString(context) {
|
|
54
|
-
const str = context.string.text;
|
|
55
|
-
this.lastInstruction = exports.pushString(str.substr(1, str.length - 2));
|
|
56
|
-
this.lastInstruction.label = context.label ? context.label.text : undefined;
|
|
57
|
-
}
|
|
58
|
-
enterInvokeFunction(context) {
|
|
59
|
-
this.lastInstruction = exports.invokeFunction(context.opcode.text);
|
|
60
|
-
this.lastInstruction.label = context.label ? context.label.text : undefined;
|
|
61
|
-
}
|
|
62
|
-
exitPushNumber() {
|
|
63
|
-
this.instructions.push(this.lastInstruction);
|
|
64
|
-
this.lastInstruction = null;
|
|
65
|
-
}
|
|
66
|
-
exitPushString() {
|
|
67
|
-
this.instructions.push(this.lastInstruction);
|
|
68
|
-
this.lastInstruction = null;
|
|
69
|
-
}
|
|
70
|
-
exitInvokeFunction() {
|
|
71
|
-
this.instructions.push(this.lastInstruction);
|
|
72
|
-
this.lastInstruction = null;
|
|
73
|
-
}
|
|
74
|
-
getInstructions() {
|
|
75
|
-
return this.instructions;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
const listener = new Listener();
|
|
79
|
-
antlr4_1.default.tree.ParseTreeWalker.DEFAULT.walk(listener, getTree(codeBlock));
|
|
80
|
-
return listener.getInstructions();
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* @deprecated - use `parse()` instead
|
|
84
|
-
* @param codeBlock
|
|
85
|
-
* @returns
|
|
86
|
-
*/
|
|
87
|
-
tokenize(codeBlock) {
|
|
88
|
-
let parsing = null;
|
|
89
|
-
let partial_parse = "";
|
|
90
|
-
let i = 0;
|
|
91
|
-
const tokens = [];
|
|
92
|
-
function addTokenMaybe() {
|
|
93
|
-
if (partial_parse.length > 0) {
|
|
94
|
-
tokens.push(partial_parse);
|
|
95
|
-
partial_parse = "";
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
while (true) {
|
|
99
|
-
const c = codeBlock[i];
|
|
100
|
-
if (c === '"') { // todo: add escape support ( \" )
|
|
101
|
-
if (parsing === "string") {
|
|
102
|
-
parsing = null;
|
|
103
|
-
partial_parse = `${partial_parse}${c}`;
|
|
104
|
-
i += 1;
|
|
105
|
-
addTokenMaybe();
|
|
106
|
-
continue;
|
|
107
|
-
}
|
|
108
|
-
else if (parsing === null) {
|
|
109
|
-
parsing = "string";
|
|
110
|
-
partial_parse = `${partial_parse}${c}`;
|
|
111
|
-
i += 1;
|
|
112
|
-
continue;
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
if (parsing === "string") {
|
|
116
|
-
partial_parse = `${partial_parse}${c}`;
|
|
117
|
-
i += 1;
|
|
118
|
-
continue;
|
|
119
|
-
}
|
|
120
|
-
if (c === undefined) {
|
|
121
|
-
addTokenMaybe();
|
|
122
|
-
break;
|
|
123
|
-
}
|
|
124
|
-
if (c.match(/\s/) !== null) {
|
|
125
|
-
addTokenMaybe();
|
|
126
|
-
i += 1;
|
|
127
|
-
continue;
|
|
128
|
-
}
|
|
129
|
-
partial_parse = `${partial_parse}${c}`;
|
|
130
|
-
i += 1;
|
|
131
|
-
}
|
|
132
|
-
return tokens;
|
|
133
|
-
}
|
|
134
|
-
/**
|
|
135
|
-
* @deprecated - use `parse()` instead
|
|
136
|
-
* @param codeBlock
|
|
137
|
-
* @returns
|
|
138
|
-
*/
|
|
139
|
-
transform(tokens) {
|
|
140
|
-
/**
|
|
141
|
-
* Parse a list of tokens into a list of Instructions
|
|
142
|
-
*/
|
|
143
|
-
const labelMap = {};
|
|
144
|
-
let i = -1;
|
|
145
|
-
const instructions = tokens.map(token => {
|
|
146
|
-
const matchLabelInstruction = token.match(labelInstructionRegexp);
|
|
147
|
-
if (matchLabelInstruction !== null) {
|
|
148
|
-
const label = matchLabelInstruction[1];
|
|
149
|
-
labelMap[label] = i;
|
|
150
|
-
return undefined;
|
|
151
|
-
}
|
|
152
|
-
i += 1;
|
|
153
|
-
const matchStringPushOp = token.match(stringPushOperationRegexp);
|
|
154
|
-
if (matchStringPushOp !== null) {
|
|
155
|
-
const stringToPush = matchStringPushOp[1];
|
|
156
|
-
return exports.pushString(stringToPush);
|
|
157
|
-
}
|
|
158
|
-
const matchNumberPushOp = token.match(numberPushOperationRegexp);
|
|
159
|
-
if (matchNumberPushOp !== null) {
|
|
160
|
-
const numberToPush =
|
|
161
|
-
return exports.pushNumber(numberToPush);
|
|
162
|
-
}
|
|
163
|
-
const matchFunctionInvocationOp = token.match(functionInvocationOperationRegexp);
|
|
164
|
-
if (matchFunctionInvocationOp !== null) {
|
|
165
|
-
const functionNameToPush = matchFunctionInvocationOp[1];
|
|
166
|
-
return exports.invokeFunction(functionNameToPush);
|
|
167
|
-
}
|
|
168
|
-
throw new Error(`Could not parse token: \`${token}\``);
|
|
169
|
-
}).filter(instr => instr !== undefined);
|
|
170
|
-
Object.entries(labelMap).forEach(entry => {
|
|
171
|
-
instructions[entry[1]].label = entry[0];
|
|
172
|
-
});
|
|
173
|
-
return instructions;
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
exports.Tokenizer = Tokenizer;
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.Tokenizer = exports.invokeFunction = exports.pushString = exports.pushNumber = void 0;
|
|
7
|
+
const unist_builder_1 = __importDefault(require("unist-builder"));
|
|
8
|
+
const ConciseTextLexer_1 = require("../concisetext/ConciseTextLexer");
|
|
9
|
+
const ConciseTextParser_1 = require("../concisetext/ConciseTextParser");
|
|
10
|
+
const ConciseTextListener_1 = require("../concisetext/ConciseTextListener");
|
|
11
|
+
const antlr4_1 = __importDefault(require("antlr4"));
|
|
12
|
+
const stringPushOperationRegexp = /^\"(.+)\"$/;
|
|
13
|
+
const numberPushOperationRegexp = /^(-?[0-9]+(\.[0-9]+)?)$/;
|
|
14
|
+
const functionInvocationOperationRegexp = /^(\S+)$/;
|
|
15
|
+
const labelInstructionRegexp = /^\#(\S+)$/;
|
|
16
|
+
exports.pushNumber = (val, comment) => {
|
|
17
|
+
return unist_builder_1.default("push-number-instruction", { value: val, comment });
|
|
18
|
+
};
|
|
19
|
+
exports.pushString = (val, comment) => {
|
|
20
|
+
return unist_builder_1.default("push-string-instruction", { value: val, comment });
|
|
21
|
+
};
|
|
22
|
+
exports.invokeFunction = (name, comment) => {
|
|
23
|
+
return unist_builder_1.default("invoke-function-instruction", { functionName: name, comment });
|
|
24
|
+
};
|
|
25
|
+
class Tokenizer {
|
|
26
|
+
parse(codeBlock) {
|
|
27
|
+
function getTree(input) {
|
|
28
|
+
let inputStream = new antlr4_1.default.InputStream(input);
|
|
29
|
+
let lexer = new ConciseTextLexer_1.ConciseTextLexer(inputStream);
|
|
30
|
+
let tokenStream = new antlr4_1.default.CommonTokenStream(lexer);
|
|
31
|
+
let parser = new ConciseTextParser_1.ConciseTextParser(tokenStream);
|
|
32
|
+
return parser.instructions();
|
|
33
|
+
}
|
|
34
|
+
class Listener extends ConciseTextListener_1.ConciseTextListener {
|
|
35
|
+
constructor() {
|
|
36
|
+
super(...arguments);
|
|
37
|
+
this.instructions = [];
|
|
38
|
+
this.lastInstruction = null;
|
|
39
|
+
}
|
|
40
|
+
enterInstructions(context) {
|
|
41
|
+
this.lastInstruction = {
|
|
42
|
+
functionName: null,
|
|
43
|
+
type: null,
|
|
44
|
+
value: null,
|
|
45
|
+
comment: null,
|
|
46
|
+
label: null
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
enterPushNumber(context) {
|
|
50
|
+
this.lastInstruction = exports.pushNumber(parseFloat(context.number.text));
|
|
51
|
+
this.lastInstruction.label = context.label ? context.label.text : undefined;
|
|
52
|
+
}
|
|
53
|
+
enterPushString(context) {
|
|
54
|
+
const str = context.string.text;
|
|
55
|
+
this.lastInstruction = exports.pushString(str.substr(1, str.length - 2));
|
|
56
|
+
this.lastInstruction.label = context.label ? context.label.text : undefined;
|
|
57
|
+
}
|
|
58
|
+
enterInvokeFunction(context) {
|
|
59
|
+
this.lastInstruction = exports.invokeFunction(context.opcode.text);
|
|
60
|
+
this.lastInstruction.label = context.label ? context.label.text : undefined;
|
|
61
|
+
}
|
|
62
|
+
exitPushNumber() {
|
|
63
|
+
this.instructions.push(this.lastInstruction);
|
|
64
|
+
this.lastInstruction = null;
|
|
65
|
+
}
|
|
66
|
+
exitPushString() {
|
|
67
|
+
this.instructions.push(this.lastInstruction);
|
|
68
|
+
this.lastInstruction = null;
|
|
69
|
+
}
|
|
70
|
+
exitInvokeFunction() {
|
|
71
|
+
this.instructions.push(this.lastInstruction);
|
|
72
|
+
this.lastInstruction = null;
|
|
73
|
+
}
|
|
74
|
+
getInstructions() {
|
|
75
|
+
return this.instructions;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
const listener = new Listener();
|
|
79
|
+
antlr4_1.default.tree.ParseTreeWalker.DEFAULT.walk(listener, getTree(codeBlock));
|
|
80
|
+
return listener.getInstructions();
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* @deprecated - use `parse()` instead
|
|
84
|
+
* @param codeBlock
|
|
85
|
+
* @returns
|
|
86
|
+
*/
|
|
87
|
+
tokenize(codeBlock) {
|
|
88
|
+
let parsing = null;
|
|
89
|
+
let partial_parse = "";
|
|
90
|
+
let i = 0;
|
|
91
|
+
const tokens = [];
|
|
92
|
+
function addTokenMaybe() {
|
|
93
|
+
if (partial_parse.length > 0) {
|
|
94
|
+
tokens.push(partial_parse);
|
|
95
|
+
partial_parse = "";
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
while (true) {
|
|
99
|
+
const c = codeBlock[i];
|
|
100
|
+
if (c === '"') { // todo: add escape support ( \" )
|
|
101
|
+
if (parsing === "string") {
|
|
102
|
+
parsing = null;
|
|
103
|
+
partial_parse = `${partial_parse}${c}`;
|
|
104
|
+
i += 1;
|
|
105
|
+
addTokenMaybe();
|
|
106
|
+
continue;
|
|
107
|
+
}
|
|
108
|
+
else if (parsing === null) {
|
|
109
|
+
parsing = "string";
|
|
110
|
+
partial_parse = `${partial_parse}${c}`;
|
|
111
|
+
i += 1;
|
|
112
|
+
continue;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
if (parsing === "string") {
|
|
116
|
+
partial_parse = `${partial_parse}${c}`;
|
|
117
|
+
i += 1;
|
|
118
|
+
continue;
|
|
119
|
+
}
|
|
120
|
+
if (c === undefined) {
|
|
121
|
+
addTokenMaybe();
|
|
122
|
+
break;
|
|
123
|
+
}
|
|
124
|
+
if (c.match(/\s/) !== null) {
|
|
125
|
+
addTokenMaybe();
|
|
126
|
+
i += 1;
|
|
127
|
+
continue;
|
|
128
|
+
}
|
|
129
|
+
partial_parse = `${partial_parse}${c}`;
|
|
130
|
+
i += 1;
|
|
131
|
+
}
|
|
132
|
+
return tokens;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* @deprecated - use `parse()` instead
|
|
136
|
+
* @param codeBlock
|
|
137
|
+
* @returns
|
|
138
|
+
*/
|
|
139
|
+
transform(tokens) {
|
|
140
|
+
/**
|
|
141
|
+
* Parse a list of tokens into a list of Instructions
|
|
142
|
+
*/
|
|
143
|
+
const labelMap = {};
|
|
144
|
+
let i = -1;
|
|
145
|
+
const instructions = tokens.map(token => {
|
|
146
|
+
const matchLabelInstruction = token.match(labelInstructionRegexp);
|
|
147
|
+
if (matchLabelInstruction !== null) {
|
|
148
|
+
const label = matchLabelInstruction[1];
|
|
149
|
+
labelMap[label] = i;
|
|
150
|
+
return undefined;
|
|
151
|
+
}
|
|
152
|
+
i += 1;
|
|
153
|
+
const matchStringPushOp = token.match(stringPushOperationRegexp);
|
|
154
|
+
if (matchStringPushOp !== null) {
|
|
155
|
+
const stringToPush = matchStringPushOp[1];
|
|
156
|
+
return exports.pushString(stringToPush);
|
|
157
|
+
}
|
|
158
|
+
const matchNumberPushOp = token.match(numberPushOperationRegexp);
|
|
159
|
+
if (matchNumberPushOp !== null) {
|
|
160
|
+
const numberToPush = parseFloat(matchNumberPushOp[1]);
|
|
161
|
+
return exports.pushNumber(numberToPush);
|
|
162
|
+
}
|
|
163
|
+
const matchFunctionInvocationOp = token.match(functionInvocationOperationRegexp);
|
|
164
|
+
if (matchFunctionInvocationOp !== null) {
|
|
165
|
+
const functionNameToPush = matchFunctionInvocationOp[1];
|
|
166
|
+
return exports.invokeFunction(functionNameToPush);
|
|
167
|
+
}
|
|
168
|
+
throw new Error(`Could not parse token: \`${token}\``);
|
|
169
|
+
}).filter(instr => instr !== undefined);
|
|
170
|
+
Object.entries(labelMap).forEach(entry => {
|
|
171
|
+
instructions[entry[1]].label = entry[0];
|
|
172
|
+
});
|
|
173
|
+
return instructions;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
exports.Tokenizer = Tokenizer;
|
|
177
177
|
//# sourceMappingURL=tokenizer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tokenizer.js","sourceRoot":"","sources":["../../../src/util/tokenizer.ts"],"names":[],"mappings":";;;;;;AAAA,kEAA8B;AAG9B,sEAAmE;AACnE,wEAAqE;AACrE,4EAAyE;AACzE,o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;CACF;AA7KD,8BA6KC"}
|
package/dist/browser/vm.d.ts
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import { Context, Functions, Instruction, InstructionOperation, Instructions, LabelMap, Stack, TzoVMState } from "./interfaces";
|
|
2
|
-
export declare const std_functions: Functions;
|
|
3
|
-
export declare class VM {
|
|
4
|
-
stack: Stack;
|
|
5
|
-
context: Context;
|
|
6
|
-
programList: InstructionOperation[];
|
|
7
|
-
labelMap: LabelMap;
|
|
8
|
-
functions: Functions;
|
|
9
|
-
programCounter: number;
|
|
10
|
-
exit: boolean;
|
|
11
|
-
pause: boolean;
|
|
12
|
-
logger: any;
|
|
13
|
-
constructor(initialContext: Context, additionalFunctions?: Functions);
|
|
14
|
-
quit(): void;
|
|
15
|
-
suspend(): void;
|
|
16
|
-
invoke(instructions: Instructions): string | number | void;
|
|
17
|
-
getVMInstructions(instructions: Instruction[], labelMap?: LabelMap): {
|
|
18
|
-
vmInstructions: InstructionOperation[];
|
|
19
|
-
labelMap: LabelMap;
|
|
20
|
-
};
|
|
21
|
-
loadProgramList(instructions: Instruction[], labelMap?: LabelMap): void;
|
|
22
|
-
loadVMState(tzoVMState: TzoVMState): void;
|
|
23
|
-
setProgramCounter(c: number): void;
|
|
24
|
-
tick(): any;
|
|
25
|
-
run(): void;
|
|
26
|
-
}
|
|
1
|
+
import { Context, Functions, Instruction, InstructionOperation, Instructions, LabelMap, Stack, TzoVMState } from "./interfaces";
|
|
2
|
+
export declare const std_functions: Functions;
|
|
3
|
+
export declare class VM {
|
|
4
|
+
stack: Stack;
|
|
5
|
+
context: Context;
|
|
6
|
+
programList: InstructionOperation[];
|
|
7
|
+
labelMap: LabelMap;
|
|
8
|
+
functions: Functions;
|
|
9
|
+
programCounter: number;
|
|
10
|
+
exit: boolean;
|
|
11
|
+
pause: boolean;
|
|
12
|
+
logger: any;
|
|
13
|
+
constructor(initialContext: Context, additionalFunctions?: Functions);
|
|
14
|
+
quit(): void;
|
|
15
|
+
suspend(): void;
|
|
16
|
+
invoke(instructions: Instructions): string | number | void;
|
|
17
|
+
getVMInstructions(instructions: Instruction[], labelMap?: LabelMap): {
|
|
18
|
+
vmInstructions: InstructionOperation[];
|
|
19
|
+
labelMap: LabelMap;
|
|
20
|
+
};
|
|
21
|
+
loadProgramList(instructions: Instruction[], labelMap?: LabelMap): void;
|
|
22
|
+
loadVMState(tzoVMState: TzoVMState): void;
|
|
23
|
+
setProgramCounter(c: number): void;
|
|
24
|
+
tick(): any;
|
|
25
|
+
run(): void;
|
|
26
|
+
}
|