block by nitaku cfa2cc08e583f640551c

Space-separated values (PEG.js)

Full Screen

An example of a simple Domain-Specific Language created with PEG.js.

The language is a sort-of TSV, where spaces separate cell values, and the header row is mandatory. The grammar allows C-like identifiers within the header, and integers only as values. A brutal check on the number of columns is also performed, to ensure the well-formedness of the code.

Valid code produces an array of objects representing the described data, that is then rendered as a table in a separate view.

Basic error messages are available in the editor’s status bar.

index.js

index.html

AppView.coffee

AppView.js

Data.coffee

Data.js

Editor.coffee

Editor.js

Table.coffee

Table.js

backbone.d3view.js

index.coffee

index.css

ssv.peg.js