datscript
This is an example of datscript, a data processing language for moving, manipulating, and organizing data.
This is just a proof of concept - it doesn't function yet
run
in demo.ds
a = clone a/b
b = load "http://google.com"
a | filter "hello"
Execute the datscript
$ npm i -g datscript
$ datscript demo.dshow it all works
- first, the grammar of the language is described in
grammar.y - the grammar file uses jison, which is a JavaScript implementation of bison.
- the grammar file contains both a lexer and a parser.
- the parser must emit the SpiderMonkey Parser API which is fed into escodegen to generate valid JavaScript syntax.
- the resulting script is then fed into the vm module and executed in a sandbox with a special set of globals.
goals
Overall, the goal of datscript is to create something people will use. As such, it should do a good job of meeting the constraints of non-experts who deal with lots of semi-structured data.
constraints
- data might be dirty
- data may come from various sources, like spreadsheets, websites, csv files, etc
- people using datscript may be non-programmers
development
- generate a new
grammar.jsfile withnpm run grammar.js