/skogi

Extension of Kogi that implements grammar simplification rules

Primary LanguageSmalltalk

S/Kogi

DOI

S/Kogi generates Blockly editors based on Rascal/Ohm-like grammars. It improves upon its predecessor Kogi by transforming the input grammar to yield a block-based editor that more closely resembles the hand-crafted ones found in e.g. Scratch or MakeCode.

Installation

  • Get a squeak-trunk build (should work with version 5.4 or 6, after its release)
  • Open a workspace by left-clicking into the world, select "Workspace"
  • Paste and select the following. Then press ctrl+d/cmd+d for "do-it" (note that there will be a dialog asking to install "Tonel" after a while underneath the progress bar, which you should confirm)
Metacello new
  baseline: 'SKogi';
  repository: 'github://maveme/skogi:master/packages';
  load.
  • Now, to try out S/Kogi, run any of the following lines using the same "do-it" method (paste, select line, press ctrl+d/cmd+d):
SBGrammarTransformer grammarStatemachine simplifyAndOpen.
SBGrammarTransformer grammarSonificationBlocks simplifyAndOpen.
SBGrammarTransformer grammarQL simplifyAndOpen.
SBGrammarTransformer grammarRascalJava18 simplifyAndOpen.
SBGrammarTransformer grammarMath simplifyAndOpen.
SBGrammarTransformer grammarRascalJavascript simplifyAndOpen.
SBGrammarTransformer grammarMiniJava simplifyAndOpen.
SBGrammarTransformer grammarCloudLang simplifyAndOpen.

Custom Grammars

To try out a new grammar, ensure that the grammar is parseable as an Ohm grammar, then create a new method on the class side of SBGrammarTransformer (to do so, open the Browser by left-clicking in the world, then select the SKogi-Core package in the left panel, select the SBGrammarTransformer class, click on "class" below the class name, and finally find e.g. the grammarStatemachine method, give it a new name in the editor window, paste your grammar, and hit save).

Now, you can open your new grammar in the same way as above:

SBGrammarTransformer grammarNameThatYouGave simplifyAndOpen.