Skip to content

Instantly share code, notes, and snippets.

@okram
Last active January 8, 2020 05:20
Show Gist options
  • Save okram/584d64a42f6188f71bb3f7358afe4e80 to your computer and use it in GitHub Desktop.
Save okram/584d64a42f6188f71bb3f7358afe4e80 to your computer and use it in GitHub Desktop.
int => [plus,15][is,[mult,[plus,22][mult,[id]]][gt,2]][lt,17][is,[eq,true]]
^__ traverser is an int token.
^__ you pass him into the pipeline (inst DAG)
// he creates the following inst DAG below that is now type checked/inferred.
bool{?} <= [plus,15][is,bool <= [mult,int <= [plus,15][plus,22][mult,int <= [plus,15][plus,22]]][gt,2]][lt,17][is,bool{?} <= [eq,true]]
instruction domain range
------------------------------------------------------------------------------------------------------------
[plus,15] int => int
[is,bool <= [mult,int <= [plus,15][plus,22][mult,int <= [plus,15][plus,22]]][gt,2]] int => int{?}
[mult,int <= [plus,15][plus,22][mult,int <= [plus,15][plus,22]]] int => int
[plus,15] int => int
[plus,22] int => int
[mult,int <= [plus,15][plus,22]] int => int
[plus,15] int => int
[plus,22] int => int
[gt,2] int => bool
[lt,17] int{?} => bool{?}
[is,bool{?} <= [eq,true]] bool{?} => bool{?}
[eq,true] bool{?} => bool{?}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment