scoped-propagators.nv
· 2.7 KiB · Text
Raw
Playground
|| :@include: lib/rpn.nv
||:: (
a = b + c ;
var c ;
a = 10 ;
b <- 20 ;
c <- 30 ;
{
a = b - c ;
var b ;
c = 20 ;
b <- 30 ;
}
)
|:: (var $x ;)| :: var $x
|:: ($x <- $y ;)| :: $x <- $y
|:: ($x = $y $op $z ;)| :: $x = $y $op $z
|:: ($x = $y ;)| :: $x = $y
|:: {| :: open a scope
|:: }| :: close a scope
|:: open a scope|
:: open a variable scope
:: open a propagator scope
|:: open a variable scope| :variables:
|:: open a propagator scope| :nodes:
|:: close a scope|
:: close a variable scope
:: close a propagator scope
|:: close a variable scope :variables:|
|:: close a variable scope? :variables: $x $y|
|:: close a variable scope|
|:: close a propagator scope :nodes:|
|:: close a propagator scope? :nodes: $op $x $y $z|
|:: close a propagator scope|
|:: $x <- $y|
:: set $x to $y
:: propagate variable $x
|:: declare variables? :: $name| :: var $name
|:: declare variables|
|:: var $x :default value: $y?| :: $x = $y
|:: var $x| :: $x = 0
|:: $x = $y| :: set $x to $y
|:: $z = $x $op $y|
:nodes: $op $x $y $z
|:: set $x to $y :variables: $x $z|
:: reset variables
:variables: $x $y
|:: set $x to $y :not found: $x|
:: reset variables
:variables: $x $y
|:: set $x to $y?|
:: find $x
|:: fetch the value of $x :variables: $x $y?|
:: reset variables
:values: $y
|:: fetch the value of $x :not found: $x?|
|:: fetch the value of $x?|
:: find $x
|:: propagate variable $x|
:: fetch nodes that depend on $x
:: propagate changes
:: prime the network
|:: propagate changes :dependencies: $op $x $y $z|
:: fetch the value of $y
:: fetch the value of $x
:: compute $op and store it in $z
:: propagate variable $z
:visited: $op $x $y $z
|:: propagate changes|
|:: compute $op and store it in $z :@rpn data: $x|
:: set $z to $x
|:: compute $op and store it in $z? :values: ($x $y)|
:@rpn: ($x $y $op)
|:: fetch nodes that depend on $x? :nodes: $op $x $y $z|
:dependencies: $op $x $y $z
|:: fetch nodes that depend on $x? :nodes: $op $y $x $z|
:dependencies: $op $y $x $z
|:: fetch nodes that depend on $x? :nodes: $op $w $y $z|
:checked nodes: $op $w $y $z
|:: fetch nodes that depend on $x|
:: reset nodes
|:: find $x :variables: $x $y?|
|:: find $x? :variables: $z $y|
:checked variables: $z $y
|:: find $x|
:: reset variables
:not found: $x
|:: reset variables? :checked variables: $x $y|
:variables: $x $y
|:: reset variables|
|:: reset nodes? :checked nodes: $op $x $y $z|
:nodes: $op $x $y $z
|:: reset nodes|
|:: prime the network? :visited: $op $x $y $z|
:nodes: $op $x $y $z
|:: prime the network|
| 1 | || :@include: lib/rpn.nv |
| 2 | |
| 3 | ||:: ( |
| 4 | a = b + c ; |
| 5 | var c ; |
| 6 | a = 10 ; |
| 7 | b <- 20 ; |
| 8 | c <- 30 ; |
| 9 | { |
| 10 | a = b - c ; |
| 11 | var b ; |
| 12 | c = 20 ; |
| 13 | b <- 30 ; |
| 14 | } |
| 15 | ) |
| 16 | |
| 17 | |:: (var $x ;)| :: var $x |
| 18 | |:: ($x <- $y ;)| :: $x <- $y |
| 19 | |:: ($x = $y $op $z ;)| :: $x = $y $op $z |
| 20 | |:: ($x = $y ;)| :: $x = $y |
| 21 | |:: {| :: open a scope |
| 22 | |:: }| :: close a scope |
| 23 | |
| 24 | |:: open a scope| |
| 25 | :: open a variable scope |
| 26 | :: open a propagator scope |
| 27 | |
| 28 | |:: open a variable scope| :variables: |
| 29 | |:: open a propagator scope| :nodes: |
| 30 | |
| 31 | |:: close a scope| |
| 32 | :: close a variable scope |
| 33 | :: close a propagator scope |
| 34 | |
| 35 | |:: close a variable scope :variables:| |
| 36 | |:: close a variable scope? :variables: $x $y| |
| 37 | |:: close a variable scope| |
| 38 | |
| 39 | |:: close a propagator scope :nodes:| |
| 40 | |:: close a propagator scope? :nodes: $op $x $y $z| |
| 41 | |:: close a propagator scope| |
| 42 | |
| 43 | |:: $x <- $y| |
| 44 | :: set $x to $y |
| 45 | :: propagate variable $x |
| 46 | |
| 47 | |:: declare variables? :: $name| :: var $name |
| 48 | |:: declare variables| |
| 49 | |
| 50 | |:: var $x :default value: $y?| :: $x = $y |
| 51 | |:: var $x| :: $x = 0 |
| 52 | |
| 53 | |:: $x = $y| :: set $x to $y |
| 54 | |:: $z = $x $op $y| |
| 55 | :nodes: $op $x $y $z |
| 56 | |
| 57 | |:: set $x to $y :variables: $x $z| |
| 58 | :: reset variables |
| 59 | :variables: $x $y |
| 60 | |:: set $x to $y :not found: $x| |
| 61 | :: reset variables |
| 62 | :variables: $x $y |
| 63 | |:: set $x to $y?| |
| 64 | :: find $x |
| 65 | |
| 66 | |:: fetch the value of $x :variables: $x $y?| |
| 67 | :: reset variables |
| 68 | :values: $y |
| 69 | |:: fetch the value of $x :not found: $x?| |
| 70 | |:: fetch the value of $x?| |
| 71 | :: find $x |
| 72 | |
| 73 | |:: propagate variable $x| |
| 74 | :: fetch nodes that depend on $x |
| 75 | :: propagate changes |
| 76 | :: prime the network |
| 77 | |
| 78 | |:: propagate changes :dependencies: $op $x $y $z| |
| 79 | :: fetch the value of $y |
| 80 | :: fetch the value of $x |
| 81 | :: compute $op and store it in $z |
| 82 | :: propagate variable $z |
| 83 | :visited: $op $x $y $z |
| 84 | |:: propagate changes| |
| 85 | |
| 86 | |:: compute $op and store it in $z :@rpn data: $x| |
| 87 | :: set $z to $x |
| 88 | |:: compute $op and store it in $z? :values: ($x $y)| |
| 89 | :@rpn: ($x $y $op) |
| 90 | |
| 91 | |:: fetch nodes that depend on $x? :nodes: $op $x $y $z| |
| 92 | :dependencies: $op $x $y $z |
| 93 | |:: fetch nodes that depend on $x? :nodes: $op $y $x $z| |
| 94 | :dependencies: $op $y $x $z |
| 95 | |:: fetch nodes that depend on $x? :nodes: $op $w $y $z| |
| 96 | :checked nodes: $op $w $y $z |
| 97 | |:: fetch nodes that depend on $x| |
| 98 | :: reset nodes |
| 99 | |
| 100 | |:: find $x :variables: $x $y?| |
| 101 | |:: find $x? :variables: $z $y| |
| 102 | :checked variables: $z $y |
| 103 | |:: find $x| |
| 104 | :: reset variables |
| 105 | :not found: $x |
| 106 | |
| 107 | |:: reset variables? :checked variables: $x $y| |
| 108 | :variables: $x $y |
| 109 | |:: reset variables| |
| 110 | |
| 111 | |:: reset nodes? :checked nodes: $op $x $y $z| |
| 112 | :nodes: $op $x $y $z |
| 113 | |:: reset nodes| |
| 114 | |
| 115 | |:: prime the network? :visited: $op $x $y $z| |
| 116 | :nodes: $op $x $y $z |
| 117 | |:: prime the network| |
| 118 |