An alternative is to validate that the expressions only contain what is supported in this context, then transform it into Puppet::Parser::AST and evaluate that. This way it possible to also support function calls, method calls, iteration etc. without much difficulty.