Entry point for Forth into Firefox Spidermonkey
I hope this could be where the historical mistakes in computing made by the "Unix paradigm" can be corrected, by putting a Forth interpreter into Firefox Spidermonkey (JavaScript engine).
The required function JS_DefineFunctions, to interface C++ function to SpiderMonkey (Firefox JavaScript engine), is poorly documented, to say the least.
On MDN (Mozilla Developers Network), the tutorials are quickly outdated as new versions of Firefox are released.
I will share what I know if you have specific queries.
AddIntlExtras() (Add Internal Extras, I think) seems to be the right place to add Forth to Spidemonkey.
I hope this will save you a few weeks of looking around.
Next to try: add Forth code to funcs array.
https://github.com/mozilla/gecko-dev/blob/master/js/src/shell/js.cpp
#ifdef ENABLE_INTL_API
static bool
AddIntlExtras(JSContext* cx, unsigned argc, Value* vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
if (!args.get(0).isObject()) { JS_ReportErrorASCII(cx, "addIntlExtras must be passed an object"); return false; }
JS::RootedObject intl(cx, &args[0].toObject() );
static const JSFunctionSpec funcs[] = {
JS_SELF_HOSTED_FN("getCalendarInfo", "Intl_getCalendarInfo", 1, 0),
JS_SELF_HOSTED_FN("getLocaleInfo", "Intl_getLocaleInfo", 1, 0),
JS_SELF_HOSTED_FN("getDisplayNames", "Intl_getDisplayNames", 2, 0),
JS_FS_END };
if (!JS_DefineFunctions(cx, intl, funcs)) { return false; }
....