summaryrefslogtreecommitdiff
path: root/src/interpreter
diff options
context:
space:
mode:
Diffstat (limited to 'src/interpreter')
-rw-r--r--src/interpreter/PeggyParser.js10
-rw-r--r--src/interpreter/interpreter.ts22
-rw-r--r--src/interpreter/parser.ts2
3 files changed, 17 insertions, 17 deletions
diff --git a/src/interpreter/PeggyParser.js b/src/interpreter/PeggyParser.js
index f5376b3..363f60b 100644
--- a/src/interpreter/PeggyParser.js
+++ b/src/interpreter/PeggyParser.js
@@ -226,7 +226,7 @@ export default (function () {
["0", "9"],
],
false,
- false
+ false,
);
var peg$e1 = peg$literalExpectation("(", false);
var peg$e2 = peg$literalExpectation(")", false);
@@ -260,7 +260,7 @@ export default (function () {
if (options.startRule) {
if (!(options.startRule in peg$startRuleFunctions)) {
throw new Error(
- "Can't start parsing from rule \"" + options.startRule + '".'
+ "Can't start parsing from rule \"" + options.startRule + '".',
);
}
@@ -296,7 +296,7 @@ export default (function () {
throw peg$buildStructuredError(
[peg$otherExpectation(description)],
input.substring(peg$savedPos, peg$currPos),
- location
+ location,
);
}
@@ -417,7 +417,7 @@ export default (function () {
peg$SyntaxError.buildMessage(expected, found),
expected,
found,
- location
+ location,
);
}
@@ -883,7 +883,7 @@ export default (function () {
peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null,
peg$maxFailPos < input.length
? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1)
- : peg$computeLocation(peg$maxFailPos, peg$maxFailPos)
+ : peg$computeLocation(peg$maxFailPos, peg$maxFailPos),
);
}
}
diff --git a/src/interpreter/interpreter.ts b/src/interpreter/interpreter.ts
index c546bd2..4599c46 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);
diff --git a/src/interpreter/parser.ts b/src/interpreter/parser.ts
index 930b953..99a9038 100644
--- a/src/interpreter/parser.ts
+++ b/src/interpreter/parser.ts
@@ -33,7 +33,7 @@ export const isVariable = (term: LambdaTerm): term is Variable => {
export const parse = (
term: string,
allowUnderscores = false,
- library = false
+ library = false,
) => {
return peggyParser.parse(term, { peg$library: library, allowUnderscores });
};