From xradiograph

Processing: processing.js

Javascript Mode for Processing




TODO: sort these things
Game of Life - LUT post from 2008 - anything worth while left in here?



history of conversion

Processing syntax is based on Java, which means that Processing.js has to essentially transform Java source code into Java Script source code. Initially, this was achieved by treating the Java source code as a string, and iteratively replacing substrings of Java with their Java Script equivalents. (For those interested in an early incarnation of the parser, it can be found at here, running from line 37 to line 266.) For a small syntax set, this is fine, but as time went on and complexity added to complexity, this approach started to break down. Consequently, the parser was completely rewritten to build an Abstract Syntax Tree (AST) instead, first breaking down the Java source code into functional blocks, and then mapping each of those blocks to their corresponding Java Script syntax. The result is that, at the cost of readability, Processing.js now effectively contains an on-the-fly Java-to-Java Script transcompiler. (Readers are welcome to peruse this code, up to line 19217.)

(source) NB: second link takes a while to load


Integration with Javascript and vice-versa



See Also



Retrieved from
Page last modified on April 17, 2014, at 09:34 AM