-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
24029b0
commit 7b65e38
Showing
11 changed files
with
158 additions
and
147 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package moonbitlang/minimbt/closure_eval | ||
|
||
alias @moonbitlang/core/immut/hashmap as @hashmap | ||
alias @moonbitlang/minimbt as @minimbt | ||
alias @moonbitlang/minimbt/closure as @closure | ||
|
||
// Values | ||
|
||
// Types and methods | ||
type ClosureInterpreter | ||
impl ClosureInterpreter { | ||
add_extern_fn(Self, String, (Array[Value]) -> Value) -> Unit | ||
eval(Self, @hashmap.T[@minimbt.Name, Value], @closure.Expr) -> Value!Failure | ||
eval_fn(Self, @closure.FuncDef, Array[Value], Array[Value]) -> Value!Failure | ||
eval_full(Self, @closure.Program) -> Value!Failure | ||
new() -> Self | ||
} | ||
|
||
pub(all) enum Value { | ||
Unit | ||
Int(Int) | ||
Double(Double) | ||
Tuple(Array[Value]) | ||
Array(Array[Value]) | ||
ExternFn(String) | ||
Closure(@closure.FuncDef, Array[Value]) | ||
} | ||
impl Value { | ||
op_equal(Self, Self) -> Bool | ||
} | ||
impl Show for Value | ||
|
||
// Type aliases | ||
pub typealias InterpreterLocalVars = @hashmap.T[@minimbt.Name, Value] | ||
|
||
pub typealias Name = @minimbt.Name | ||
|
||
// Traits | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,5 +8,3 @@ package moonbitlang/minimbt/lex | |
|
||
// Traits | ||
|
||
// Extension Methods | ||
|
Oops, something went wrong.