Class ExprReducer
- java.lang.Object
-
- ru.ispras.microtesk.translator.nml.antlrex.ExprReducer
-
public final class ExprReducer extends java.lang.Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ExprReducer.Reduced
Class for holding a reduced expression that is represented by the formula: constant + polynomial, where constant is a constant integer value and polynomial is expression that cannot be reduced any further.
-
Constructor Summary
Constructors Constructor Description ExprReducer()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static ExprReducer.Reduced
reduce(Expr expr)
Transforms the expression to the format: polynomial + constant, where polynomial is some expression that could not be further simplified and constant is an integer constant value.
-
-
-
Method Detail
-
reduce
public static ExprReducer.Reduced reduce(Expr expr)
Transforms the expression to the format: polynomial + constant, where polynomial is some expression that could not be further simplified and constant is an integer constant value. Generally speaking, the transformation algorithm extracts all expressions that can be statically calculated from the given expression and places their calculated value to the constant field. The remaining part of the expression is placed in the polynomial field.- Parameters:
expr
- Expression to be reduced.- Returns:
- A reduced expression.
-
-