diff options
author | Lizzy Hunt <elizabeth.hunt@simponic.xyz> | 2024-03-09 21:51:22 -0700 |
---|---|---|
committer | Lizzy Hunt <elizabeth.hunt@simponic.xyz> | 2024-03-09 21:51:22 -0700 |
commit | 42838864af3503f85cabc5dbd73b98a64d20cded (patch) | |
tree | 48dd75f0b9fcdc1fb8ec6db5ac2bec0a36b9afe7 /src/interpreter/interpreter.ts | |
parent | ce403459fa82025bd969d1938ed4034a10c2e751 (diff) | |
download | the-abstraction-engine-42838864af3503f85cabc5dbd73b98a64d20cded.tar.gz the-abstraction-engine-42838864af3503f85cabc5dbd73b98a64d20cded.zip |
prettier
Diffstat (limited to 'src/interpreter/interpreter.ts')
-rw-r--r-- | src/interpreter/interpreter.ts | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/interpreter/interpreter.ts b/src/interpreter/interpreter.ts index 4599c46..c546bd2 100644 --- a/src/interpreter/interpreter.ts +++ b/src/interpreter/interpreter.ts @@ -32,7 +32,7 @@ export type DebrujinifiedLambdaTerm = export const debrujinify = ( term: LambdaTerm, - symbolTable: SymbolTable, + symbolTable: SymbolTable ): DebrujinifiedLambdaTerm => { if (isVariable(term)) { if (!symbolTable.has(term)) { @@ -65,14 +65,14 @@ export const debrujinify = ( } throw new InvalidLambdaTermError( - `Invalid lambda term: ${JSON.stringify(term)}`, + `Invalid lambda term: ${JSON.stringify(term)}` ); }; export const substitute = ( inTerm: DebrujinifiedLambdaTerm, index: number, - withTerm: DebrujinifiedLambdaTerm, + withTerm: DebrujinifiedLambdaTerm ): DebrujinifiedLambdaTerm => { if ("index" in inTerm) { if (inTerm.index > index) { @@ -108,13 +108,13 @@ export const substitute = ( } throw new InvalidLambdaTermError( - `Invalid lambda term: ${JSON.stringify(inTerm)}`, + `Invalid lambda term: ${JSON.stringify(inTerm)}` ); }; export const adjustIndices = ( term: DebrujinifiedLambdaTerm, - delta: number, + delta: number ): DebrujinifiedLambdaTerm => { if ("index" in term) { return { @@ -146,12 +146,12 @@ export const adjustIndices = ( } throw new InvalidLambdaTermError( - `Invalid lambda term: ${JSON.stringify(term)}`, + `Invalid lambda term: ${JSON.stringify(term)}` ); }; export const betaReduce = ( - term: DebrujinifiedLambdaTerm, + term: DebrujinifiedLambdaTerm ): DebrujinifiedLambdaTerm => { if ("index" in term) { return term; @@ -194,7 +194,7 @@ export const betaReduce = ( } throw new InvalidLambdaTermError( - `Invalid lambda term: ${JSON.stringify(term)}`, + `Invalid lambda term: ${JSON.stringify(term)}` ); }; @@ -214,7 +214,7 @@ export const emitDebrujin = (term: DebrujinifiedLambdaTerm): string => { } throw new InvalidLambdaTermError( - `Invalid lambda term: ${JSON.stringify(term)}`, + `Invalid lambda term: ${JSON.stringify(term)}` ); }; @@ -225,7 +225,7 @@ export const emitNamed = (term: DebrujinifiedLambdaTerm): string => { if ("abstraction" in term) { return `(λ (${term.abstraction.param}) . ${emitNamed( - term.abstraction.body, + term.abstraction.body )})`; } @@ -241,7 +241,7 @@ export const emitNamed = (term: DebrujinifiedLambdaTerm): string => { export const interpret = ( term: string, symbolTable = new SymbolTable(), - allowUnderscores = false, + allowUnderscores = false ): DebrujinifiedLambdaTerm => { const ast = parse(term, allowUnderscores); const debrujined = debrujinify(ast, symbolTable); |