ExpressionImpl |
Construct expression relative to the BNF:
expression ::= term additive-op expression | term
additive-op ::= "+" | "-"
term ::= factor multiplicatice-op term | factor
multiplicative-op ::= "*" | "-"
factor ::= (signed-expression "^" factor) | signed-expression
signed-expression ::= additive-op simple-expression | simple-expression
simple-expression ::= complex | real | constant | variable | function | "(" expression ")"
complex ::= real "i"
real ::= real-simple | real-simple "e" signed-integer
real-simple ::= integer | integer "." integer
signed-integer ::= additive-op integer | integer
integer ::= number integer | number
number ::= 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9
constant ::= variable
variable ::= letters integer | letters
letters ::= letter letters | letter
letter ::= a - Z
function ::= function-name "(" parameters ")"
function-name ::= variable
parameters ::= expression "," parameters | expression | ""
function-def ::= function-name "(" parameters-def ")=" expression
parameters-def ::= variable "," parameters-def | variable | ""
expr ::= function-def = expression
Valid expression is like:
- f()=2*5+1
- g(x)=2.5*x
- h(x)=-2e-3*(x+1)
- i(x,y)=h(y)*2+sqrt(g(x))
- j(z)=h(2*z+4)-g(h(z))
- ... |