The question title speaks for itself. I'm specifically thinking in terms of a Node.js server. Additionally, this question is assuming that you don't need
Also, if this is not possible, why not?
Software Engineering Stack Exchange is a question and answer site for professionals, academics, and students working within the systems development life cycle. It only takes a minute to sign up.Sign up to join this community
It's easy to compile any language, no matter how dynamic, to machine code. It just won't be efficient machine code, since it will usually do a lot of dispatching based on run time type tags and looking up values in hash tables, much like a (bytecode) interpreter.
In the simplest case, just compile C code like
eval, there are still several features that require such inefficient machine code when compiled statically:
with, which modifies scope and semantics of variables based on an object's members. This is only a problem because of the next point.
new Function(str)and other moral equivalents to