aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/zwobble/couscous/interpreter/Environment.java
blob: a3b3871ff4082c5d9315b406ebaf1ca1ccdedb81 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
package org.zwobble.couscous.interpreter;

import java.util.HashMap;
import java.util.Map;

import org.zwobble.couscous.values.InterpreterValue;

public class Environment {
    private Map<Integer, InterpreterValue> stackFrame;

    public Environment(Map<Integer, InterpreterValue> stackFrame) {
        this.stackFrame = new HashMap<>(stackFrame);
    }

    public InterpreterValue get(int referentId) {
        return stackFrame.get(referentId);
    }

    public void put(int referentId, InterpreterValue value) {
        stackFrame.put(referentId, value);
    }
}