js-slang
Version:
Javascript-based implementations of Source, written in Typescript
46 lines (45 loc) • 1.93 kB
TypeScript
import * as es from 'estree';
import { List } from '../stdlib/list';
import { _Symbol } from '../alt-langs/scheme/scm-slang/src/stdlib/base';
import { SchemeNumber } from '../alt-langs/scheme/scm-slang/src/stdlib/core-math';
import { Context } from '..';
import { Control, Stash } from './interpreter';
export type SchemeControlItems = List | _Symbol | SchemeNumber | boolean | string;
/**
* A metaprocedure used to detect for the apply function object.
* If the interpreter sees this specific function,
* it will take all of the operands, and apply the second to second last operands as well as the last operand (must be a list)
* to the first operand (which must be a function).
*/
export declare class Apply extends Function {
private static instance;
private constructor();
static get(): Apply;
toString(): string;
}
export declare const cset_apply: Apply;
export declare function isApply(value: any): boolean;
/**
* A metaprocedure used to detect for the eval function object.
* If the interpreter sees this specific function,
* it will transfer its operand to the control component.
*/
export declare class Eval extends Function {
private static instance;
private constructor();
static get(): Eval;
toString(): string;
}
export declare const cset_eval: Eval;
export declare function isEval(value: any): boolean;
export declare function schemeEval(command: SchemeControlItems, context: Context, control: Control, stash: Stash, isPrelude: boolean): undefined;
export declare function makeDummyIdentifierNode(name: string): es.Identifier;
/**
* Convert a scheme expression (that is meant to be evaluated)
* into an estree expression, using eval.
* this will let us avoid the "hack" of storing Scheme lists
* in estree nodes.
* @param expression
* @returns estree expression
*/
export declare function convertToEvalExpression(expression: SchemeControlItems): es.CallExpression;