I implemented something similar before Scribunto was stable enough
and > deployed My idea is different
I know. But the interpreting probably is too slow for huge-load wikis.
Do not allow Foxway extension to deceive you. It is a cheap intermediary, between functions of PHP and extensions written in PHP. It understands and executes the commands as PHP code(no more of this). This allows you get the data from a extension, process these data in functions of pure PHP and transmit it to other extension. Yes, there is an additional expense, but they are small.
When you can (albeit slowly) to manage the fast and strong extensions and use powerfull functions in an arbitrary way, you can do anything you like and it will be quickly. You do not pay much, but you have the ability to easily manage this.
... Lua VM also was a bit faster than both PHP and Python some year ago.
I know this, but If we rewrite MediaWiki in LUA, it will not work faster.