Package edu.wisc.game.parser
Interface Expression
-
- All Known Subinterfaces:
Expression.ArithmeticExpression
- All Known Implementing Classes:
Expression.AdditiveExpression,Expression.BracketList,Expression.ColonExpression,Expression.EqualityExpression,Expression.ExList,Expression.Id,Expression.MultiplicativeExpression,Expression.NegationExpression,Expression.Num,Expression.ParenList,Expression.QualifiedId,Expression.RangeExpression,Expression.SerialExpression,Expression.Star
public interface Expression
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classExpression.AdditiveExpressionstatic interfaceExpression.ArithmeticExpressionAn arithmetic expression is composed of variables, constants, and arithmetic operations; parentheses can be used for ordering operations.static classExpression.BracketListstatic classExpression.ColonExpressionId:ArithmeticExpression; used in GS 3static classExpression.EqualityExpressionHas exactly two operands, and the operator is '=='static classExpression.ExListCan be overridden as neededstatic classExpression.IdA variable.static classExpression.MultiplicativeExpressionstatic classExpression.NegationExpression!E evaluates to [1] if E is an empty set, or to [] otherwisestatic classExpression.NumA numeric constantstatic classExpression.ParenListstatic classExpression.QualifiedIdA.Bstatic classExpression.RangeExpression[Num..Num]static classExpression.SerialExpressionAdditive or multiplicativestatic classExpression.StarA Star expression is simply "*".
-
Field Summary
Fields Modifier and Type Field Description static Expression.StarSTAR
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description static Expression.BracketListmkBracketList(Vector<Token> tokens)static ExpressionmkCounterOrAtom(Vector<Token> tokens)Extracts one of the sections of a rule line: either the leading counter (int or star), or one of the atoms (paren lists that may include arithmetic expressions or stars)static Expression.ArithmeticExpressionmkLongestArithmeticExpression(Vector<Token> tokens)Creates the longest ArithmeticExpression starting at the beginning of the tokens array.static Expression.ArithmeticExpressionmkLongestE1(Vector<Token> tokens)E1 := (E) | Id.Id | Id | Num | [E,E,...]static HashSet<Integer>moduloNB(Set<Integer> h0)Translates all elements of the set to the [0..NBU-1] range, as appropriate for bucket numbersStringtoSrc()
-
-
-
Field Detail
-
STAR
static final Expression.Star STAR
-
-
Method Detail
-
toSrc
String toSrc()
-
mkCounterOrAtom
static Expression mkCounterOrAtom(Vector<Token> tokens) throws RuleParseException
Extracts one of the sections of a rule line: either the leading counter (int or star), or one of the atoms (paren lists that may include arithmetic expressions or stars)- Throws:
RuleParseException
-
mkLongestArithmeticExpression
static Expression.ArithmeticExpression mkLongestArithmeticExpression(Vector<Token> tokens) throws RuleParseException
Creates the longest ArithmeticExpression starting at the beginning of the tokens array.E := E5 E5 := E4 | E4==E4 E4 := E3 | E3+E3+... E3 := E2 | E2*E2... E2 := E1 | !E2 E1 := (E) | Id.Id | Id | Num | [E4,E4,...]- Throws:
RuleParseException
-
mkLongestE1
static Expression.ArithmeticExpression mkLongestE1(Vector<Token> tokens) throws RuleParseException
E1 := (E) | Id.Id | Id | Num | [E,E,...]- Throws:
RuleParseException
-
mkBracketList
static Expression.BracketList mkBracketList(Vector<Token> tokens) throws RuleParseException
- Throws:
RuleParseException
-
-