Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>so i tried again and found my most blatant mistake right away—the json i had posted was incorrectly using single instead of double quotes. let me detail the workflow; it's simple enough, and if you're already running CoffeeScript on NodeJS you're ready to go:</p> <ul> <li><p>locate the <code>node_modules/coffee-script/lib/coffee-script/grammar.js</code> module in your file system;</p></li> <li><p>copy &amp; paste the code of that file into the source pane of the js->coffee pane on the <a href="http://js2coffee.org/" rel="nofollow">js2coffee</a> site (you could skip that, but i find it much more agreeable to edit CS than to fiddle with JS).</p></li> <li><p>save the translated code to <code>node_modules/coffee-script/lib/coffee-script/grammar.coffee</code>;</p></li> <li><p>go and locate </p> <pre><code>exports.parser = new Parser( tokens: tokens.join(" ") bnf: grammar operators: operators.reverse() startSymbol: "Root" ) </code></pre> <p>in the code; replace it with </p> <pre><code>console.log JSON.stringify tokens: tokens.join " " bnf: grammar operators: operators.reverse() startSymbol: "Root" </code></pre> <p>while taking care to use the exact same indentation (two space for the first line, four for the rest).</p></li> <li><p>from the command line, run sth like <code>coffee node_modules/coffee-script/lib/coffee-script/grammar.coffee &gt; /tmp/coffee.grammar</code>;</p></li> <li><p>copy and paste the code of the resulting file into <a href="http://bottlecaps.de/convert/" rel="nofollow">the grammar converter</a>;</p></li> <li><p>copy and paste the resulting EBNF grammar from the converter into the grammar editor over at the <a href="http://bottlecaps.de/rr/ui" rel="nofollow">railroad diagram generator</a>;</p></li> <li><p>go over to the View Diagram tab and — rejoice!</p></li> </ul> <p>it's sort of a chore to do all of this copy'n'pastish stuff, but certainly good enough for any one-off visualization. i've been searching the web a lot for a reasonable RR diagram generator, and this particular one is definitely among the ones with the prettiest output. sort of surprising when you think of how simple railroad diagrams really are. </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload