I know this is a crazy question, but I want to edit the JavaScript interpreter. I don't care if it's node.js or browser-js, but I want to edit any JS interpreter, whichever is easiest to edit, so I can parse the language with different keywords.

For example, I would change (function) to (fn), and add (or, and, not) keywords additional to the symbols.

Is this even possible, or should I write an interpreter? I tried doing it but I don't feel like I need a parser and lexer, because after all, there's already one built (node) and I would just have to modify it a tiny bit.

Note: I'm on Linux x86-64.

  • 2
    What programming languages are you familiar with? There are several of JavaScript implementations in different languages, for example Rhino github.com/mozilla/rhino in Java.
    – JacquesB
    Commented Jun 9 at 13:57

2 Answers 2


For what you want to achieve, it would probably be best to define your own language that compiles down to JavaScript, like CoffeeScript, Dart or TypeScript do. In other words, rather than a patch to an existing interpreter you should probably attempt to write a very small transpiler.

  • How would I do that though? Commented Jun 8 at 19:17
  • @OnyxWingman If this isn't supposed to be a complex, comprehensive extension to the language, but rather just couple of syntactical replacements (such as fn for function, and for && etc.), you could get by with just a simple Nodej.js script that reads a content of a file, executes couple of regular expression replacements and feeds the output to eval().
    – Viniter
    Commented 9 hours ago

JavaScript, ECMAScript rather, is a language specification. There are multiple implementations of that spec, so there is no one single implementation.

Significant work goes into building JavaScript runtimes or engines (those terms are used interchangeably). Generally each browser comes with their own engines with NodeJS being entirely separate.

As for which one is easier to modify? I guess that's sort of an odd question, because they are all complex. Asking which JavaScript engine is easiest to modify is a bit like asking which kind of physics is easier: astrophysics or quantum physics?

That isn't to say you shouldn't pull down the source for Node, or the V8 runtime and play around. That is a perfectly fine thing to do. Just be prepared to spend a year analyzing code.

At least for the V8 runtime, it looks like src/parsing/token.h has the list of keywords. No harm in pulling the code down and trying to change "function" to "func", build it and see what happens.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.