greybel-interpreter 4.5.13 → 4.6.0
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/dist/bytecode-generator/context.d.ts +22 -0
- package/dist/bytecode-generator/context.js +31 -0
- package/dist/bytecode-generator/expression.d.ts +24 -0
- package/dist/bytecode-generator/expression.js +640 -0
- package/dist/{byte-compiler → bytecode-generator}/instruction.d.ts +17 -19
- package/dist/{byte-compiler → bytecode-generator}/instruction.js +13 -12
- package/dist/bytecode-generator/line.d.ts +9 -0
- package/dist/bytecode-generator/line.js +2 -0
- package/dist/bytecode-generator/models.d.ts +42 -0
- package/dist/bytecode-generator/models.js +2 -0
- package/dist/bytecode-generator/module.d.ts +25 -0
- package/dist/bytecode-generator/module.js +72 -0
- package/dist/bytecode-generator/statement.d.ts +31 -0
- package/dist/bytecode-generator/statement.js +825 -0
- package/dist/bytecode-generator/utils.d.ts +5 -0
- package/dist/bytecode-generator/utils.js +30 -0
- package/dist/bytecode-generator.d.ts +3 -57
- package/dist/bytecode-generator.js +31 -1219
- package/dist/context.d.ts +5 -2
- package/dist/context.js +15 -13
- package/dist/index.d.ts +6 -2
- package/dist/index.js +10 -2
- package/dist/types/function.d.ts +1 -1
- package/dist/types/function.js +2 -2
- package/dist/types/map.js +10 -10
- package/dist/types/string.js +1 -1
- package/dist/utils/error.d.ts +1 -1
- package/dist/utils/hash.js +8 -14
- package/dist/utils/object-value.d.ts +1 -1
- package/dist/utils/object-value.js +9 -9
- package/dist/utils/stack.d.ts +1 -0
- package/dist/utils/stack.js +3 -0
- package/dist/utils/uuid.d.ts +2 -1
- package/dist/utils/uuid.js +5 -33
- package/dist/utils/value-hash.d.ts +2 -0
- package/dist/utils/value-hash.js +15 -0
- package/dist/vm/call.js +1 -1
- package/dist/vm.d.ts +1 -1
- package/dist/vm.js +36 -18
- package/package.json +4 -4
- /package/dist/{byte-compiler → bytecode-generator}/keywords.d.ts +0 -0
- /package/dist/{byte-compiler → bytecode-generator}/keywords.js +0 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { HandlerContainer } from '../handler-container';
|
|
2
|
+
import { Stack } from '../utils/stack';
|
|
3
|
+
import { Instruction } from './instruction';
|
|
4
|
+
import { Module } from './module';
|
|
5
|
+
export interface ContextOptions {
|
|
6
|
+
target: string;
|
|
7
|
+
handler: HandlerContainer;
|
|
8
|
+
debugMode?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export declare class Context {
|
|
11
|
+
private _target;
|
|
12
|
+
private _handler;
|
|
13
|
+
private _module;
|
|
14
|
+
private _debugMode;
|
|
15
|
+
private _imports;
|
|
16
|
+
constructor(options: ContextOptions);
|
|
17
|
+
get target(): Stack<string>;
|
|
18
|
+
get module(): Stack<Module>;
|
|
19
|
+
get handler(): HandlerContainer;
|
|
20
|
+
get imports(): Map<string, Instruction[]>;
|
|
21
|
+
isDebugMode(): boolean;
|
|
22
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Context = void 0;
|
|
4
|
+
const stack_1 = require("../utils/stack");
|
|
5
|
+
const module_1 = require("./module");
|
|
6
|
+
class Context {
|
|
7
|
+
constructor(options) {
|
|
8
|
+
var _a;
|
|
9
|
+
this._target = new stack_1.Stack(options.target);
|
|
10
|
+
this._module = new stack_1.Stack(new module_1.Module(options.target));
|
|
11
|
+
this._handler = options.handler;
|
|
12
|
+
this._imports = new Map();
|
|
13
|
+
this._debugMode = (_a = options.debugMode) !== null && _a !== void 0 ? _a : false;
|
|
14
|
+
}
|
|
15
|
+
get target() {
|
|
16
|
+
return this._target;
|
|
17
|
+
}
|
|
18
|
+
get module() {
|
|
19
|
+
return this._module;
|
|
20
|
+
}
|
|
21
|
+
get handler() {
|
|
22
|
+
return this._handler;
|
|
23
|
+
}
|
|
24
|
+
get imports() {
|
|
25
|
+
return this._imports;
|
|
26
|
+
}
|
|
27
|
+
isDebugMode() {
|
|
28
|
+
return this._debugMode;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
exports.Context = Context;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ASTFeatureEnvarExpression } from 'greybel-core';
|
|
2
|
+
import { ASTBase, ASTCallExpression, ASTEvaluationExpression, ASTFunctionStatement, ASTIdentifier, ASTIndexExpression, ASTListConstructorExpression, ASTLiteral, ASTMapConstructorExpression, ASTMemberExpression, ASTSliceExpression, ASTUnaryExpression } from 'miniscript-core';
|
|
3
|
+
import { Context } from './context';
|
|
4
|
+
import { LineCallableContext, LineContext, LineIdentifierContext } from './line';
|
|
5
|
+
import { IBytecodeExpressionGenerator, IBytecodeStatementGenerator, ParseCodeFunction } from './models';
|
|
6
|
+
export declare class BytecodeExpressionGenerator implements IBytecodeExpressionGenerator {
|
|
7
|
+
private context;
|
|
8
|
+
private stmtGenerator;
|
|
9
|
+
private parseCode;
|
|
10
|
+
constructor(context: Context, parseCodeFunction: ParseCodeFunction, stmtGenerator: IBytecodeStatementGenerator);
|
|
11
|
+
process(node: ASTBase, context?: LineContext): Promise<void>;
|
|
12
|
+
processMemberExpression(node: ASTMemberExpression, context?: LineCallableContext): Promise<void>;
|
|
13
|
+
processIndexExpression(node: ASTIndexExpression): Promise<void>;
|
|
14
|
+
processSliceExpression(node: ASTSliceExpression): Promise<void>;
|
|
15
|
+
processIdentifier(node: ASTIdentifier, context?: LineIdentifierContext): Promise<void>;
|
|
16
|
+
processLiteral(node: ASTLiteral): Promise<void>;
|
|
17
|
+
processEvaluationExpression(node: ASTEvaluationExpression): Promise<void>;
|
|
18
|
+
processMapConstructorExpression(node: ASTMapConstructorExpression): Promise<void>;
|
|
19
|
+
processListConstructorExpression(node: ASTListConstructorExpression): Promise<void>;
|
|
20
|
+
processFunctionDeclaration(node: ASTFunctionStatement, context?: LineContext): Promise<void>;
|
|
21
|
+
processUnaryExpression(node: ASTUnaryExpression): Promise<void>;
|
|
22
|
+
processCallExpression(node: ASTCallExpression): Promise<void>;
|
|
23
|
+
processEnvarExpression(node: ASTFeatureEnvarExpression): Promise<void>;
|
|
24
|
+
}
|