Sorry, if the topic title does not convey the problem. As part of a project we want to expose an expressive language to the User, mostly for defining simple expressions, but possibly the ability to write procedures as well as any complex calculations they might want to do with the data. Of course, the natural choice would be to expose an entire language like Python (maybe with some project-specific functions to ease user programmability) and then invoking a Python interpreter from the application code. That is fine..
However, the requirement is that in this language, any variable resolution (say $data etc) needs to be done by our code, since it needs to be fetched specifically from various sources. Of course, once the data is fetched then the embedded language (say Python) has complete ownership to modify it in any way.
So, what might be the most elegant way to do this ? Embed a language but ability to hook the variable resolution. We could write a pre-processor which checks for the variables and replaces it with the raw data and then gives it to the embedded language interpreter. But, we would prefer having a hook-mechanism so that we are called for resolution of a variable...
Hope the Q is clear and thanks in advance.