slogo.language
Class GrammarElement

java.lang.Object
  extended by slogo.language.GrammarElement
Direct Known Subclasses:
Expression, Instruction

public abstract class GrammarElement
extends java.lang.Object

All elements of the elan language (e.g., that make up an abstract syntax tree) should extend GrammarElement. Evaluating a language construct with a context returns the value of the evaluation and may have side-effects.


Field Summary
protected static java.util.Map<GrammarElement,java.lang.Object> gelementsToValue
           
 
Constructor Summary
GrammarElement()
           
 
Method Summary
abstract  java.lang.Object evaluate(Context c)
          Evaluate this language construct in some context.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

gelementsToValue

protected static java.util.Map<GrammarElement,java.lang.Object> gelementsToValue
Constructor Detail

GrammarElement

public GrammarElement()
Method Detail

evaluate

public abstract java.lang.Object evaluate(Context c)
Evaluate this language construct in some context. The evaluation may have side-effects, e.g., moving a turtle.

Parameters:
c - context in which the evaluation takes place
Returns:
the result of evaluating the construct