Skip to content

Commit

Permalink
ski:build
Browse files Browse the repository at this point in the history
  • Loading branch information
todays-mitsui committed Jan 31, 2025
1 parent 7f40ec5 commit 9f331a0
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 27 deletions.
16 changes: 8 additions & 8 deletions ski3/pkg/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
export function parseCommand(input: string): Command;
export function parseExpr(input: string): Expr;
export function renderExpr(expr: Expr, displayStyle: DisplayStyle): string;
export function renderFunc(func: Func, displayStyle: DisplayStyle): string;
export function expand(context: Context, expr: Expr): Expr;
export function unlambdaRecursive(context: Context, expr: Expr): Expr;
export function unlambdaRecursive_(context: Context, expr: Expr): Expr;
export function unlambdaIota(context: Context, expr: Expr): Expr;
export function renderFunc(func: Func, displayStyle: DisplayStyle): string;
export function defaultContext(): Context;
export type Command = { type: "Delete"; identifier: string } | { type: "Update"; func: Func } | { type: "Reduce"; expr: Expr } | { type: "ReduceLast"; expr: Expr } | { type: "ReduceHead"; count: number; expr: Expr } | { type: "ReduceTail"; count: number; expr: Expr } | { type: "Query"; identifier: string } | { type: "Context" } | { type: "Unlambda"; level: number; expr: Expr };

Expand Down Expand Up @@ -41,18 +41,18 @@ export interface ReducibleRange {
args: ExprRange[];
}

export type Expr = { Variable: { identifier: string } } | { Symbol: { identifier: string } } | { Apply: { lhs: Expr; rhs: Expr } } | { Lambda: { param: string; body: Expr } };
export type Expr = { V: { i: string } } | { S: { i: string } } | { A: { l: Expr; r: Expr } } | { L: { p: string; b: Expr } };

export interface Func {
n: Identifier;
p: Identifier[];
b: Expr;
}

export type Aliases = Record<Identifier, Expr>;

export type DisplayStyle = "EcmaScript" | "LazyK";

export interface Func {
name: Identifier;
params: Identifier[];
body: Expr;
}

export type Context = Record<Identifier, Func>;

export type Identifier = string;
Expand Down
36 changes: 18 additions & 18 deletions ski3/pkg/index_bg.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,24 @@ export function renderExpr(expr, displayStyle) {
}
}

/**
* @param {Func} func
* @param {DisplayStyle} displayStyle
* @returns {string}
*/
export function renderFunc(func, displayStyle) {
let deferred1_0;
let deferred1_1;
try {
const ret = wasm.renderFunc(func, displayStyle);
deferred1_0 = ret[0];
deferred1_1 = ret[1];
return getStringFromWasm0(ret[0], ret[1]);
} finally {
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
}
}

/**
* @param {Context} context
* @param {Expr} expr
Expand Down Expand Up @@ -201,24 +219,6 @@ export function unlambdaIota(context, expr) {
return ret;
}

/**
* @param {Func} func
* @param {DisplayStyle} displayStyle
* @returns {string}
*/
export function renderFunc(func, displayStyle) {
let deferred1_0;
let deferred1_1;
try {
const ret = wasm.renderFunc(func, displayStyle);
deferred1_0 = ret[0];
deferred1_1 = ret[1];
return getStringFromWasm0(ret[0], ret[1]);
} finally {
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
}
}

/**
* @returns {Context}
*/
Expand Down
Binary file modified ski3/pkg/index_bg.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion ski3/pkg/index_bg.wasm.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ export const reducer_has_next: (a: number) => number;
export const reducer_next: (a: number) => [number, number, number];
export const parseExpr: (a: number, b: number) => [number, number, number];
export const renderExpr: (a: any, b: any) => [number, number];
export const renderFunc: (a: any, b: any) => [number, number];
export const expand: (a: any, b: any) => any;
export const unlambdaRecursive: (a: any, b: any) => any;
export const unlambdaRecursive_: (a: any, b: any) => any;
export const unlambdaIota: (a: any, b: any) => any;
export const renderFunc: (a: any, b: any) => [number, number];
export const defaultContext: () => any;
export const __wbindgen_exn_store: (a: number) => void;
export const __externref_table_alloc: () => number;
Expand Down

0 comments on commit 9f331a0

Please sign in to comment.