Parses and evaluates the sourceCode with the interpreter identified by languageId.
The value of sourceCode is expected to be a string (or convertible to one).
Returns the evaluation result, depending on the sourceCode and/or the semantics of the language evaluated.
Exceptions can occur when an invalid languageId is passed, when the sourceCode cannot be evaluated by the language,
or when the executed program throws one.
Parses the file sourceFileName with the interpreter identified by languageId.
The value of sourceFileName is expected to be a string (or convertible to one),
representing a file reachable by the current path. Returns an executable object, typically a function.
Exceptions can occur when an invalid languageId is passed, when the file identified by sourceFileName
cannot be found, or when the language throws an exception during parsing (parse time errors, e.g. syntax errors).
Exceptions thrown by the evaluated program are only thrown once the resulting function is evaluated.
Exports the JavaScript value under the name key (a string) to the polyglot bindings.
If the polyglot bindings already had a value identified by key, it is overwritten with
the new value. Throws a TypeError if key is not a string or missing. The value may be any valid Polyglot value.
Imports the value identified by key (a string) from the polyglot bindings and returns it.
If no language has exported a value identified by key, null is returned.
Throws a TypeError if key is not a string or missing.
The functions of the
Polyglotobject allow to interact with values from other polyglot languages.