jfun.parsec

Class Expressions

public final class Expressions extends 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

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(String name, Parser<T> term, OperatorTable<E> table)
Creates a Parser object based on information described by OperatorTable.

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(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.