This paper presents a compiler framework for the Snap! blocks programming language. Snap! is a web browser language using JavaScript to run the interface and the original interpretation of the language, therefore it is sensible to use JavaScript as the destination language as well. The compiler reads each Snap! block sent to it within a warp block and translates it to the equivalent JavaScript function that powers the block and powers the Sprites on the Snap! graphical interface. Control looping blocks like the forever, for, and repeat return control to the Snap! graphical interface by using JavaScript Generators pausing themselves in the middle to redraw the graphics and then come back to the block and continues running the compiled program. When the compiled code is executed on several tasks, it was able to attain a speedup that is significantly noticeable for a sizeable program compared to the interpreter and the interpreter-version of warp, but for simple programs, the interpreter warp performed better or as good, and more work needs to be done to support more Snap! blocks.




Download Full History