Javascript plotting of syntax diagrams (aka railroad diagrams) out of a formal syntax description onto a HTML5 canvas.
License: Other
Shell 1.14%JavaScript 88.56%HTML 10.30%
ebnfdiagram's Introduction
EBNF-Diagram
------------
jQuery plugin that plots syntax diagrams (aka railroad diagrams) out of a formal syntax description.
Getting it
----------
You can checkout the source code at git://github.com/marc-portier/ebnfdiagram.git
$ git pull git://github.com/marc-portier/ebnfdiagram.git
Building
--------
There is no real automated build in place, sorry for that. What you need to do is:
0. Get a js interpreter you can operate from the command line.
We recommend rhino, the more interesting platforms have it on board or at least in the package repositories.
1. Build the parser
mkdir -p target/js;
cd tools/jscc;
rhino jscc.js -o ../../target/js/ebnf-jq.js ../../src/main/syntax/ebnf-jq.par;
cd -;
There is a limited automation of these build-steps captured in some bash files, they are provided as is:
./build.sh
Testing
-------
Just point your browser to test/webenv/test.html.
Add some syntax in the textarea and push the buttons.
TODO: we think about providing some qunit testing.
Documentation
-------------
The code itself is currently your best source of documentation.
Given the total size of the project source it might be hard to make a more condense variant :)
The default browser-testpage (see above) shows the diagram of the syntax the rendition expects as input.
Nevertheless, some extra simple usage documents might be wise about:
* howto customize the vizuals
* howto integrate its use on your own pages
Also:
* the src/desgin folder contains a scan of sketches that help explain how some of the internal drawing stuff is happening.
* js/cc and jQuery provide more docs that might come around handy. Check the file CREDITS for pointers.
Future Work
-----------
Is coordinated through github
See: https://github.com/marc-portier/ebnfdiagram
Next to the things you already thought of yourself, here is a short list of things to be added:
* better build framework - and make it cross platform
* better jQuery usage:
* provide some automatic way to have pre/@class="ebnf" elements replaced with the diagram canvas