Conjure‐blocks - conjure-cp/conjure-oxide GitHub Wiki
Conjure Blocks
A block-editor web app for essence built using blockly
Helpful blockly links
-
tutorials, in particular
Common Issues
- block not defined
- this is likely caused by a change in block definition, so a block is stored in browser history that no longer exists.
- to fix, comment out the load session line in serialization.js, and rerun to empty the workspace history. You can then uncomment once fixed.
Current Features
- Blocks to Essence generation
- Block data input using JSON format
- Block output
- Running generated Essence on conjure using Conjure aaS
- Download generated Essence as a .essence file
Possible Next Steps
- Automated testing
- UX improvements
- highlight statements that cut solution space
- text to block
Currently working on
Automated Block Generation
(backtrack from this branch, in new branch).
Method:
-
Copy tree-sitter style grammar from here, remove outer grammar() and import.
-
Write definitions for other predefined functions from tree-sitter as follows:
- seq – formats arguments into message and arg list for block built from passed results.(main function for blocks)
- repeat – add mutator to block, so that can add slots to list, and shape will change.
- choice – if all options are strings, then makes and block with the strings in a dropdown selection menu, otherwise gives the list of blocks that are part of the callers type. Used to determine input connection if argument of another function, otherwise is used to determine type inheritance and toolbox categories.
- optional – as optional, always assume yes, so just returns the argument. (possible use of mutators in future)
- prec – sets blocks precedence to number,
- prec.left, prec.right - essentially ignored as Blockly needs precedence number.
-
Defined regex blocks as value blocks that only accept regex
-
Implement variable category for typed variables
Colours and Categories
- have improved subcategory display
- colour of blocks depend on (number of) categories
- wrote own categories in grammar, using choice function
TODO
- Reduce nesting - started looking at mutations, and rewrote repeat to use custom list blocks but now need to look at changing shape for arguments at end of blocks
- tooltip in blocks
- provide options of (type of) blocks allowed