Skip to content

Instantly share code, notes, and snippets.

@matthewhammer
Created October 6, 2017 17:01
Show Gist options
  • Save matthewhammer/011145c7471e50b4e7e7be54f4e99f78 to your computer and use it in GitHub Desktop.
Save matthewhammer/011145c7471e50b4e7e7be54f4e99f78 to your computer and use it in GitHub Desktop.
Data Pipes -- Language Definition
Types
-----------
Element types
E ::= Generate(D)
| Consume(D)
| Modify(D1, D2)
| Pair(D1,D2,D3) // D3 is a function of D1 and D2 (its the "product" of the dictionary types)
| Proj(D1,D2,D3) // D2 and D3 are each "projections" of the dictionary type D1
Types (Json types)
A ::=
| Num
| String String type
| Dict(D) Dictionary type
| Seq(S) Sequence type
Sequence type structure
S ::= empty | S, A
Dictionary type structure
D ::= empty
| D, s:A
Terms
-------------------------
Syntax for model is state of system in a moment in time
Functions over the model syntax: Give (functional) transformations to the model
Machine Learning Model
M ::= ...
Microbit Config
C ::= ...
Elements
e ::= Ml(M)
| Microbit(C)
Toggle Button
tb ::= on | off
Values (Json values)
v ::=
| n Numbers
| s Strings
| dict(d) Dictionaries
| s Sequences
s ::= empty | s, v
Key-value list
d ::=
| empty
| d, s:v
Strings
s ::= ...
Numbers
n ::= ....
------------------
Typing judgement
e : E --- "element e has element type E"
"Model M agrees with D_in and D_out"
-------------------------------------
Ml(M) : Modify(D_in, D_out)
"Config C generates dictionary structure D_out"
-------------------------------------
Microbit(C) : Generate(D_out)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment