/* * Name: Mike Cifelli * Course: CIS 443 - Programming Languages * Assignment: Lisp Parser */ package parser; /** * This is the base class for memory in the PL-Lisp implementation. */ public class SExpression { // for mark and sweep garbage collection private boolean marked = false; /** * Determine if this SExpression is marked. * * @return * true if this SExpression is marked; * false otherwise */ public final boolean isMarked() { return marked; } /** * Set the marked status of this S-expression to the specified value. * * @param value * the value to assign to this S-expression's marked status */ public final void setMarked(final boolean value) { marked = value; } // Lisp type predicates; // by default, all return false (an SExpression effectively has NO type); // overridden in subclasses to describe their Lisp type /** * Test if this S-expression is NULL. * * @return * false */ public boolean nullp() { return false; } /** * Test if this S-expression is an ATOM. * * @return * false */ public boolean atomp() { return false; } /** * Test if this S-expression is a CONS cell. * * @return * false */ public boolean consp() { return false; } /** * Test if this S-expression is a LIST. * * @return * the value of (consp() || nullp()) */ public boolean listp() { return (consp() || nullp()); } /** * Test if this S-expression is a NUMBER. * * @return * false */ public boolean numberp() { return false; } /** * Test if this S-expression is a SYMBOL. * * @return * false */ public boolean symbolp() { return false; } /** * Test if this S-expression is a FUNCTION. * * @return * false */ public boolean functionp() { return false; } /** * Test if this S-expression is a STRING. * * @return * false */ public boolean stringp() { return false; } }