Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Monadish" refactoring of interpreter #721

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions src/constEval.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,13 @@ import {
import { ExpressionTransformer } from "./optimizer/types";
import { StandardOptimizer } from "./optimizer/standardOptimizer";
import {
Interpreter,
ensureInt,
evalBinaryOp,
evalUnaryOp,
throwNonFatalErrorConstEval,
} from "./interpreter";
StandardSemantics,
} from "./interpreterSemantics/standardSemantics";
import { Interpreter } from "./interpreter";
import { throwNonFatalErrorConstEval } from "./interpreterSemantics/util";

// The optimizer that applies the rewriting rules during partial evaluation.
// For the moment we use an optimizer that respects overflows.
Expand Down Expand Up @@ -86,7 +87,7 @@ export function evalConstantExpression(
ast: AstExpression,
ctx: CompilerContext,
): Value {
const interpreter = new Interpreter(ctx);
const interpreter = new Interpreter(new StandardSemantics(ctx));
const result = interpreter.interpretExpression(ast);
return result;
}
Expand All @@ -95,7 +96,7 @@ export function partiallyEvalExpression(
ast: AstExpression,
ctx: CompilerContext,
): AstExpression {
const interpreter = new Interpreter(ctx);
const interpreter = new Interpreter(new StandardSemantics(ctx));
switch (ast.kind) {
case "id":
try {
Expand Down
Loading
Loading