@tsukiroku/tiny
Version:
Tiny interpreter
48 lines (47 loc) • 1.69 kB
TypeScript
import * as Tiny from '../../index';
export declare const NULL: Tiny.LangObject;
export declare const UNDEFINED: Tiny.LangObject;
export interface EvaluatorOptions extends Tiny.Options {
stdio: Record<'stdin' | 'stdout' | 'stderr', Tiny.Stdio>;
filename: string;
root: string;
}
export default class Evaluator {
program: Tiny.Program;
enviroment: Tiny.Enviroment;
option: EvaluatorOptions;
messages: Tiny.Errors;
constructor(program: Tiny.Program, enviroment: Tiny.Enviroment, option: EvaluatorOptions);
eval(): Tiny.LangObject;
private evalStatements;
private evalBlockStatements;
private evalStatement;
private evalExpression;
importEnv(path: string, enviroment: Tiny.Enviroment, evaluator: Evaluator, position: Tiny.Position): Tiny.LangObject;
private evalFunction;
private evalCallExpression;
private evalObjectParameters;
private evalExpressions;
private getDecorator;
applyFunction(functionObject: Tiny.FunctionObject, name: string, parameters: Array<Tiny.LangObject>, enviroment: Tiny.Enviroment, position: Tiny.Position, thisObject: Tiny.LangObject): Tiny.LangObject;
private extendFunctionEnv;
private evalIdent;
private evalLiteral;
private evalPrefix;
private evalInfix;
private typeMissmatch;
private evalNumberInfix;
private evalBooleanInfix;
private evalStringInfix;
private evalObjectInfix;
private evalArrayInfix;
private evalIdentInfix;
private evalElementInfix;
private evalInOperator;
private evalIfExpression;
private evalIndex;
private evalArrayIndex;
private isTruthy;
private evalBang;
private evalMinus;
}