blocklygoogle-blockly

Custom Programming language in blockly?


How can i change the default block language from javascript to batch?

I want to make a block creator that makes batch code .bat file, the default options are javascript, php, lua etc. how can i make a custom one?


Solution

  • You will need to write custom generator for this.

    At a high level, for each block you need to write a function which will return the corresponding batch code string. This function will have access to the various inputs that the block is having which will help you build the string. You can check how the existing generators are written and use this as a reference to build another language generator.

    The existing generators are placed in generators directory in blockly source.

    Writing a custom language generator is a big task in itself especially with the lack of documentation to achieve it. But this comment from Rachel should get you started on it.