C++ Code generator for Blockly

1,349 views
Skip to first unread message

sa...@smartivity.in

unread,
Feb 20, 2019, 6:59:14 AM2/20/19
to Blockly
How to generator c++ code for blocky.

Amber B

unread,
Feb 20, 2019, 8:40:35 AM2/20/19
to Blockly

Coda Highland

unread,
Feb 20, 2019, 9:57:48 AM2/20/19
to blo...@googlegroups.com
Amber's link does provide a reasonable starting place, but I'll add a few additional notes:

Blockly isn't statically typed by default. C++ is. It's way easier to make Blockly work with static types (there's native support, you just have to set it up) than to build the necessary C++ infrastructure to handle Blockly's mixed types, especially if you want the resulting C++ code to look like something a human might have written, and especially if you don't want to have to define a wrapper function for every C++ library function you want to call.

Blockly isn't object-oriented. If you only intend to use Blockly for procedural control flow, this MIGHT not be a problem. If you want to define C++ classes in Blockly, you have a big chunk of work ahead of you. It's not at all unexplored territory, though; even Scratch manages to have a notion of objects and classes. 

Ardublockly and Blockduino both have code generators that work with statically-typed C++-like code. I would suggest taking a look at those projects. You might even be able to use one of them directly if you don't need anything especially fancy.

/s/ Adam

On Wed, Feb 20, 2019 at 7:40 AM Amber B <abla...@citizendeveloper.com> wrote:
--
You received this message because you are subscribed to the Google Groups "Blockly" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blockly+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages