byucc.jhdl.base.genericparser
Class exprParser

java.lang.Object
  extended bybyucc.jhdl.base.genericparser.exprParser
All Implemented Interfaces:
exprParserConstants

public class exprParser
extends java.lang.Object
implements exprParserConstants

This class provides the ability to parse a string describing a parameterized width. There is typical order of operation support, with parenthesis, then exponentiation (**), followed by multiplication/division (*, /), and addition/subtraction (+, -). Any string in the expression must be a parameter bound to an integer value.

Author:
Brent Nelson

Field Summary
static Token jj_nt
           
static boolean lookingAhead
           
static Token token
           
static exprParserTokenManager token_source
           
 
Fields inherited from interface byucc.jhdl.base.genericparser.exprParserConstants
CONSTANT, DEFAULT, DIGIT, DIVIDE, EOF, EOL, EXP, ID, LETTER, MINUS, MULTIPLY, PLUS, tokenImage
 
Constructor Summary
exprParser(exprParserTokenManager tm)
           
exprParser(java.io.InputStream stream)
           
exprParser(java.io.Reader stream)
           
 
Method Summary
static int computePortWidth(java.lang.String portwidth, Bindings binding_values)
          Do the port width computation.
static int[] computePortWidths(java.lang.String[] portwidths, Bindings binding_values, boolean evaluate)
          Do the port width computation.
static void disable_tracing()
           
static void element()
           
static void enable_tracing()
           
static void exp()
           
static ParseException generateParseException()
           
static Token getNextToken()
           
static Token getToken(int index)
           
static void one_line()
           
 void ReInit(exprParserTokenManager tm)
           
static void ReInit(java.io.InputStream stream)
           
static void ReInit(java.io.Reader stream)
           
static void sum()
           
static void term()
           
static void unary()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

token_source

public static exprParserTokenManager token_source

token

public static Token token

jj_nt

public static Token jj_nt

lookingAhead

public static boolean lookingAhead
Constructor Detail

exprParser

public exprParser(java.io.InputStream stream)

exprParser

public exprParser(java.io.Reader stream)

exprParser

public exprParser(exprParserTokenManager tm)
Method Detail

computePortWidths

public static int[] computePortWidths(java.lang.String[] portwidths,
                                      Bindings binding_values,
                                      boolean evaluate)
Do the port width computation. If evaluate is true, it will substitute the integer values for bindings, and throw an exception if a binding is not defined. If evaluate is false, the method will simply check that the syntax is legal.

Parameters:
portwidths - the list of strings to evaluate
binding_values - any bindings that are referenced in the widths
evaluate - whether to just check syntax (false) or evaluate (true)
Returns:
an array of integer widths, matching the input array
Throws:
UnboundException - if a binding is referenced but not bound
TypeException - if a binding is not an integer type
ParseException - if there is a parsing problem

computePortWidth

public static int computePortWidth(java.lang.String portwidth,
                                   Bindings binding_values)
Do the port width computation.

Parameters:
portwidth - the string to evaluate
binding_values - any bindings that are referenced in the widths
Returns:
an array of integer widths, matching the input array
Throws:
UnboundException - if a binding is referenced but not bound
TypeException - if a binding is not an integer type
ParseException - if there is a parsing problem

one_line

public static final void one_line()
                           throws ParseException
Throws:
ParseException

sum

public static final void sum()
                      throws ParseException
Throws:
ParseException

term

public static final void term()
                       throws ParseException
Throws:
ParseException

exp

public static final void exp()
                      throws ParseException
Throws:
ParseException

unary

public static final void unary()
                        throws ParseException
Throws:
ParseException

element

public static final void element()
                          throws ParseException
Throws:
ParseException

ReInit

public static void ReInit(java.io.InputStream stream)

ReInit

public static void ReInit(java.io.Reader stream)

ReInit

public void ReInit(exprParserTokenManager tm)

getNextToken

public static final Token getNextToken()

getToken

public static final Token getToken(int index)

generateParseException

public static final ParseException generateParseException()

enable_tracing

public static final void enable_tracing()

disable_tracing

public static final void disable_tracing()


Copyright ? 2006 Brigham Young University, Configurable Computing Laboratory. All Rights Reserved.