|| '@include' (lib/platforms/browser_dom.nv lib/math.nv) || :DOM: ( x.join(' ')).toReversed().join('\n')+'\n'); delete stacks['final out']; | :: breakpoint | | :: breakpoint | :@js: me.gas = 0; | :: get cause 1 | :stack: A :pattern: . a . b . variable c . d . variable e :index: ( 0 1 2 3 4 ) | :: get cause 2 | :stack: A :pattern: . stride . test :index: ( 0 1 ) | :: get cause 3 | :stack: B :pattern: . other . cause . match . variable c :index: ( 0 1 2 3 ) | :: get effect 1 | :stack: out_A :items: . output . one . variable c :index: ( 0 1 2 ) | :: get effect 2 | :stack: out_B :items: . output . 2 . variable e :index: ( 0 1 2 ) | :: get rule 1 | :causes: ( 1 2 3 ) :effects: ( 1 2 ) | :: get cause 4 | :stack: ohnoes :pattern: . a . second . rule :index: ( 0 1 2 ) | :: get effect 3 | :stack: x :items: . what . shall . we . do :index: ( 0 1 2 3 ) | :: get rule 2 | :causes: ( 4 ) :effects: ( 3 ) | :: get effect 4 | :stack: ohnoes :items: . a . second . rule :index: ( 0 1 2 ) | :: get rule 3 | :causes: ( ) :effects: ( 4 ) | :rules: breakpoint | :: breakpoint || :rules: ( 1 2 3 breakpoint) |#==============================#| || :: emit header :: process rules :: emit step function :: process init effects :: emit footer :: translate :: output |:/:| :: process rules | :: emit header | :out: spacer :out: header | :: emit steps func | :out: steps func | :: emit footer | :out: footer |#==============================#| | :: process rules? :rules: $ruleid | :: get rule $ruleid :: if no causes handle init rule, else process rule $ruleid | :: process rules | | :: if no causes handle init rule, else process rule $ruleid :causes: | :: handle init rule $ruleid | :: if no causes handle init rule, else process rule $ruleid :causes: $cause? | :: process rule $ruleid | :: handle init rule $ruleid? :effects: $effect | :init effects: $effect | :: handle init rule $ruleid | | :: process rule $ruleid | :try rules: try rule $ruleid :: process causes :: process effects :: emit rule $ruleid :: clear rule temp state | :: clear rule temp state? :stack: $stack | | :: clear rule temp state? :vars: variable $x = index $y of stack $z at depth $q | | :: clear rule temp state | | :: process causes? :causes: $causeid | :: get cause $causeid :length: 0 :: check stack :: process pattern :: check fact lengths :: pop cause | :: process causes | :: clear causes temp state | :: check stack :stack: $stack? | :: add stack $stack | :: check fact lengths :stack: $stack? :current stride depth: $depth ? :length: $length | :check fact lengths: check stack $stack depth $depth has length $length | :: pop cause :stack: $stack | :pop causes: pop $stack | :: clear causes temp state :current stride depth: $n | | :: process init effects | :: init effects -> effects :: process effects :: emit :emit: push effects | :: init effects -> effects? :init effects: $e | :effects: $e | :: init effects -> effects | |------------------------------| | :: add stack $stack? :current stride depth: $n | | :: add stack $stack :@math: $depth | :current stride depth: $depth :strides: check stack $stack has at least depth $depth :: strides temp -> strides | :: add stack $stack? :strides: check stack $stack has at least depth $depth | :@math: add $depth 1 | :: add stack $stack? :strides: check stack $different has at least depth $depth | :strides temp: check stack $different has at least depth $depth | :: add stack $stack | :current stride depth: 1 :strides temp: check stack $stack has at least depth 1 :: strides temp -> strides | :: strides temp -> strides? :strides temp: check stack $stack has at least depth $depth | :strides: check stack $stack has at least depth $depth | :: strides temp -> strides | |------------------------------| | :: increment length :length: $old :@math: $n | :length: $n | :: increment length? :length: $n? | :@math: add $n 1 | :: process pattern? :stack: $stack? :pattern: variable $name :index: $i :current stride depth: $depth? | :: do variable $name at index $i of stack $stack at depth $depth :: increment length |- var is already declared -| | :: do variable $name at index $i of stack $stack at depth $depth :vars: variable $name = index $j of stack $stack2 at depth $depth2? | :check vars: check index $i of top of stack $stack at depth $depth equals value of var $name :: vars temp -> vars |# can also do this to give more information #| :check vars: check index $i of top of stack $stack at depth $depth equals var $name stack $stack2 depth $depth2 index $index2 |- not the right var, check next -| | :: do variable $name at index $i of stack $stack at depth $depth? :vars: variable $different = index $j of stack $stack2 at depth $depth2 | :vars temp: variable $different = index $j of stack $stack2 at depth $depth2 |- variable isn't declared yet, so declare it -| | :: do variable $name at index $i of stack $stack at depth $depth | :set vars: declare variable $name = index $i of stack $stack at depth $depth :vars: variable $name = index $i of stack $stack at depth $depth :: vars temp -> vars | :: vars temp -> vars :vars temp: variable $name = index $i of stack $stack at depth $depth | :vars: variable $name = index $i of stack $stack at depth $depth | :: vars temp -> vars | | :: process pattern? :stack: $stack? :pattern: $symbol :index: $i :current stride depth: $depth? | :check facts: check stack $stack at depth $depth matches symbol $symbol at index $i :: increment length | :: process pattern | |--------------------| | :: process effects? :effects: $effectid | :: get effect $effectid :: push effects start :: process stack :: process items :: push effects end | :: process effects | | :: push effects start | :push effects: start fact to push | :: push effects end | :push effects: end fact to push | :: process stack :stack: $stack? :items: $symbol? :index: $i? | :push effects: stack $stack | :: process items? :stack: $stack? :items: $symbol :index: $i | :push effects: symbol $symbol | :: process items? :stack: $stack? :items: variable $name :index: $i | :push effects: variable $name | :: process items | |--------------------| | :emit: rule header $ruleid | :out: rule header $ruleid | :emit: check stack heights? :strides: check stack $stack has at least depth $depth | :out: check stack $stack has at least depth $depth | :emit: check stack heights | | :emit: check facts lengths? :check fact lengths: check stack $stack depth $depth has length $length | :out: check stack $stack depth $depth has length $length | :emit: check facts lengths | | :emit: check facts constant symbol matches? :check facts: check stack $stack at depth $depth matches symbol $symbol at index $index | :out: check stack $stack at depth $depth matches symbol $symbol at index $index | :emit: check facts constant symbol matches | | :emit: set variables? :set vars: declare variable $name = index $i of stack $stack at depth $depth | :out: declare variable $name = index $i of stack $stack at depth $depth | :emit: set variables | | :emit: check variables equality? :check vars: check index $i of top of stack $stack at depth $depth equals value of var $name | :out: check index $i of top of stack $stack at depth $depth equals value of var $name | :emit: check variables equality | | :emit: pop causes ? :pop causes: $a $b | :out: $a $b | :emit: pop causes | | :emit: push effects -> push effects reversed? :push effects: $a | :push effects reversed: $a | :emit: push effects -> push effects reversed? :push effects: $a $b | :push effects reversed: $a $b | :emit: push effects -> push effects reversed? :push effects: $a $b $c $d | :push effects reversed: $a $b $c $d | :emit: push effects -> push effects reversed | | :emit: push effects reversed -> out? :push effects reversed: $a $b $c $d | :out: $a $b $c $d | :emit: push effects reversed -> out? :push effects reversed: $a $b | :out: $a $b | :emit: push effects reversed -> out? :push effects reversed: $a | :out: $a | :emit: push effects reversed -> out | | :emit: push effects | :emit: push effects -> push effects reversed :emit: push effects reversed -> out | :emit: rule footer | :out: spacer :out: rule footer | :: emit rule $ruleid | :: emit :emit: . rule header $ruleid . check stack heights . check facts lengths . check facts constant symbol matches . set variables . check variables equality . pop causes . push effects . rule footer | :: emit step function | :emit: . step function header . try each rule . step function footer | :emit: step function header | :out: step function header :out: spacer | :emit: step function footer | :out: spacer :out: step function footer | :emit: try each rule? :try rules: try rule $ruleid | :out: try rule $ruleid | :emit: try each rule | | :: emit | |- :vim:sw=3:ts=3:et: -| |#===============#| | :: translate? :out: spacer | :final out: [] | :: translate? :out: $a | :final out: $a | :: translate? :out: $a $b | :final out: $a $b | :: translate? :out: $a $b $c | :final out: $a $b $c | :: translate? :out: $a $b $c $d | :final out: $a $b $c $d | :: translate? :out: $a $b $c $d $e | :final out: $a $b $c $d $e | :: translate? :out: $a $b $c $d $e $f | :final out: $a $b $c $d $e $f | :: translate? :out: $a $b $c $d $e $f $g | :final out: $a $b $c $d $e $f $g | :: translate? :out: $a $b $c $d $e $f $g $h | :final out: $a $b $c $d $e $f $g $h | :: translate? :out: $a $b $c $d $e $f $g $h $i | :final out: $a $b $c $d $e $f $g $h $i | :: translate? :out: $a $b $c $d $e $f $g $h $i $j | :final out: $a $b $c $d $e $f $g $h $i $j | :: translate? :out: $a $b $c $d $e $f $g $h $i $j $k | :final out: $a $b $c $d $e $f $g $h $i $j $k | :: translate? :out: $a $b $c $d $e $f $g $h $i $j $k $l | :final out: $a $b $c $d $e $f $g $h $i $j $k $l | :: translate? :out: $a $b $c $d $e $f $g $h $i $j $k $l $m | :final out: $a $b $c $d $e $f $g $h $i $j $k $l $m | :: translate? :out: $a $b $c $d $e $f $g $h $i $j $k $l $m $n | :final out: $a $b $c $d $e $f $g $h $i $j $k $l $m $n | :: translate? :out: $a $b $c $d $e $f $g $h $i $j $k $l $m $n $o | :final out: $a $b $c $d $e $f $g $h $i $j $k $l $m $n $o | :: translate? :out: $a $b $c $d $e $f $g $h $i $j $k $l $m $n $o $p | :final out: $a $b $c $d $e $f $g $h $i $j $k $l $m $n $o $p | :: translate? :out: $a $b $c $d $e $f $g $h $i $j $k $l $m $n $o $p $q | :final out: $a $b $c $d $e $f $g $h $i $j $k $l $m $n $o $p $q | :: translate | |#========#| ||«@js« window.init && window.init(`{"sections":3,"stacks1":["try rules","check fact lengths","check facts","set vars","pop causes","strides"],"stacks2":["out"]}`)