package table;

import java.util.HashMap;

import sexpression.SExpression;

public class SymbolTable {

    private HashMap<String, SExpression> table;
    private SymbolTable parent;

    public SymbolTable() {
        this(null);
    }

    public SymbolTable(SymbolTable parent) {
        this.table = new HashMap<String, SExpression>();
        this.parent = parent;
    }

    public boolean contains(String symbolName) {
        return table.containsKey(symbolName);
    }

    public SExpression get(String symbolName) {
        return table.get(symbolName);
    }

    public void put(String symbolName, SExpression value) {
        table.put(symbolName, value);
    }

    public SymbolTable getParent() {
        return parent;
    }

}
