All Projects → BookOwl → coro-scratch

BookOwl / coro-scratch

Licence: MIT license
A Scratch to Python transpiler that makes extensive use of coroutines

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to coro-scratch

purenix
Nix backend for PureScript. Transpile PureScript code to Nix.
Stars: ✭ 227 (+931.82%)
Mutual labels:  transpiler
hexa
Compiler, standard library & backends
Stars: ✭ 74 (+236.36%)
Mutual labels:  transpiler
cassidy
Cassidy programming language, bringing static typing, strictness, safety and precision into your web project
Stars: ✭ 25 (+13.64%)
Mutual labels:  transpiler
phpify
Compiles PHP modules for the browser with Uniter.
Stars: ✭ 18 (-18.18%)
Mutual labels:  transpiler
Meower-Vanilla
Official source code for the Scratch-based Meower client.
Stars: ✭ 24 (+9.09%)
Mutual labels:  scratch
Gratch
Block-style programming environment for tackling graph structure and graph algorithm, based on MIT Scratch.
Stars: ✭ 15 (-31.82%)
Mutual labels:  scratch
sidef
A modern object-oriented programming language implemented in Perl.
Stars: ✭ 109 (+395.45%)
Mutual labels:  transpiler
Lang-app
Add a multi lang configuration to your WEB APP 'from scratch' [ANY FRAMEWORK, ANY PLUGIN, ANY API]
Stars: ✭ 15 (-31.82%)
Mutual labels:  scratch
schwalbe
"Transpiler" from the Schwalbe Programming Language to Swift
Stars: ✭ 28 (+27.27%)
Mutual labels:  transpiler
x
The Jule programming language
Stars: ✭ 35 (+59.09%)
Mutual labels:  transpiler
AutoWIG
Automatic Wrapper and Interface Generator
Stars: ✭ 107 (+386.36%)
Mutual labels:  transpiler
lua-in-js
A Lua to JS transpiler / runtime
Stars: ✭ 37 (+68.18%)
Mutual labels:  transpiler
LiteGui
Immediate Mode GUI From Scratch
Stars: ✭ 15 (-31.82%)
Mutual labels:  scratch
Pyonkee
Pyonkee is a visual-programming environment for iPad. It is based on Scratch from the MIT Media Lab.
Stars: ✭ 80 (+263.64%)
Mutual labels:  scratch
cito
Ć programming language. Translated automatically to C, C++, C#, Java, JavaScript, Python, Swift, TypeScript and OpenCL C.
Stars: ✭ 1,372 (+6136.36%)
Mutual labels:  transpiler
bashscript
TypeScript to bash transpiler. Because.
Stars: ✭ 37 (+68.18%)
Mutual labels:  transpiler
deqaf
Decaffeinate CSS stylesheets client-side
Stars: ✭ 30 (+36.36%)
Mutual labels:  transpiler
natsu-clr
il2cpp transpiler and runtime compatible with .Net Core
Stars: ✭ 76 (+245.45%)
Mutual labels:  transpiler
esp32-transpiler
Transpile Golang into Arduino code to use fully automated testing at your IoT projects.
Stars: ✭ 53 (+140.91%)
Mutual labels:  transpiler
Sweet.apex
Next Generation of Apex Development
Stars: ✭ 43 (+95.45%)
Mutual labels:  transpiler

coro-scratch

A Scratch 2.0 to Python transpiler that makes extensive use of coroutines

coro-scratch is a simple command line tool that can convert Scratch projects to .py source files that can be run in any Python version greater than or equal to 3.4. It makes extensive use of asyncio and coroutines in the transpiled files.

What versions of Scratch does this work with?

coro-scratch only works with Scratch 2.0 projects as the file formats for 1.4 and 3.0 are very different. Adding support for Scratch 3.0 projects would not be very difficult, but I do not have any plans to do so at the moment. If anyone wants to add it fork this repo and send a PR. :)

How does it work?

A longstanding problem with transpiling Scratch projects to other languages is how to deal with its concurrency model. The transpiled programs can't use threads because the scripts in a Scratch project only yield at specific places, while threads can yield at any time. Since most programming languages only have threads (or multiple processes, which would be even less suitable) for managing concurrency, this has meant that most Scratch to X "transpilers" really just embed an interpreter and a project together. coro-scratch gets around this by using coroutines, which are like normal subroutines, but they can be "paused" and "unpaused" at specific points. This allows the transpiled code to yield just like Scratch would.

How complete is this?

coro-scratch supports quite a few blocks, including most of the blocks in Operators, Data, and Control. It supports a few Events, Sensing, and Looks blocks. It has full support for custom blocks. Check out the example projects for the full details.

coro-scratch has support for multiple sprites and scripts running at the same time. E.G two sprites with two green flag scripts each.

Also, the programs created by coro-scratch are CLI only, no graphics or sound blocks will be supported any time soon (except for "say for", which just prints to the console.)

Usage

Clone this repo, and run python3 convert.py infile.sb2 outfile.py

The generated programs must be run on Python3.4+

License

coro-scratch is released under the MIT license, see LICENSE.txt for details.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].