Duktape: an embeddable JavaScript engine
duktape.org
duktape.org
Here are some related projects I saved links to. I think there were a few others.
http://code.google.com/p/tiny-js/
http://adaptive-enterprises.com/~d/software/see/
http://sourceforge.net/projects/njs/
v8 is an obvious open source implementation, because it's packaged separately (and used in node.js), but its API is C++ and relatively complex. For a lot of applications, it's overkill.
There's a nice overview here: http://blog.bignerdranch.com/3784-javascriptcore-and-ios-7/
Has anybody experience, how the integration overhead is? Looks as this could be integrated very simply. The problem is, that it is in alpha stage and how stable and complete is it currently?
C/C++ is great for low-level and performance sensitive code, but at the cost of ease of use and a potentially slow compile-test-debug cycle. For instance, in a game engine, the Physics and graphics rendering are usually done in C++. But for the rest, you get more bang-for-your-buck with a higher-level language.
Mindshare
Other high-level languages can do the same thing. In fact, Lua and Guile were designed for this exact purpose. But Javascript works well and Javascript programmers are much easier to find. And if, say, you want your users to start writing plug-ins for your application, you'll have more success with a language they're more likely to know.
Performance
Thanks to the great Javascript JIT compilers, you'll probably take a smaller performance hit than with other high-level languages you might choose.
It's not tiny though (for an underbelly feeling, I found an old binary Windows build online of about 800kb).
Looking at the current SpiderMonkey docs, things look like they've only improved. Back in the day, I just took SpiderMonkey from the "js" subdirectory of the Firefox repo. They split it off and documented build steps since then.
I'm not saying there's no space for contenders here, but don't underestimate the quality of what's out there already. SpiderMonkey really is remarkably easy to interface with.
Libraries count. Developer mindshare counts.
It's the same rationale as having so many modern languages that compile to Java. Java itself may not be that great, but man, there sure are a lot of useful libraries for it. Same with Javascript.
I'm quite pleased to see a compact and reasonable C interface for a JS engine--v8 can go eat a bag of rocks.
Would you mind elaborating a bit what makes v8 tedious to work with?
EDIT:
V8 is quite powerful, don't get me wrong. But, it requires a bit more knowledge of C++ to use and use well, and sometimes that can be a bit much. Also, if you're exporting functionality via a static library, you really don't always want to use anything other than vanilla C.
The additional license is for another project (murmurhash2).
What is the benefit, if your scripting language is the price-winner from Harvard Business school or something else, but nobody knows it and wants to learn it. So many (good) languages have passed away, nearly unnoticed.
One of the big attractions of Java and JavaScript: The syntax. The C/C++ like syntax was and is just in fashion ... even when it is criticized by many. But everybody knows it and everybody (it seems) like it.
I prefer embedding lisp, but I realize that most developers don't know that language family (which mostly defeats the point of an embedded scripting language). JS seems to be the closest widely-known languages have come to this ideal, so I'm quite happy with the prospects of using it.
http://code.google.com/p/tiny-js/ (~2kLOC)