A JavaScript program may be represented in an intermediate form to be executed
by a JavaScript interpreter. A browser may be configured to intercept JavaScript
code and pass execution control to a Java-based interpreter engine. The instructions
are converted by a representation generator component of the engine into an intermediate
representation equivalent using the Java programming language. The representation
scheme may be suitable for execution by a stack-machine implemented interpreter.
The representation scheme may use Java classes and objects, and create logical
commands representing the JavaScript program. The intermediate representation may
be stored as Java objects in a stack data structure. The stack data structure may
be constructed from an array of elements, where each element is either an operator
or an operand, and where each element derives from an abstract Java class with
generic functionality and each element contains data relating to the operator or
data type it represents.