You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The expressions are used in the PothosGUI parameters and in the JSON topology markup. Currently, simple expressions are parsed like numbers and strings, and complicated expressions are compiled and the resulting Object is extracted from the compiled library.
Although it doesnt sound like it, this was the lazy/quick solution. But it has drawbacks:
its slow to compile simple expressions in the system's compiler (gcc/msvc/clang)
dont want to require a compiler to be installed, like for binary windows installers
New compiler
Basically, we need to split expressions into tokens, and figure out which tokens are functions, constants, and variables.
Compiler input: list of variable names and expression or each variable
Compiler input: the expression to evaluate
Compiler output: a Pothos::Object() holding the result
Supported expressions
numbers: -1, 3.4, 1e8, 5lu
strings: "hello world"
bools: true, false
math ops: +, -, *, /, * * (exp op)
bit ops: &, |, ^
boolean ops: and, or, xor, &&, ||, ^^
parens: (1 + 2)
using a variable: 1.0 * foo
builtin variables: j, PI, other math constants
builtin functions: log, log2, pow, other std math stuff
Containers of expressions
We support jSON formatting for containers when possible
lists of expressions: [expr1, expr2, ...]
maps of expressions: {expr1:expr2, expr3:expr4}
The result will be a Pothos::Object containing a Pothos::ProxyVector, Pothos::ProxyMap (respectively). The system already knows how to deal with these data types and convert them.
Example operation
start with: 1 + 2
extract tokens: 1, +, 2
transform: function("add", obj(1), obj(2))
1 and 2 are recognized as type "int"
evaluate: the add function should inspect the types and basically call something like:
out = Pothos::Object(o1.convert() + o2.convert());
every thing builds upon this
The text was updated successfully, but these errors were encountered:
Current state
The expressions are used in the PothosGUI parameters and in the JSON topology markup. Currently, simple expressions are parsed like numbers and strings, and complicated expressions are compiled and the resulting Object is extracted from the compiled library.
Although it doesnt sound like it, this was the lazy/quick solution. But it has drawbacks:
New compiler
Basically, we need to split expressions into tokens, and figure out which tokens are functions, constants, and variables.
Supported expressions
Containers of expressions
We support jSON formatting for containers when possible
The result will be a Pothos::Object containing a Pothos::ProxyVector, Pothos::ProxyMap (respectively). The system already knows how to deal with these data types and convert them.
Example operation
The text was updated successfully, but these errors were encountered: