processing-p5-convert

source code translator that converts Processing Java code to p5.js Javascript code

Home Minimal_example Command_line Notes About Project

(tests) hello bounce grid bounce_with_class cat hello_font hello_sound explode bounce_vectors hello_3d

(live conversion tests) phyllotaxis dandelin dogfooding

(student project tests) cow_game cross_the_road dinosaur_game greenhouse_game

About processing-p5-convert

Live Demo

processing-p5-convert is a source code translator that that converts Processing/Java code to p5.js/Javascript code. It includes a command line tool, and can also be used in the browser to convert and run Processing sketches.

Source code translation is implemented by parsing the Processing/Java code into a syntax tree. The syntax tree retains all code symbols, which facilitates reconstruction of the source code. processing-p5-convert walks the syntax tree, performing transformations as it reconstructs the source code.

Most of the basic syntax (braces, function calls, conditionals, loops) is identical between Java and Javascript. Some source code transformations handle language differences (e.g. declaration of variables, functions, and classes, for-each vs. for-of loops, Java ArrayList vs. Javascript array). Other source code transformations handle specific differences between the Processing and p5.js APIs.

Issues

Please report any issues that you find!

Why?

I use Processing to teach computer science. To run Processing sketches on web pages, I previously used the processing.js project, which has now been retired.

This project relies on these open source projects:

home