Convert and String to an expression read by the runtime

fabou3377
2012-01-09
2012-01-09
  • fabou3377 - 2012-01-09

    Hi,

    Is there a way to convert a string in a expression which is evaluated on the runtime...
    Example

    VAR
    myVar1:BOOL;
    myVar2:BOOL;
    sMyString:STRING;
    END_VAR
    sMyString:='myVar1 AND myVar2'
    IF MYEVALUTEFUNCTION(sMyString) THEN
    ...
    END_IF
    
     
  • Yegor - 2012-01-09

    Nope. This would require an on-board compiler and reflection facilities, which is too much for resource-constrained environment running compiled code. Nevertheless, if all needed was a simple arithmetic expression support, I'd make my own evaluator function. Too much responsibility for the operator though.

     

Log in to post a comment.