5 ms·
Annotated CoffeeScript Grammar
- pgbovine 17y agoawesome, could this be the start of Knuth's literate programming for the 21st-century web world? http://www-cs-faculty.stanford.edu/~knuth/lp.html http://www-cs-faculty.stanford.edu/~knuth/lp.html http://en.wikipedia.org/wiki/Literate_programming http://en.wikipedia.org/wiki/Literate_programming
- ash 17y agoYeah, that's exactly what I thought. By the way, docco is behind this: http://jashkenas.github.com/docco/ http://jashkenas.github.com/docco/ (again pointed by http://tomayko.com/linkings/9f266cc6a6118995e75ffb963a7dce3e http://tomayko.com/linkings/9f266cc6a6118995e75ffb963a7dce3e)
- jongraehl 17y agoNo. Knuth's literate programming had the source code presented out of order (in whatever order the explanatory text desired).
- jashkenas 17y agoActually yes, because of JavaScript/CoffeeScript's habit of pushing declarations up before evaluation, you can more or less lay out your code in any order. We take advantage of this in the Lexer, here... http://jashkenas.github.com/coffee-script/documentation/docs/lexer.html http://jashkenas.github.com/coffee-script/documentation/docs... ...to stash all of the regex matchers down at the bottom of the file, even though the functions that make use of them come first.
- grayrest 17y agoThe guys over at Humanized (now at mozilla) did this for plain javascript about two years ago, FWIW. It's not quite as awesome when you don't have a sweet parser DSL.
- ash 17y ago[..searching...] Are you talking about code-illuminated? [1,2,3] Interesting approach - works right in the browser. For some reason I prefer docco output. I'm not sure why. Maybe the design is better. Maybe the code being annotated is better. [1]: http://code.google.com/p/code-illuminated/ http://code.google.com/p/code-illuminated/ [2]: http://www.toolness.com/wp/?p=441 http://www.toolness.com/wp/?p=441 [3]: http://code-illuminated.googlecode.com/hg/index.html#docs/docs.js http://code-illuminated.googlecode.com/hg/index.html#docs/do...
- grayrest 17y agoThat is what I was talking about. I remembered it being Atul but looks like I was a year off.
- cmelbye 17y agoLink to the actual source: http://jashkenas.github.com/coffee-script/documentation/docs/grammar.html http://jashkenas.github.com/coffee-script/documentation/docs...
- sh1mmer 17y agoIt's code illuminated. I know because it was on HN about a year ago and I forked it on Github back then :) Edit: link - http://code.google.com/p/code-illuminated/ http://code.google.com/p/code-illuminated/
- ash 17y agoNo, this (docco) is a separate implementation. Even the language is different - CoffeeScript vs JavaScript. Compare the source: http://github.com/jashkenas/docco/blob/master/docco.coffee http://github.com/jashkenas/docco/blob/master/docco.coffee http://code.google.com/p/code-illuminated/source/browse/docs/docs.js http://code.google.com/p/code-illuminated/source/browse/docs...