UNPKG

toylang

Version:

A toy programming language built with TypeScript for learning purposes

32 lines (31 loc) 1.04 kB
import { Interpreter } from "./Interpreter"; import { Environment } from "./Environment"; declare type CallableFunctionCreatorProps = { call: (...arg0: any[]) => any; arity: number; toString: (...args: any[]) => string; }; export interface AbstractCallable { call(interpreter: Interpreter, args: any[]): void; arity(...args: any[]): number; toString(...args: any[]): string; } export declare class CallableFunction implements AbstractCallable { call(interpreter: Interpreter, args: any[]): void; arity(): number; toString(): string; static new(obj: CallableFunctionCreatorProps): { call(...args: any[]): any; arity(): number; toString(...args: any[]): void; }; } export declare class ToyLangFunction extends CallableFunction { declaration: any; closure: Environment; constructor(declaration: any, closure: Environment); call(interpreter: Interpreter, args: any[]): any; arity(): any; toString(): string; } export {};