@thi.ng/lispy
Version:
Lightweight, extensible, interpreted Lisp-style DSL for embedding in other projects
27 lines • 1.19 kB
TypeScript
import type { ASTNode, SyntaxOpts } from "@thi.ng/sexpr";
export type Env = Record<string, any>;
/**
* DSL built-ins as multi-method which directly operates on AST nodes. For
* userland extensions of the core language, it's likely more straightforward to
* define new constants/functions in {@link ENV}.
*/
export declare const BUILTINS: import("@thi.ng/defmulti").MultiFn2<ASTNode[], Env, any>;
/**
* Root environment bindings. This is the default env used by {@link evalSource}
* and can be used to define extensions of the core language. Functions defined
* here can receive any number of arguments.
*/
export declare const ENV: Env;
/**
* Parses & evaluates given S-expression(s) and returns result of last one. If
* no environment is provided, uses {@link ENV}. Furthermore, `opts` can be used
* to customize the syntax rules for parsing.
*
* @param src
* @param env
* @param opts
*/
export declare const evalSource: (src: string, env?: Env, opts?: Partial<SyntaxOpts>) => any;
export declare const evalArgs: (nodes: ASTNode[], env?: Env) => any[];
export declare const interpret: import("@thi.ng/defmulti").MultiFn2<ASTNode, Env, any>;
//# sourceMappingURL=index.d.ts.map