UNPKG

@thi.ng/pointfree-lang

Version:

Forth style syntax layer/compiler & CLI for the @thi.ng/pointfree DSL

73 lines 2.4 kB
import type { IObjectOf } from "@thi.ng/api"; import * as pf from "@thi.ng/pointfree"; /** * Main user function. Takes a string w/ DSL source code and optional env and * stack. Prepares env using `ensureEnv`, parses, compiles and executes source, * then returns resulting * [`StackContext`](https://docs.thi.ng/umbrella/pointfree/interfaces/StackContext.html) * tuple. * * @param src - * @param env - * @param stack - */ export declare const run: (src: string, env?: pf.StackEnv, stack?: pf.Stack) => pf.StackContext; /** * Like {@link run}, but returns unwrapped value(s) from result data stack. * * @param src - * @param env - * @param stack - * @param n - */ export declare const runU: (src: string, env?: pf.StackEnv, stack?: pf.Stack, n?: number) => any; /** * Like {@link run}, but returns resulting env object only. * * @param src - * @param env - * @param stack - */ export declare const runE: (src: string, env?: pf.StackEnv, stack?: pf.Stack) => any; /** * Executes word with given name, defined in supplied `env` object and with * given optional initial stack. Returns resulting * [`StackContext`](https://docs.thi.ng/umbrella/pointfree/interfaces/StackContext.html) * tuple. * * @param id - * @param env - * @param stack - */ export declare const runWord: (id: string, env: pf.StackEnv, stack?: pf.Stack) => pf.StackContext; /** * Like {@link runWord}, but returns unwrapped value(s) from result data * stack. * * @param id - * @param env - * @param stack - * @param n - */ export declare const runWordU: (id: string, env: pf.StackEnv, stack?: pf.Stack, n?: number) => any; /** * Like {@link runWord}, but returns resulting env object only. * * @param id - * @param env - * @param stack - */ export declare const runWordE: (id: string, env: pf.StackEnv, stack?: pf.Stack) => any; /** * Takes an environment object and injects given custom word definitions. * `words` is an object with keys representing word names * and their values [`StackFn`](https://docs.thi.ng/umbrella/pointfree/types/StackFn.html)s. See * [`thi.ng/pointfree`](https://thi.ng/pointfree) package * for more details about stack functions. * * @param env - * @param words - */ export declare const ffi: (env: any, words: IObjectOf<pf.StackFn>) => any; export { ensureStack, ensureStackN, unwrap } from "@thi.ng/pointfree"; //# sourceMappingURL=runtime.d.ts.map