Contents
Syntax
The syntax for
exprtk.compile{options}(expression) exprtk.compile{options} { //block of ExprTk code } exprtk.compile{options}(name, expression) exprtk.compile{block, options}(name) { //block of ExprTk code }
@exprtk.compile{options}(expression) @exprtk.compile{options} { //block of ExprTk code } @exprtk.compile{options}(name, expression) @exprtk.compile{block, options}(name) { //block of ExprTk code }
Description
The
- zero parameters with the call followed by a block of
ExprTk code to compile; - a single parameter that should either be the expression to be compiled or for the
b /block option a name to assign to the following block ofExprTk code to compile; or - two parameters, the first being the name to assign to the second parameter which should be the
ExprTk expression to compile.
Note: An expression will need to be recompiled if another variable/symbol with the same name has been in-scope since the expression was compiled. See also exprtk.add_variable.
Options
The following options are available for
option | description |
---|---|
call is followed by a block of |
|
file param instead of expression param, named by path if no name specified | |
use |
|
use |
|
parse block with language call is made from before compiling with |
|
option | description |
f++ example
Examples of
int i=0 exprtk.compile(nsm_write(console, 'i: ', i, endl)) for(; i<10; i+=1) exprtk.eval
exprtk.add_package(basicio_package) exprtk.compile(world, println('hello, world!')) exprtk.compile(mars, println('hello, mars!')) exprtk.eval(world)
exprtk.add_package(basicio_package) exprtk.compile{block}(eg) { for(var i:=0; i<10; i+=1) { println('i: ', i) } } exprtk.eval(eg)
n++ example
Example of
@int(i=0) @exprtk.compile(nsm_write(console, 'i: ', i, endl)) @for(; i<10; i+=1) @exprtk.eval
@exprtk.add_package(basicio_package) @exprtk.compile(world, println('hello, world!')) @exprtk.compile(mars, println('hello, mars!')) @exprtk.eval(world)
@exprtk.add_package(basicio_package) @exprtk.compile{block}(eg) { for(var i:=0; i<10; i+=1) { println('i: ', i) } } @exprtk.eval(eg)