A Blockly environment developed in Scala.js with a custom code generator for ScaFi.
Try it in Github pages
blockly2scafi is a Blockly environment developed in Scala.js with a custom code generator for ScaFi.
- Install sbt
- Compile optimized Scala.js with SBT :
sbt fullOptJS
- Open in browser the file index.html
Drag and drop the blocks from the relative categories in the toolbox to create an aggregate program that will be display on the right section.
- Implement
G2
function. - Implement
C
function. - Implement
S
function. - Implement
broadcast
function.
Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.
- config/library.xml is not used by blockly2scafi, it's the exported Blockly Developer Tools library.
- config/library.json contains the exported blocks definitions in JSON format. It's used to create the workspace.
- config/toolbox.xml contains the exported toolbox definition in XML format.
- config/initialWorkspace.xml contains the initial workspace structure in XML format.
- index.html contains the layout of the web page of blockly2scafi, styled by the css file main.css.
- blockly2scafi.js implements some of the facade methods used by Scala to initializes the blocky workspace and also for generating the ScaFi code.
- Open Blockly Developer Tools.
- Click on Import Block Library and upload the file config/library.xml.
- Define or edit the shape of the blocks using the tool.
- Go to Block Exporter, select All Stored in Block Library and export only the Block Definitions overwriting the config/library.json file.
- Create or edit the code generator function of the block in the Scala code.
- Remember to download the block library xml from Blockly Developer Tools and save it in config/library.xml.
- Open Blockly Developer Tools.
- Click on Import Block Library and upload the file config/library.xml.
- Go to Workspace Factory section.
- Click on Load to Edit and select the config/toolbox.xml.
- Define or edit the categories using the tool.
- Click Export, select Toolbox and overwrite the config/toolbox.xml file.
- Add
custom="Functions"
attribute to theFunctions
category in config/toolbox.xml. - Add
custom="Definitions"
attribute to theDefinitions
category in config/toolbox.xml.
Distributed under the MIT License. See LICENSE for more information.
Project Link: https://github.com/alemazzo/blockly2scafi