Answer the question
In order to leave comments, you need to log in
Interpreted language FOR JS can you tell me?
Yes, you heard right. I had a need for a Wishlist - to allow the user to post some scripts, which will then be executed by other users. I will not describe the subject area, I will only describe the obvious requirements for such scripts: they must be safe (roughly speaking, do not redirect to phishing sites), and they must not hang the browser (run for a certain predictable time or die with an error, it is also desirable to eat a predictable amount of memory). Accordingly, the stupid decision "JS via eval" is no longer needed.
Tell me, comrades, is there any standard solution for such a situation? Maybe you can somehow cunningly achieve the specified requirements from JS? Or is there a browser-based interpreter for some other language that meets the requirements already mentioned? No special power is required from the language (although it is still desirable not to be a brainfuck), the main thing is security, controlled execution time and controlled memory consumption.
Answer the question
In order to leave comments, you need to log in
You can embed Lua, for example. There is a VM implementation for JS. I can't say how convenient it is.
codecombat.com in open source, probably there are interpreters there too... https://github.com/codecombat/codecombat
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question