package pp.s1184725.boppi;

import java.util.Stack;

import org.antlr.v4.runtime.tree.ParseTreeProperty;

import pp.iloc.model.Reg;
import pp.s1184725.boppi.type.*;

/**
 * This class holds properties of all AST nodes during compilation.
 * 
 * @author Frank Wibbelink
 */
public class Annotations {
	/**
	 * Maps nodes to registers.
	 */
	public ParseTreeProperty<Reg> registers;
	/**
	 * Maps nodes to {@link Type}s.
	 */
	public ParseTreeProperty<Type> types;
	/**
	 * Maps nodes to {@link Variable}s.
	 */
	public ParseTreeProperty<Variable<Type>> variables;
	/**
	 * Maps nodes to their function scope.
	 */
	public ParseTreeProperty<Variable<Type>> function;
	/**
	 * A stack with the current function scope on top.
	 */
	public Stack<Variable<Type>> currentFunction;
	/**
	 * A symbol table
	 */
	public CachingSymbolTable<Type> symbols;

	/**
	 * Creates a new annotations object with empty maps.
	 */
	public Annotations() {
		registers = new ParseTreeProperty<>();
		types = new ParseTreeProperty<>();
		function = new ParseTreeProperty<>();
		variables = new ParseTreeProperty<>();
		currentFunction = new Stack<>();
		symbols = new CachingSymbolTable<>();
	}
}
