MetaES – JavaScript in JavaScript interpreter
metaes.org
metaes.org
Would this be quick enough to integrate into an editor like atom.io? For variable and function completion
Browsers have historically opted for hiding runtime management (debugging, etc) behind myriad APIs, most of which can't be accessed from the running program itself. I would love to see a cross-browser way to hook into these sorts of things without extensions or at least with standard APIs.
Overall this would be much better for us as coders. And this would open the way for all sorts of cool tools. Consider V8's live code reloading functionality. But imagine if it worked cross-browser and could be called from the program itself. Your webserver could send a signal over websocket, and you could perform hot-swapped deployments of your webpage, and all connected browsers would be updated. The browsers could be customers', or they could be inside that mobile device that's a pain to debug.
It would also be much easier to prototype new dev tools and ways of coding. For example, programming against Chrome's extensions APIs (as great as they are) is somewhat limiting - last I checked you lack direct access to the embedded CodeMirror editor for example. There are a lot of security-focused restrictions. So people workaround this. They rewrite editors and file managers from scratch so they can get the desired flexibility (lighttable, brackets, atom, etc).
Personally I love to see projects like MetaES because I feel like they are inching us closer to something that could be the next step.
I don't know honestly what's going to pop up along the way, but with MetaES we can get smart completion and better debugging experience in popular editors for sure, it just requires more work and care.
I like this kind of stuff.
A particularly interesting take on this is tailspin, although the repo appears have been taken down: https://github.com/wthimbleby/tailspin That one offered a reversible JavaScript debugger written in JavaScript, which I thought that was very impressive from a technical standpoint.
MetaJS has some open issues - some related to the fact that it's intended to let you step through code, which I think makes certain interop scenarios difficult (let's say for example native code calls MetaJS code and expects a return value - it's not possible to set a MetaJS breakpoint there because the native runtime isn't paused).
I would be curious to know how MetaES fares under something like test262. I think a metacircular interpreter that does well in an extensive suite like that could indeed be a proper, "safe alternative to eval" (as suggested by another commenter).
https://github.com/metaes/metaes - "MetaES was tested using test262 test suite. Runnable test suite is currently not added to the repository."
You're right about breakpoints while code is called by native functions. That's something that should be discussed more.
Do you know this interpreter ? (in D)
https://github.com/higgsjs/Higgs
It's one of the most advanced I found (outside browsers).
If you want to get rid of the "switch/case", you can look at threaded code interpreters.
http://www.complang.tuwien.ac.at/forth/threaded-code.html
You can find useful ressources in Forth about it.
I write a stack-based language in javascript. Each statement is a closure around the arguments of the expression stored in a flat array. The instruction pointer is an index in that array. It is partially compiled.
I also use function object constructor for a kind of FFI.
There is also good potential with asm.js to reach near-native performances.
Where's your language's website?
It is far less advanced than yours. It's inspired by Forth (a mixture of interpret and compile "word"s).
I'm doing that right now:
let print foreign console.log
print "hello"
Every "word" is a function receiving a stack and returning a stack. Whitespace can be replace by a "|".Each line is evaluated from right to left. Some words are used to change the state of the compiler and the compiler is a state machine (words are events).
The game is to find a minimal set of words to express high-level features like lambdas (from a word "jump", "until" or "instruction-pointer" for example).
It's cool to program :-)
You can get the 'Number' function with:
Number = (function(){return this;}).call(1).constructorAh ha. much simpler :)