American Journal of Applied Sciences

Javascript Interpreter Using Non Recursive Abstract Syntax Tree Based Stack

Sambit Kumar Patra, Binod Kumar Pattanayak and Bhagabat Puthal

DOI : 10.3844/ajassp.2013.403.413

American Journal of Applied Sciences

Volume 10, Issue 4

Pages 403-413


In a Mobile device, apart from the battery and memory, the execution time is the key design constraint for executing the scripts of complex and unstructured JavaScript in the web-browser. Abstract Syntax Tree (AST) is a better option for mobile code as it is compiled only once. Due to very recursive nature of the AST, its traversal is going to be inherently recursive. Since use of recursion is out of scope, therefore the ultimate decision would be to emulate the recursive behavior using a set of stacks. We design an algorithm for a non recursive AST based stack, a lightweight interpreter which interprets and evaluates the complex scripts of JavaScript in the allocated time period.


© 2013 Sambit Kumar Patra, Binod Kumar Pattanayak and Bhagabat Puthal. This is an open access article distributed under the terms of the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original author and source are credited.