Compile scratch3 code to native executables. scratchnative
Goal
The goal of this project is to safely compile Scratch3 projects to fast, native C++ code.
Used in
-
ScratchOS, an actual operating system kernel written in Scratch
Supported opcodes
-
event_whenflagclicked
-
data_setvariableto
-
data_showvariable
-
operator_add
-
operator_substract
-
operator_multiply
-
operator_divide
-
operator_lt
-
operator_equals
-
operator_gt
-
operator_and
-
operator_or
-
operator_not
-
operator_random
(TODO) -
operator_join
(TODO) -
operator_letter_of
(TODO) -
operator_length
(TODO) -
operator_contains
(TODO) -
operator_mod
(TODO) -
operator_round
(TODO) -
control_if
-
control_repeat
- Extern C functions through
procedures_call
- the rest
How to use
First, you need to build the program using cmake (Look it up if you don't know how).
Program usage:
scratchnative [OPTIONS] [INPUT]
OPTIONS:
--freestanding: enable freestanding mode (compile without libc)
-o: set output file
INPUT: input file, defaults to project.json
Limitations
- Currently, scratchnative doesn't support any kind of graphics.
- Compile-time errors could be largely improved.