/* * Exp.java 1.0 2006-02-14 * * Copyright (C) 2006 by Ifi, UiO */ import antlr.collections.AST; /** * Simple AST class for an expression. * * @version $Revision:$ * @author Sven-Jørgen Karlsen * @since 1.0 */ public interface Exp extends AST { // Cumbersom hack to avoid collision with Antlr AST libraries's toString() // abuse. public String toLispString(); public enum Operator { PLUS("+"), MINUS("-"), MULT("*"), DIV("/"); private final String strValue; Operator(String value) { this.strValue = value; } public String toString() { return strValue; } public static Operator fromString(String strValue) { for (Operator op : Operator.values()) { if (op.strValue.equals(strValue)) { return op; } } return null; } } } /* Exp.java ends here */