This content has been marked as final. Show 7 replies
"justria" <firstname.lastname@example.org> wrote in message
> Does Flex provide a general eval() function, to which I may pass arbitrary
> expression? Or, which would be ok too, a method which at least evaluates
> mathematical expression?
Could you give a more concrete example of what you're trying to do?
> Could you give a more concrete example of what you're trying to do?
Use-case: A user should be able to input a mathematical formula, which in turn should be evaluated regarding a set of values and transformed into a chart.
I meanwhile figured out, that AS 2 had an eval() function, while AS 3 no longer provides one.
Thus, I wrote a lexer/parser for mathematical expression, which builds ASTs [abstract syntax trees]. An AST can be evaluated regarding a set of key-values pairs [bindings of names].
On the long run, I'm going to port my LL(1) parser generator from PHP5 to AS3 - since I'm not quite happy coding parsers manually.
AS2 had an eval() function but it would only resolve object references, and would not evaluate general expressions.
Its functional replacement is to use the bracket operators.
Someone has written an expression parser:
Thanks you very much for this hint!
That's exactly what I was looking for - and it's free! Great!
To push the whole thing a bit further:
Are there any projects, which dynamically generate AVM code to get loaded at runtime using SWFLoader?
I am not quite sure what you are asking.
There are some on-demand mxml compilers. I know there is one for Apache.
I'm just wondering, if there is a lib (or at least an experiment) available, which allows a Flex application to compile a program according to some syntax into an SWF file, which I may load using SWFLoader.