com.singularsys.jep.configurableparser
Class ShuntingYard

java.lang.Object
  extended by com.singularsys.jep.configurableparser.ShuntingYard
All Implemented Interfaces:
GrammarParser

public class ShuntingYard
extends java.lang.Object
implements GrammarParser

An operator precedence parser based on the shunting yard algorithm. TODO fix -1^2==-1 power should bind tighter than uminus.


Field Summary
protected static boolean DUMP
           
protected  Lookahead2Iterator<Token> it
           
protected  Jep jep
           
protected  java.util.List<GrammarMatcher> matchers
           
protected  java.util.Stack<Node> nodes
           
protected  java.util.Stack<Operator> ops
           
protected static Operator sentinel
           
 
Method Summary
protected  void dumpState(java.lang.String msg)
           
 Node parse(java.util.Iterator<Token> input)
           
 Node parseSubExpression()
          Callback function used by GrammerMatchers
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DUMP

protected static final boolean DUMP
See Also:
Constant Field Values

ops

protected java.util.Stack<Operator> ops

nodes

protected java.util.Stack<Node> nodes

it

protected Lookahead2Iterator<Token> it

matchers

protected java.util.List<GrammarMatcher> matchers

jep

protected Jep jep

sentinel

protected static Operator sentinel
Method Detail

parse

public Node parse(java.util.Iterator<Token> input)
           throws ParseException
Throws:
ParseException

parseSubExpression

public Node parseSubExpression()
                        throws ParseException
Callback function used by GrammerMatchers

Specified by:
parseSubExpression in interface GrammarParser
Returns:
the root node of the matched sub expression.
Throws:
ParseException

dumpState

protected void dumpState(java.lang.String msg)


Copyright © 2007 Singular Systems http://www.singularsys.com/jep