jfun.parsec
Class Expressions

java.lang.Object
  extended by jfun.parsec.Expressions

public final class Expressions
extends java.lang.Object

Expressions provides helper functions to build parser for a operator-precedence expression grammar.
It supports prefix unary, postfix unary, infix left associative binary, infix right associative binary and infix non-associative binary operators.

Author:
Ben Yu Nov 19, 2004

Constructor Summary
Expressions()
           
 
Method Summary
static
<E,T extends E>
Parser<E>
buildExpressionParser(Parser<T> term, OperatorTable<E> table)
          Creates a Parser object based on information described by OperatorTable.
static
<E,T extends E>
Parser<E>
buildExpressionParser(java.lang.String name, Parser<T> term, OperatorTable<E> table)
          Creates a Parser object based on information described by OperatorTable.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Expressions

public Expressions()
Method Detail

buildExpressionParser

public static <E,T extends E> Parser<E> buildExpressionParser(Parser<T> term,
                                                              OperatorTable<E> table)
Creates a Parser object based on information described by OperatorTable.

Parameters:
term - parser for the terminals.
table - the operator table.
Returns:
the expression parser.

buildExpressionParser

public static <E,T extends E> Parser<E> buildExpressionParser(java.lang.String name,
                                                              Parser<T> term,
                                                              OperatorTable<E> table)
Creates a Parser object based on information described by OperatorTable.

Parameters:
name - the name of the parser.
term - parser for the terminals.
table - the operator table.
Returns:
the expression parser.