I'm not aware of any general work. I initially tried to directly port Paul Graham's interpreter into SQL. I immediately ran into problems because it wasn't possible to map the recursive function calls into SQL. After thinking about it in the background for a day, I figured out I could use the CTE +_stack approach instead of recursion. Once I figured that out, it only took me a few hours to port the interpreter.