package ast;

/**
 * Abstract base class for all expression nodes in the abstract syntax tree (AST).
 *
 * @author s-yamagiwa
 */
public abstract class Expression extends ASTNode {
	/**
	 * Replace {@code variable} with {@code expression} in AST.
	 *
	 * @param variable   The variable to be replaced
	 * @param expression The expression that {@code variable} is replaced to
	 * @return A duplicated expression that is replaced with a given {@code expression}
	 * @implNote The instance of any member must be immutable
	 * @apiNote All variables match to the given one will be replaced with the given {@code expression}
	 */
	public abstract Expression replace(Variable variable, Expression expression);
}
