package pp.s1184725.boppi;

import java.util.Stack;

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

import pp.iloc.model.Reg;

/**
 * This class holds properties of all AST nodes during compilation.
 *
 */
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;

	/**
	 * 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<>();
	}
}
