using import array # define table `buf` with efficient dynamic array storage. this array acts as an O(1) index over (i, ...). array buf index : s32 value : s32 # add initial row to buf then buf 8 0 # define a case: conjuctive terms evaluated in order of declaration. # this is a semi-naive case, marked by the presence of a `new` term. case new buf i x d = div (band i (sub 0 i)) 2 # (i & -i) / 2 ne d 0 # d != 0 i0 = sub i d # left branch index i1 = add i d # right branch index xn = add x 1 cue buf i0 xn cue buf i1 xn # debug-print contents of buf. will output: *** buf 1 3 2 2 3 3 4 1 5 3 6 2 7 3 8 0 9 3 10 2 11 3 12 1 13 3 14 2 15 3 dump buf
WIP of my current compiler named LRDL, here's one of my test cases
#devlog #LRDL