blob: 58b9ba44876d3b10be4af7a8ba6e04c9762a37e2 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
package coffee.liz.lambda.eval;
import coffee.liz.lambda.ast.Expression;
/**
* Represents a runtime value produced by evaluation.
*/
public sealed interface Value permits Value.Closure, Value.Application, Value.Free {
/**
* A closure capturing an environment, parameter, and body.
*
* @param env
* the captured environment
* @param parameter
* the bound parameter name
* @param body
* the lambda body expression
*/
record Closure(Environment env, String parameter, Expression body) implements Value {
}
/**
* A symbolic application of a function to an argument.
*
* @param function
* the function
* @param argument
* the argument
*/
record Application(Value function, Value argument) implements Value {
}
/**
* A free variable.
*
* @param name
* the variable name
*/
record Free(String name) implements Value {
}
}
|