摘要 |
A JavaScript interpreter may be interfaced with a JavaScript library of host objects implemented in Java. A JavaScript program may be accessed and parsed, an intermediate representation of the program may be generated, and the intermediate representation may be executed by interfacing with the library of host objects. In one embodiment, the JavaScript program is embedded in HTML documents in a Web browser. The browser is programmed to intercept the JavaScript code and pass execution control to an interpreter engine implemented in Java. The interpreter engine may access the program's library of host objects through an interface to the library and execute the intermediate representation to produce the desired results as programmed in the original JavaScript source program. The implementation of the interface enables the implementation of the interpreter engine to be independent from the implementation of the library of host objects and independent from the implementation of the browser.
|