Skip to content

Simple clientside JS application for creating context free art using user defined grammar.

Notifications You must be signed in to change notification settings

vojone/grammart

Repository files navigation

GrammArt

Simple clientside JS application for creating context free art using user defined grammars. These grammars are defined in GrammArt context free graphics language (GCFG) highly inspired by language used by other context free art project (such as CInk2).

TreeSpiral cobweb

Author

Vojtěch Dvořák

How to run

The app is deployed here: vojone.github.io/grammart/.

If you want to run the app localy, no installation steps are needed. Just open index.html in browser. Supported browser are now:

  • Firefox
  • Edge
  • Chrome

Support for other browsers is not guaranteed. Although app is written in client-side JS it is recommended to have internet connection because of dependecies distributed by CDN.

How to develop

Initialize environment (npm needs to be installed first):

./scripts/init.sh

Generate the grammar of GrammArt CFG language (GCFG):

cd tree-sitter-grammartcfg
npx tree-sitter-cli generate
npx tree-sitter build --wasm

Generate JS files containing buffers with contents of WASM files (to run project locally without local web server):

mkdir dist
python3 to-base64.py tree-sitter-grammartcfg/tree-sitter-grammartcfg.wasm TREE_SITTER_CFG_WASM array >dist/tree-sitter-grammartcfg-base64.js
python3 to-base64.py deps/tree-sitter.wasm TREE_SITTER_WASM >dist/tree-sitter-base64.js

TODOs and ideas

  • Language enrichment - support of nonterminal comprehension (e. g. 5*[x: 10 y: 10]square{} ), variables, parametric rules

  • User defined cut-off - if there are many contexts execution slows down

  • Night mode of UI

  • Better mobile version of UI

Third party dependencies

Following dependecies are imported using CDN:

JQuery (website)

JQueryUI (website)

Bootstrap (website)

Bootstrap Icons (website)

Content of tree-sitter-grammarcfg was partially generated by tree-sitter-cli.

Other third party code and modules are placed in the deps directory, especially:

Tree-sitter - tree-sitter.js, tree-sitter.wasm - Tree-sitter JS bindings (https://github.com/tree-sitter/tree-sitter/tree/master/lib/binding_web)

About

Simple clientside JS application for creating context free art using user defined grammar.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published