Details
-
Improvement
-
Status: Closed
-
Trivial
-
Resolution: Won't Fix
-
1.9.4
-
None
-
None
-
MOODLE_19_STABLE
Description
New exptession's grammar analyzer let you use any your private functions. You can put theirs in package and attach to calculated question type. Also you can create wrappers for standard PHP functions.
Features:
1. Real grammar analyzer.
2. Checking accuracy of expression without reloading question's editing page.
3. Pluginable packages of functions (you can use any private functions).
4. Using arrays as parameters of functions.
Also included package of EGM Mathematical Finance class created by Enrique Garc?a M. (2003-2004) and distributed under GNU GPL.
Note: Package should named as 'package.php' and puted in individual folder. Names of functions should start from folder name.
For example:
All standard functions were moved in package 'math', so now their names have prefix 'math_' (math_sin, math_abs etc.)
Grammar of expressions:
<Expr>::=<Term>
<OperationLP>::='+'|'-'
<Term>::=<Factor>
<OperationHP>::='*'|'/'
<Factor>::=<UnaryOp><Factor>|<Base>
<UnaryOp>::='+'|'-'
<Base>::=<Variable>|<Function>|<Number>|'('<Expr>')'
<Function>::=<Letter>
<Parameter>::=<Boolean>|<Expr>
<Boolean>::='true'|'false'
<Variable>::='{'<Letter>{<Letter>|<Digit>|'_'}
'}'
<Letter>::='A'|...|'Z'|'a'|...|'z'|'_'
<Number>::=<Digit>
][('E'|'e')['+'|'-']<Digit>
{<Digit>}]
<Digit>::='0'|...|'9'
Attachments
Issue Links
- has a non-specific relationship to
-
CONTRIB-887 Question Type: Calculated Extended
-
- Closed
-