org.statcato.calculator
Class MathExpParserComplete
- java.lang.Object
-
- org.statcato.calculator.MathExpParserComplete
-
public class MathExpParserComplete extends java.lang.ObjectA parser for mathematical expressions using the recurive descent algorithm. Acceptable expressions are defined by the following grammar:E -> T { ("+" | "-") T}
T -> F { ("*" | "/") F}
F -> P {"^" F}
P -> v | "(" E ")" | "-" T | func_name"(" E ")" | Cx | "'" L "'"
L -> column_label
where expressions enclosed by { } can appear zero or more times.
- Since:
- 1.0
-
-
Constructor Summary
Constructors Constructor and Description MathExpParserComplete(Spreadsheet sp)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description java.lang.StringgetError()Returns error message from the scanner.CompUnitparse(java.lang.String exp, boolean isRadian)Parses the given expression.CompUnitS()Parses a statement.
-
-
-
Constructor Detail
-
MathExpParserComplete
public MathExpParserComplete(Spreadsheet sp)
-
-
Method Detail
-
parse
public CompUnit parse(java.lang.String exp, boolean isRadian)
Parses the given expression.- Parameters:
exp- expression in stringisRadian- boolean value of whether radians are used
-
getError
public java.lang.String getError()
Returns error message from the scanner.- Returns:
- error string
-
S
public CompUnit S()
Parses a statement. S->E- Returns:
- the value of a statement
-
-
DMelt 3.0 © DataMelt by jWork.ORG