#!/bin/sh set -e -u -f LC_ALL=C __ALLOC=1 # Starting heap at 1 because 0 is the null pointer. _malloc() { # $2 = object size : $((_$__ALLOC = $2)) # Track object size : $(($1 = $__ALLOC + 1)) : $((__ALLOC += $2 + 1)) } __c2i_0=48 __c2i_1=49 __c2i_2=50 __c2i_3=51 __c2i_4=52 __c2i_5=53 __c2i_6=54 __c2i_7=55 __c2i_8=56 __c2i_9=57 __c2i_a=97 __c2i_b=98 __c2i_c=99 __c2i_d=100 __c2i_e=101 __c2i_f=102 __c2i_g=103 __c2i_h=104 __c2i_i=105 __c2i_j=106 __c2i_k=107 __c2i_l=108 __c2i_m=109 __c2i_n=110 __c2i_o=111 __c2i_p=112 __c2i_q=113 __c2i_r=114 __c2i_s=115 __c2i_t=116 __c2i_u=117 __c2i_v=118 __c2i_w=119 __c2i_x=120 __c2i_y=121 __c2i_z=122 __c2i_A=65 __c2i_B=66 __c2i_C=67 __c2i_D=68 __c2i_E=69 __c2i_F=70 __c2i_G=71 __c2i_H=72 __c2i_I=73 __c2i_J=74 __c2i_K=75 __c2i_L=76 __c2i_M=77 __c2i_N=78 __c2i_O=79 __c2i_P=80 __c2i_Q=81 __c2i_R=82 __c2i_S=83 __c2i_T=84 __c2i_U=85 __c2i_V=86 __c2i_W=87 __c2i_X=88 __c2i_Y=89 __c2i_Z=90 char_to_int() { case $1 in [[:alnum:]]) __c=$((__c2i_$1)) ;; ' ') __c=32 ;; '!') __c=33 ;; '"') __c=34 ;; '#') __c=35 ;; '$') __c=36 ;; '%') __c=37 ;; '&') __c=38 ;; "'") __c=39 ;; '(') __c=40 ;; ')') __c=41 ;; '*') __c=42 ;; '+') __c=43 ;; ',') __c=44 ;; '-') __c=45 ;; '.') __c=46 ;; '/') __c=47 ;; ':') __c=58 ;; ';') __c=59 ;; '<') __c=60 ;; '=') __c=61 ;; '>') __c=62 ;; '?') __c=63 ;; '@') __c=64 ;; '[') __c=91 ;; '\') __c=92 ;; ']') __c=93 ;; '^') __c=94 ;; '_') __c=95 ;; '`') __c=96 ;; '{') __c=123 ;; '|') __c=124 ;; '}') __c=125 ;; '~') __c=126 ;; *) __c=$(printf "%d" "'$1"); __c=$((__c > 0 ? __c : 256 + __c)) ;; esac } next_sub_buffer() { if [ -z "$__us_buf256" ]; then if [ ${#__str} -ge 256 ]; then __temp="${__str#????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????}" __us_buf256="${__str%"$__temp"}" __str="$__temp" else __us_buf256="$__str" __str= fi fi if [ -z "$__us_buf16" ]; then if [ ${#__us_buf256} -ge 16 ]; then __temp="${__us_buf256#????????????????}" __us_buf16="${__us_buf256%"$__temp"}" __us_buf256="$__temp" else __us_buf16="$__us_buf256" __us_buf256= fi fi } unpack_escaped_string() { # $1 = string, $2 = size (optional) __str="$1" # Allocates enough space for all characters, assuming that no character is escaped _malloc __addr $((${2:-${#__str} + 1})) __ptr=$__addr __end=$((__ptr + ${2:-${#__str} + 1})) # End of allocated memory __us_buf16= __us_buf256= while [ ! -z "$__str" ] || [ ! -z "$__us_buf256" ] ; do next_sub_buffer while [ ! -z "$__us_buf16" ]; do case "$__us_buf16" in '\'*) __us_buf16="${__us_buf16#?}" # Remove the current char from $__us_buf16 if [ -z "$__us_buf16" ]; then next_sub_buffer; fi case "$__us_buf16" in '0'*) __c=0 ;; 'a'*) __c=7 ;; 'b'*) __c=8 ;; 'f'*) __c=12 ;; 'n'*) __c=10 ;; 'r'*) __c=13 ;; 't'*) __c=9 ;; 'v'*) __c=11 ;; '\'*) __c=92 ;; '"'*) __c=34 ;; "'"*) __c=39 ;; '?'*) __c=63 ;; '$'*) __c=36 ;; # Not in C, used to escape variable expansion between double quotes *) echo "invalid escape in string: $__us_buf16"; exit 1 ;; esac __us_buf16="${__us_buf16#?}" # Remove the current char from $__us_buf16 ;; *) char_to_int "${__us_buf16%"${__us_buf16#?}"}" __us_buf16="${__us_buf16#?}" # Remove the current char from $__us_buf16 ;; esac : $((_$__ptr = __c)) : $((__ptr += 1)) done done while [ $__ptr -le $__end ]; do : $((_$__ptr = 0)) : $((__ptr += 1)) done } #_ Define a string, and return a reference to it in the varible taken as argument. #_ If the variable is already defined, this function does nothing. #_ Note that it's up to the caller to ensure that no 2 strings share the same variable. defstr() { # $1 = variable name, $2 = string, $3 = size (optional) set +u # Necessary to allow the variable to be empty if [ $(($1)) -eq 0 ]; then unpack_escaped_string "$2" $3 : $(($1 = __addr)) fi set -u } defstr __str_0 "RD?naeloob,?xelpmoc,cc/llac,?citebahpla-rahc,<,dnuor,dna,etouq,gnirts,raaaac,radddc,raaddc,?=>ic-gnirts,esle,>,!rdc-tes,?qe,oludom,tsil>-rotcev,htgnel-gnirts,?tsil,fer-gnirts,-,nruter,esac,rddddc,certel,gnicilps-etouqnu,!tes,?rebmun,daol,rdadac,ro,rac,tneitouq,?orez,xam,/,?evitisop,?=>ic-rahc,ecaps,roolf,?tcaxe,?laer,?=>gnirts,rdaddc,raddac,adbmal,gniliec,rdaadc,elif-tuptuo-htiw-llac,fi,mcl,tropxe,gnirtsbus,!tes-gnirts,?evitagen,+,raaadc,!rac-tes,*,etouqnu,?=,bat,?ddo,noitaunitnoc-tnerruc-htiw-llac,nim,?=>rahc,gnirts-ekam,?=-rahc,?ciremun-rahc,radadc,dnoc,=,dneppa-gnirts,trop-tuptuo-esolc,cossa,dcg,qmem,?>ic-gnirts,hcae-rof,redniamer,?-lobmys,?>ic-rahc,?>gnirts,rebmem,?neve,vmem,?ecapsetihw-rahc,elif-tuptuo-nepo,lave,?>rahc,?esac-rewol-rahc,raadc,?esac-reppu-rahc,?trop-tuptuo,?trop-tupni,elif-tupni-nepo,trop-tupni-esolc,tsil>-gnirts,raaac,raddc,rdddac,?-rebmun,rebmun>-gnirts,enilwen,raac,esacnwod-rahc,qssa,vssa,?regetni,?vqe,fer-tsil,trop-tupni-tnerruc,radac,dneppa,rotcev,?erudecorp,radc,rdddc,sba,trop-tuptuo-tnerruc,rotcev>-t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AmkAmk!):nlkt!2:nlkv.!4:nlkv/!U>:nlkv0!':nlkv1!(:nlkv2!::nlkv3!V(:nlkv4!V\$:nlkv5!V6:nlkv6!+:nlkv7!.:nlkv8!>:nlkv9!U::nlkv;!UC:nlkv:nk:nki&ux9!VM:nk:nk:nk:nk:nki&v0v.utvC!0:nlkv:!*:nlkuy\0" _input=$__str_0 : $((s = 0)) _putstr() { # s: $2 set -- $@ $s s=$2 while [ $((_$s)) != 0 ]; do printf %b \\0$(((_$s)/64))$(((_$s)/8%8))$(((_$s)%8)) : $(((s += 1) - 1)) done : $((__tmp = $1)) $((s = $3)) $(($1 = __tmp)) } #_ rib struct member declarations readonly __field0=0 readonly __field1=1 readonly __field2=2 readonly __sizeof__rib=3 _stack=$(((0 << 1) | 1)) _pc=$(((0 << 1) | 1)) _FALSE=$(((0 << 1) | 1)) _symbol_table=$(((0 << 1) | 1)) _max_nb_objs=100000 _rib_nb_fields=4 _space_size=$((_max_nb_objs * _rib_nb_fields)) _heap_start=0 _heap_mid=0 _heap_end=0 _alloc=0 _alloc_limit=0 _scan=0 _init_heap() { _malloc _heap_start $((1 * (_space_size + 1))) if [ $((_heap_start & (1 == 1))) != 0 ] ; then : $(((_heap_start += 1) - 1)) fi if [ $((! _heap_start)) != 0 ] ; then exit 7 fi _heap_mid=$((_heap_start + (_space_size >> 1))) _heap_end=$((_heap_start + _space_size)) _alloc=$_heap_start _alloc_limit=$_heap_mid _stack=$(((0 << 1) | 1)) } : $((copy = field0 = ptr = o = 0)) _copy() { # o: $2 set -- $@ $o $ptr $field0 $copy o=$2 if [ $((!(o & 1))) != 0 ] ; then ptr=$o field0=$((_$((ptr + 0)))) if [ $field0 = 0 ] ; then copy=$((_$((ptr + 1)))) else copy=$_alloc : $((_$(((ptr += 1) - 1)) = 0)) : $((_$(((_alloc += 1) - 1)) = field0)) : $((_$(((_alloc += 1) - 1)) = _$(((ptr += 1) - 1)))) : $((_$(((_alloc += 1) - 1)) = _$ptr)) : $((_$(((_alloc += 1) - 1)) = (0 << 1) | 1)) : $((_$((ptr + -1)) = copy)) fi : $(($1 = copy)) : $((__tmp = $1)) $((o = $3)) $((ptr = $4)) $((field0 = $5)) $((copy = $6)) $(($1 = __tmp)) return fi : $(($1 = o)) : $((__tmp = $1)) $((o = $3)) $((ptr = $4)) $((field0 = $5)) $((copy = $6)) $(($1 = __tmp)) } : $((to_space = 0)) _gc() { set -- $@ $to_space if [ $_alloc_limit = $_heap_mid ] ; then to_space=$_heap_mid _alloc_limit=$_heap_end else to_space=$_heap_start _alloc_limit=$_heap_mid fi _alloc=$to_space _copy _stack $_stack _copy _pc $_pc _copy _FALSE $_FALSE _scan=$to_space while [ $_scan != $_alloc ]; do _copy _$_scan $((_$_scan)) : $(((_scan += 1) - 1)) done : $((__tmp = $1)) $((to_space = $2)) $(($1 = __tmp)) } : $((x = 0)) _pop() { set -- $@ $x x=$((_$((_stack + __field0)))) _stack=$((_$((_stack + __field1)))) : $(($1 = x)) : $((__tmp = $1)) $((x = $2)) $(($1 = __tmp)) } : $((tag = car = 0)) _push2() { # car: $2, tag: $3 set -- $@ $car $tag car=$2 tag=$3 : $((_$(((_alloc += 1) - 1)) = car)) : $((_$(((_alloc += 1) - 1)) = _stack)) : $((_$(((_alloc += 1) - 1)) = tag)) : $((_$(((_alloc += 1) - 1)) = (0 << 1) | 1)) _stack=$((_alloc - 4)) if [ $_alloc = $_alloc_limit ] ; then _gc __ fi : $((__tmp = $1)) $((car = $4)) $((tag = $5)) $(($1 = __tmp)) } : $((allocated = old_stack = tag = cdr = car = 0)) _alloc_rib() { # car: $2, cdr: $3, tag: $4 set -- $@ $car $cdr $tag $old_stack $allocated car=$2 cdr=$3 tag=$4 _push2 __ $car $cdr old_stack=$((_$((_stack + __field1)))) allocated=$_stack : $((_$((allocated + __field1)) = _$((allocated + __field2)))) : $((_$((allocated + __field2)) = tag)) _stack=$old_stack : $(($1 = allocated)) : $((__tmp = $1)) $((car = $5)) $((cdr = $6)) $((tag = $7)) $((old_stack = $8)) $((allocated = $9)) $(($1 = __tmp)) } : $((allocated = old_stack = tag = cdr = car = 0)) _alloc_rib2() { # car: $2, cdr: $3, tag: $4 set -- $@ $car $cdr $tag $old_stack $allocated car=$2 cdr=$3 tag=$4 _push2 __ $car $tag old_stack=$((_$((_stack + __field1)))) allocated=$_stack : $((_$((allocated + __field1)) = cdr)) _stack=$old_stack : $(($1 = allocated)) : $((__tmp = $1)) $((car = $5)) $((cdr = $6)) $((tag = $7)) $((old_stack = $8)) $((allocated = $9)) $(($1 = __tmp)) } : $((i = lst = 0)) _list_tail() { # lst: $2, i: $3 set -- $@ $lst $i lst=$2 i=$3 while [ $(((i -= 1) + 1)) != 0 ]; do lst=$((_$((lst + __field1)))) done : $(($1 = lst)) : $((__tmp = $1)) $((lst = $4)) $((i = $5)) $(($1 = __tmp)) } : $((i = lst = 0)) _inst_tail() { # lst: $2, i: $3 set -- $@ $lst $i lst=$2 i=$3 while [ $(((i -= 1) + 1)) != 0 ]; do lst=$((_$((lst + __field2)))) done : $(($1 = lst)) : $((__tmp = $1)) $((lst = $4)) $((i = $5)) $(($1 = __tmp)) } : $((__t1 = i = lst = 0)) _list_ref() { # lst: $2, i: $3 set -- $@ $lst $i $__t1 lst=$2 i=$3 _list_tail __t1 $lst $i : $(($1 = _$((__t1 + __field0)))) : $((__tmp = $1)) $((lst = $4)) $((i = $5)) $((__t1 = $6)) $(($1 = __tmp)) } : $((__t1 = return_value = o = 0)) _get_opnd() { # o: $2 set -- $@ $o $return_value $__t1 o=$2 if [ $((o & 1)) != 0 ] ; then _list_tail __t1 $_stack $((o >> 1)) return_value=$__t1 else return_value=$o fi : $(($1 = _$((return_value + __field0)))) : $((__tmp = $1)) $((o = $3)) $((return_value = $4)) $((__t1 = $5)) $(($1 = __tmp)) } : $((s = 0)) _get_cont() { set -- $@ $s s=$_stack while [ $((!(_$((s + __field2)) >> 1))) != 0 ]; do s=$((_$((s + __field1)))) done : $(($1 = s)) : $((__tmp = $1)) $((s = $2)) $(($1 = __tmp)) } : $((l = list = 0)) _lst_length() { # list: $2 set -- $@ $list $l list=$2 l=0 while [ $((!(list & 1))) != 0 ] && [ $((_$((list + __field2)) >> 1)) = 0 ]; do : $((l += 1)) list=$((_$((list + __field1)))) done : $(($1 = (l << 1) | 1)) : $((__tmp = $1)) $((list = $3)) $((l = $4)) $(($1 = __tmp)) } _pos=0 _get_byte() { : $(($1 = _$((_input + (_pos += 1) - 1)))) } : $((__t1 = x = 0)) _get_code() { set -- $@ $x $__t1 _get_byte __t1 x=$((__t1 - 35)) : $(($1 = (x < 0) ? 57 : x)) : $((__tmp = $1)) $((x = $2)) $((__t1 = $3)) $(($1 = __tmp)) } : $((x = n = 0)) _get_int() { # n: $2 set -- $@ $n $x n=$2 _get_code x : $((n *= (92 / 2))) if [ $x -lt $((92 / 2)) ] ; then : $(($1 = n + x)) else _get_int $1 $(((n + x) - (92 / 2))) fi : $((__tmp = $1)) $((n = $3)) $((x = $4)) $(($1 = __tmp)) } : $((__t1 = n = 0)) _symbol_ref() { # n: $2 set -- $@ $n $__t1 n=$2 _list_ref __t1 $_symbol_table $n : $(($1 = __t1)) : $((__tmp = $1)) $((n = $3)) $((__t1 = $4)) $(($1 = __tmp)) } : $((__t1 = root = sym = list = name = 0)) _create_sym() { # name: $2 set -- $@ $name $list $sym $root $__t1 name=$2 _lst_length __t1 $name _alloc_rib list $name $__t1 $(((3 << 1) | 1)) _alloc_rib sym $_FALSE $list $(((2 << 1) | 1)) _alloc_rib root $sym $_symbol_table $(((0 << 1) | 1)) : $(($1 = root)) : $((__tmp = $1)) $((name = $3)) $((list = $4)) $((sym = $5)) $((root = $6)) $((__t1 = $7)) $(($1 = __tmp)) } : $((__t1 = c = accum = n = 0)) _build_sym_table() { set -- $@ $n $accum $c $__t1 _get_int n 0 while [ $n -gt 0 ]; do : $(((n -= 1) + 1)) _create_sym __t1 $((_$((_FALSE + __field1)))) _symbol_table=$__t1 done accum=$((_$((_FALSE + __field1)))) while [ 1 != 0 ]; do _get_byte c if [ $c = 44 ] ; then _create_sym __t1 $accum _symbol_table=$__t1 accum=$((_$((_FALSE + __field1)))) continue fi if [ $c = 59 ] ; then break fi _alloc_rib __t1 $(((c << 1) | 1)) $accum $(((0 << 1) | 1)) accum=$__t1 done _create_sym __t1 $accum _symbol_table=$__t1 : $((__tmp = $1)) $((n = $2)) $((accum = $3)) $((c = $4)) $((__t1 = $5)) $(($1 = __tmp)) } : $((c = 0)) _set_global() { # c: $2 set -- $@ $c c=$2 : $((_$((_$((_symbol_table + __field0)) + __field0)) = c)) _symbol_table=$((_$((_symbol_table + __field1)))) : $((__tmp = $1)) $((c = $3)) $(($1 = __tmp)) } defarr() { _malloc $1 $2; } defarr _weights 6 _init_weights() { : $((_$((_weights + 0)) = 20)) : $((_$((_weights + 1)) = 30)) : $((_$((_weights + 2)) = 0)) : $((_$((_weights + 3)) = 10)) : $((_$((_weights + 4)) = 11)) : $((_$((_weights + 5)) = 4)) } : $((__t1 = c = x = op = d = n = 0)) _decode() { set -- $@ $n $d $op $x $c $__t1 while [ 1 != 0 ]; do _get_code x n=$x op=-1 while [ $n -gt $((2 + (d = _$((_weights + (op += 1)))))) ]; do : $((n -= (d + 3))) done if [ $x -gt 90 ] ; then op=4 _pop n else if [ $((! op)) != 0 ] ; then _push2 __ $(((0 << 1) | 1)) $(((0 << 1) | 1)) fi if [ $n -ge $d ] ; then if [ $n = $d ] ; then _get_int __t1 0 n=$(((__t1 << 1) | 1)) else _get_int __t1 $(((n - d) - 1)) _symbol_ref __t1 $__t1 n=$__t1 fi else if [ $op -lt 3 ] ; then _symbol_ref __t1 $n n=$__t1 else n=$(((n << 1) | 1)) fi fi if [ $op -gt 4 ] ; then _pop __t1 _alloc_rib2 __t1 $n $(((0 << 1) | 1)) $__t1 _alloc_rib __t1 $__t1 $((_$((_FALSE + __field1)))) $(((1 << 1) | 1)) n=$__t1 if [ $_stack = $(((0 << 1) | 1)) ] ; then break fi op=3 elif [ $op -gt 0 ] ; then : $(((op -= 1) + 1)) else op=0 fi fi _alloc_rib c $(((op << 1) | 1)) $n 0 : $((_$((c + __field2)) = _$((_stack + __field0)))) : $((_$((_stack + __field0)) = c)) done _pc=$((_$((_$((n + __field0)) + __field2)))) : $((__tmp = $1)) $((n = $2)) $((d = $3)) $((op = $4)) $((x = $5)) $((c = $6)) $((__t1 = $7)) $(($1 = __tmp)) } : $((str = current = length = i = s = 0)) _scm2str() { # s: $2 set -- $@ $s $i $length $current $str s=$2 i=0 length=$((_$((s + __field1)) >> 1)) current=$((_$((s + __field0)))) _malloc str $((length + 1)) i=0 while [ $i -lt $length ]; do : $((_$((str + i)) = (_$((current + __field0)) >> 1))) current=$((_$((current + __field1)))) : $(((i += 1) - 1)) done : $((_$((str + length)) = __NUL__)) : $(($1 = str)) : $((__tmp = $1)) $((s = $3)) $((i = $4)) $((length = $5)) $((current = $6)) $((str = $7)) $(($1 = __tmp)) } : $((x = 0)) _bool2scm() { # x: $2 set -- $@ $x x=$2 if [ $x != 0 ] ; then : $(($1 = _$((_FALSE + __field0)))) else : $(($1 = _FALSE)) fi : $((__tmp = $1)) $((x = $3)) $(($1 = __tmp)) } : $((__t1 = filename = num_args = bytes_read = success = buffer = file = arg = new_rib = z = y = x = no = 0)) _prim() { # no: $2 set -- $@ $no $x $y $z $new_rib $arg $file $buffer $success $bytes_read $num_args $filename $__t1 no=$2 _malloc buffer 1 if [ $no = 0 ] ; then _alloc_rib __t1 $(((0 << 1) | 1)) $(((0 << 1) | 1)) $(((0 << 1) | 1)) new_rib=$__t1 _pop z _pop y _pop x : $((_$((new_rib + __field0)) = x)) : $((_$((new_rib + __field1)) = y)) : $((_$((new_rib + __field2)) = z)) _push2 __ $new_rib $(((0 << 1) | 1)) elif [ $no = 1 ] ; then _pop x _close __ $((x >> 1)) elif [ $no = 2 ] ; then _pop y _pop x : $((_$((buffer + 0)) = (x >> 1))) _write success $((y >> 1)) $buffer 1 if [ $success != 1 ] ; then printf "Cannot write to file." fi _push2 __ $((_$((_FALSE + __field0)))) $(((0 << 1) | 1)) elif [ $no = 3 ] ; then _pop x _read bytes_read $((x >> 1)) $buffer 1 if [ $((! bytes_read)) != 0 ] ; then _push2 __ $((_$((_FALSE + __field1)))) $(((0 << 1) | 1)) else _push2 __ $(((_$((buffer + 0)) << 1) | 1)) $(((0 << 1) | 1)) fi elif [ $no = 4 ] ; then _pop x _scm2str filename $x _open file $filename 1 if [ $file -lt 0 ] ; then _push2 __ $_FALSE $(((0 << 1) | 1)) else _push2 __ $(((file << 1) | 1)) $(((0 << 1) | 1)) fi _free __ $filename elif [ $no = 5 ] ; then _pop x _scm2str filename $x _open file $filename 0 if [ $file -lt 0 ] ; then _push2 __ $_FALSE $(((0 << 1) | 1)) else _push2 __ $(((file << 1) | 1)) $(((0 << 1) | 1)) fi _free __ $filename elif [ $no = 6 ] ; then _push2 __ $(((1 << 1) | 1)) $(((0 << 1) | 1)) elif [ $no = 7 ] ; then _push2 __ $(((0 << 1) | 1)) $(((0 << 1) | 1)) elif [ $no = 8 ] ; then _pop y _pop x num_args=0 : $((_$((_$((_FALSE + __field0)) + __field0)) = x)) arg=$y while [ $arg != $((_$((_FALSE + __field1)))) ]; do _push2 __ $arg $(((0 << 1) | 1)) arg=$((_$((_stack + __field0)))) : $((_$((_stack + __field0)) = _$((arg + __field0)))) arg=$((_$((arg + __field1)))) : $(((num_args += 1) - 1)) done _push2 __ $(((num_args << 1) | 1)) $(((0 << 1) | 1)) x=$((_$((_$((_FALSE + __field0)) + __field0)))) : $(($1 = x)) : $((__tmp = $1)) $((no = $3)) $((x = $4)) $((y = $5)) $((z = $6)) $((new_rib = $7)) $((arg = $8)) $((file = $9)) $((buffer = ${10})) $((success = ${11})) $((bytes_read = ${12})) $((num_args = ${13})) $((filename = ${14})) $((__t1 = ${15})) $(($1 = __tmp)) return elif [ $no = 9 ] ; then _pop x _push2 __ $x $(((0 << 1) | 1)) elif [ $no = 10 ] ; then _pop __ elif [ $no = 11 ] ; then _pop x _pop __ _push2 __ $x $(((0 << 1) | 1)) elif [ $no = 12 ] ; then x=$((_$((_$((_stack + __field0)) + __field0)))) y=$((_$((_stack + __field1)))) _alloc_rib __t1 $x $y $(((1 << 1) | 1)) : $((_$((_stack + __field0)) = __t1)) elif [ $no = 13 ] ; then _pop x _bool2scm __t1 $((!(x & 1))) _push2 __ $__t1 $(((0 << 1) | 1)) elif [ $no = 14 ] ; then _pop x _push2 __ $((_$((x + __field0)))) $(((0 << 1) | 1)) elif [ $no = 15 ] ; then _pop x _push2 __ $((_$((x + __field1)))) $(((0 << 1) | 1)) elif [ $no = 16 ] ; then _pop x _push2 __ $((_$((x + __field2)))) $(((0 << 1) | 1)) elif [ $no = 17 ] ; then _pop y _pop x _push2 __ $((_$((x + __field0)) = y)) $(((0 << 1) | 1)) elif [ $no = 18 ] ; then _pop y _pop x _push2 __ $((_$((x + __field1)) = y)) $(((0 << 1) | 1)) elif [ $no = 19 ] ; then _pop y _pop x _push2 __ $((_$((x + __field2)) = y)) $(((0 << 1) | 1)) elif [ $no = 20 ] ; then _pop y _pop x _bool2scm __t1 $((x == y)) _push2 __ $__t1 $(((0 << 1) | 1)) elif [ $no = 21 ] ; then _pop y _pop x _bool2scm __t1 $(((x >> 1) < (y >> 1))) _push2 __ $__t1 $(((0 << 1) | 1)) elif [ $no = 22 ] ; then _pop y _pop x _push2 __ $(((x + y) - 1)) $(((0 << 1) | 1)) elif [ $no = 23 ] ; then _pop y _pop x _push2 __ $(((x - y) + 1)) $(((0 << 1) | 1)) elif [ $no = 24 ] ; then _pop y _pop x _push2 __ $(((((x >> 1) * (y >> 1)) << 1) | 1)) $(((0 << 1) | 1)) elif [ $no = 25 ] ; then _pop y _pop x if [ $((y >> 1)) -lt 0 ] ; then _push2 __ $(((-((x >> 1) / -(y >> 1)) << 1) | 1)) $(((0 << 1) | 1)) else _push2 __ $(((((x >> 1) / (y >> 1)) << 1) | 1)) $(((0 << 1) | 1)) fi elif [ $no = 26 ] ; then _pop x exit $((x >> 1)) else exit 6 fi _free __ $buffer : $(($1 = (0 << 1) | 1)) : $((__tmp = $1)) $((no = $3)) $((x = $4)) $((y = $5)) $((z = $6)) $((new_rib = $7)) $((arg = $8)) $((file = $9)) $((buffer = ${10})) $((success = ${11})) $((bytes_read = ${12})) $((num_args = ${13})) $((filename = ${14})) $((__t1 = ${15})) $(($1 = __tmp)) } : $((__t1 = opnd = x = p = rest = new_pc = k = c2 = s2 = proc = jump = vari = nparams = nparams_vari = nargs = instr = i = 0)) _run() { set -- $@ $i $instr $nargs $nparams_vari $nparams $vari $jump $proc $s2 $c2 $k $new_pc $rest $p $x $opnd $__t1 while [ 1 != 0 ]; do instr=$((_$((_pc + __field0)) >> 1)) if [ $instr = 5 ] ; then exit 0 elif [ $instr = 0 ] ; then jump=$((_$((_pc + __field2)) == ((0 << 1) | 1))) _get_opnd proc $((_$((_pc + __field1)))) while [ 1 != 0 ]; do if [ $((_$((proc + __field0)) & 1)) != 0 ] ; then _pop __ _prim proc $((_$((proc + __field0)) >> 1)) if [ $((!(proc & 1))) != 0 ] ; then continue fi if [ $jump != 0 ] ; then _get_cont _pc : $((_$((_stack + __field1)) = _$((_pc + __field0)))) fi _pc=$((_$((_pc + __field2)))) else _pop __t1 nargs=$((__t1 >> 1)) _alloc_rib __t1 $(((0 << 1) | 1)) $proc $(((0 << 1) | 1)) s2=$__t1 proc=$((_$((s2 + __field1)))) : $((_$((_pc + __field0)) = _$((proc + __field0)))) nparams_vari=$((_$((_$((proc + __field0)) + __field0)) >> 1)) nparams=$((nparams_vari >> 1)) vari=$((nparams_vari & 1)) if [ $((vari ? (nparams > nargs) : (nparams != nargs))) != 0 ] ; then printf "Unexpected number of arguments\n" exit 1 fi : $((nargs -= nparams)) if [ $vari != 0 ] ; then rest=$((_$((_FALSE + __field1)))) i=0 while [ $i -lt $nargs ]; do _pop __t1 _alloc_rib __t1 $__t1 $rest $s2 rest=$__t1 s2=$((_$((rest + __field2)))) : $((_$((rest + __field2)) = (0 << 1) | 1)) : $((i += 1)) done _alloc_rib __t1 $rest $s2 $(((0 << 1) | 1)) s2=$__t1 fi i=0 while [ $i -lt $nparams ]; do _pop __t1 _alloc_rib __t1 $__t1 $s2 $(((0 << 1) | 1)) s2=$__t1 : $((i += 1)) done nparams=$((nparams + vari)) _list_tail __t1 $s2 $nparams c2=$__t1 if [ $jump != 0 ] ; then _get_cont k : $((_$((c2 + __field0)) = _$((k + __field0)))) : $((_$((c2 + __field2)) = _$((k + __field2)))) else : $((_$((c2 + __field0)) = _stack)) : $((_$((c2 + __field2)) = _$((_pc + __field2)))) fi _stack=$s2 new_pc=$((_$((_pc + __field0)))) : $((_$((_pc + __field0)) = (instr << 1) | 1)) _pc=$((_$((new_pc + __field2)))) fi break done elif [ $instr = 1 ] ; then x=$((_$((_stack + __field0)))) if [ $((_$((_pc + __field1)) & 1)) != 0 ] ; then _list_tail __t1 $_stack $((_$((_pc + __field1)) >> 1)) opnd=$__t1 else opnd=$((_$((_pc + __field1)))) fi : $((_$((opnd + __field0)) = x)) _stack=$((_$((_stack + __field1)))) _pc=$((_$((_pc + __field2)))) elif [ $instr = 2 ] ; then _get_opnd __t1 $((_$((_pc + __field1)))) _push2 __ $__t1 $(((0 << 1) | 1)) _pc=$((_$((_pc + __field2)))) elif [ $instr = 3 ] ; then _push2 __ $((_$((_pc + __field1)))) $(((0 << 1) | 1)) _pc=$((_$((_pc + __field2)))) elif [ $instr = 4 ] ; then _pop p if [ $p != $_FALSE ] ; then _pc=$((_$((_pc + __field1)))) else _pc=$((_$((_pc + __field2)))) fi else exit 6 fi done : $((__tmp = $1)) $((i = $2)) $((instr = $3)) $((nargs = $4)) $((nparams_vari = $5)) $((nparams = $6)) $((vari = $7)) $((jump = $8)) $((proc = $9)) $((s2 = ${10})) $((c2 = ${11})) $((k = ${12})) $((new_pc = ${13})) $((rest = ${14})) $((p = ${15})) $((x = ${16})) $((opnd = ${17})) $((__t1 = ${18})) $(($1 = __tmp)) } : $((first = 0)) _setup_stack() { set -- $@ $first _push2 __ $(((0 << 1) | 1)) $(((0 << 1) | 1)) _push2 __ $(((0 << 1) | 1)) $(((0 << 1) | 1)) first=$((_$((_stack + __field1)))) : $((_$((_stack + __field1)) = (0 << 1) | 1)) : $((_$((_stack + __field2)) = first)) : $((_$((first + __field0)) = (5 << 1) | 1)) : $((_$((first + __field1)) = (0 << 1) | 1)) : $((_$((first + __field2)) = (0 << 1) | 1)) : $((__tmp = $1)) $((first = $2)) $(($1 = __tmp)) } : $((__t2 = __t1 = 0)) _init() { set -- $@ $__t1 $__t2 _init_weights __ _init_heap __ _alloc_rib __t1 $(((0 << 1) | 1)) $(((0 << 1) | 1)) $(((5 << 1) | 1)) _alloc_rib __t2 $(((0 << 1) | 1)) $(((0 << 1) | 1)) $(((5 << 1) | 1)) _alloc_rib __t1 $__t1 $__t2 $(((5 << 1) | 1)) _FALSE=$__t1 _build_sym_table __ _decode __ _alloc_rib __t1 $(((0 << 1) | 1)) $_symbol_table $(((1 << 1) | 1)) _set_global __ $__t1 _set_global __ $_FALSE _set_global __ $((_$((_FALSE + __field0)))) _set_global __ $((_$((_FALSE + __field1)))) _setup_stack __ _run __ : $((__tmp = $1)) $((__t1 = $2)) $((__t2 = $3)) $(($1 = __tmp)) } _main() { _init __ } #_ Character constants readonly __NUL__=0 #_ Runtime library _free() { # $2 = object to free __ptr=$(($2 - 1)) # Start of object __end=$((__ptr + _$__ptr)) # End of object while [ $__ptr -lt $__end ]; do unset "_$__ptr" : $((__ptr += 1)) done : $(($1 = 0)) # Return 0 } #_ Unpack a Shell string into an appropriately sized buffer unpack_string_to_buf() { # $1: Shell string, $2: Buffer, $3: Ends with EOF? __fgetc_buf="$1" __buffer=$2 __ends_with_eof=${3:-1} __fgetc_buf16= __stdin_buf256= __continue=1 while [ $__continue != 0 ] ; do if [ -z "$__stdin_buf256" ]; then if [ ${#__fgetc_buf} -ge 256 ]; then __temp="${__fgetc_buf#????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????}" __stdin_buf256="${__fgetc_buf%"$__temp"}" __fgetc_buf="$__temp" else __stdin_buf256="$__fgetc_buf" __fgetc_buf= fi fi if [ -z "$__fgetc_buf16" ]; then if [ ${#__stdin_buf256} -ge 16 ]; then __temp="${__stdin_buf256#????????????????}" __fgetc_buf16="${__stdin_buf256%"$__temp"}" __stdin_buf256="$__temp" else __fgetc_buf16="$__stdin_buf256" __stdin_buf256= __continue=0 fi fi while [ ! -z "$__fgetc_buf16" ]; do case "$__fgetc_buf16" in " "*) : $((_$__buffer = 32)) ;; "e"*) : $((_$__buffer = 101)) ;; "="*) : $((_$__buffer = 61)) ;; "t"*) : $((_$__buffer = 116)) ;; ";"*) : $((_$__buffer = 59)) ;; "i"*) : $((_$__buffer = 105)) ;; ")"*) : $((_$__buffer = 41)) ;; "("*) : $((_$__buffer = 40)) ;; "n"*) : $((_$__buffer = 110)) ;; "s"*) : $((_$__buffer = 115)) ;; "l"*) : $((_$__buffer = 108)) ;; "+"*) : $((_$__buffer = 43)) ;; "p"*) : $((_$__buffer = 112)) ;; "a"*) : $((_$__buffer = 97)) ;; "r"*) : $((_$__buffer = 114)) ;; "f"*) : $((_$__buffer = 102)) ;; "d"*) : $((_$__buffer = 100)) ;; "*"*) : $((_$__buffer = 42)) ;; *) char_to_int "${__fgetc_buf16%"${__fgetc_buf16#?}"}" : $((_$__buffer = __c)) ;; esac __fgetc_buf16="${__fgetc_buf16#?}" # Remove the first character : $((__buffer += 1)) # Move to the next buffer position done done if [ $__ends_with_eof -eq 0 ]; then # Ends with newline and not EOF? : $((_$__buffer = 10)) # Line ends with newline : $((__buffer += 1)) fi : $((_$__buffer = 0)) # Then \0 } refill_buffer() { # $1: fd __fd=$1 __buffer=$((__buffer_fd$__fd)) IFS= __ends_with_eof=0 read -r __temp_buf <&$__fd || __ends_with_eof=1 # Check that the buffer is large enough to unpack the line __buflen=$((__buflen_fd$__fd - 2)) # Minus 2 to account for newline and \0 __len=${#__temp_buf} if [ $__len -gt $__buflen ]; then # Free buffer and reallocate a new one double the line size __buflen=$((__len * 2)) _free __ $__buffer _malloc __buffer $__buflen : $((__buffer_fd$__fd = __buffer)) : $((__buflen_fd$__fd = __buflen)) fi unpack_string_to_buf "$__temp_buf" $__buffer $__ends_with_eof } read_byte() { # $2: fd __fd=$2 : $((__buffer=__buffer_fd$__fd)) : $((__cursor=__cursor_fd$__fd)) # The cursor is at the end of the buffer, we need to read the next line if [ $((_$((__buffer + __cursor)))) -eq 0 ]; then # Buffer has been read completely, read next line refill_buffer $__fd __cursor=0 # Reset cursor and reload buffer : $((__buffer=__buffer_fd$__fd)) if [ $((_$((__buffer + __cursor)))) -eq 0 ]; then : $(($1 = -1)) # EOF return fi fi : $(($1 = _$((__buffer + __cursor)))) : $((__cursor_fd$__fd = __cursor + 1)) # Increment cursor } _put_pstr() { : $(($1 = 0)); shift # Return 0 __addr=$1; shift while [ $((__c = _$__addr)) != 0 ]; do printf %b \\0$((__c/64))$((__c/8%8))$((__c%8)) : $((__addr += 1)) done } _malloc __buffer_fd0 1000 # Allocate buffer : $((_$__buffer_fd0 = 0)) # Init buffer to "" : $((__cursor_fd0 = 0)) # Make buffer empty : $((__buflen_fd0 = 1000)) # Init buffer length __state_fd0=0 # stdin __state_fd1=1 # stdout __state_fd2=2 # stderr __state_fd3=-1 __state_fd4=-1 __state_fd5=-1 __state_fd6=-1 __state_fd7=-1 __state_fd8=-1 __state_fd9=-1 _open() { # $2: filename, $3: flags, $4: mode # Get available fd __fd=0 while [ $__fd -lt 10 ]; do if [ $((__state_fd$__fd)) -lt 0 ]; then break fi : $((__fd += 1)) done if [ $__fd -gt 9 ] ; then # Some shells don't support fd > 9 echo "No more file descriptors available to open $(_put_pstr __ $2)" ; exit 1 else # Because the file must be read line-by-line, and string # values can't be assigned to dynamic variables, each line # is read and then unpacked in the buffer. _malloc __addr 1000 # Allocate buffer : $((_$__addr = 0)) # Init buffer to "" : $((__buffer_fd$__fd = __addr)) # Buffer address : $((__cursor_fd$__fd = 0)) # Buffer cursor : $((__buflen_fd$__fd = 1000)) # Buffer length : $((__state_fd$__fd = $3)) # Mark the fd as opened __res=$(_put_pstr __ $2) if [ $3 = 0 ] ; then case $__fd in 0) exec 0< "$__res" ;; 1) exec 1< "$__res" ;; 2) exec 2< "$__res" ;; 3) exec 3< "$__res" ;; 4) exec 4< "$__res" ;; 5) exec 5< "$__res" ;; 6) exec 6< "$__res" ;; 7) exec 7< "$__res" ;; 8) exec 8< "$__res" ;; 9) exec 9< "$__res" ;; esac elif [ $3 = 1 ] ; then case $__fd in 0) exec 0> "$__res" ;; 1) exec 1> "$__res" ;; 2) exec 2> "$__res" ;; 3) exec 3> "$__res" ;; 4) exec 4> "$__res" ;; 5) exec 5> "$__res" ;; 6) exec 6> "$__res" ;; 7) exec 7> "$__res" ;; 8) exec 8> "$__res" ;; 9) exec 9> "$__res" ;; esac elif [ $3 = 2 ] ; then case $__fd in 0) exec 0>> "$__res" ;; 1) exec 1>> "$__res" ;; 2) exec 2>> "$__res" ;; 3) exec 3>> "$__res" ;; 4) exec 4>> "$__res" ;; 5) exec 5>> "$__res" ;; 6) exec 6>> "$__res" ;; 7) exec 7>> "$__res" ;; 8) exec 8>> "$__res" ;; 9) exec 9>> "$__res" ;; esac else echo "Unknown file mode" ; exit 1 fi fi : $(($1 = __fd)) } _read() { : $((__fd = $2)) $((__buf = $3)) $((__count = $4)) : $((__i = 0)) while [ $__i -lt $__count ] ; do read_byte __byte $__fd if [ $__byte -lt 0 ] ; then break; fi : $((_$((__buf + __i)) = __byte)) : $((__i += 1)) done : $(($1 = __i)) } _write() { : $((__fd = $2)) $((__buf = $3)) $((__count = $4)) : $((__i = 0)) while [ $__i -lt $__count ] ; do : $((__byte = _$((__buf+__i)))) printf %b \\0$(($__byte/64))$(($__byte/8%8))$(($__byte%8)) >&$__fd : $((__i += 1)) done : $(($1 = __count)) } _close() { # $2: fd __fd=$2 __buf=$((__buffer_fd$__fd)) # Get buffer _free __ $__buf # Release buffer : $((__state_fd$__fd = -1)) # Mark the fd as closed case $__fd in 0) exec 0<&- ;; 1) exec 1<&- ;; 2) exec 2<&- ;; 3) exec 3<&- ;; 4) exec 4<&- ;; 5) exec 5<&- ;; 6) exec 6<&- ;; 7) exec 7<&- ;; 8) exec 8<&- ;; 9) exec 9<&- ;; esac : $(($1 = 0)) } #_ Local variables __=0 __code=0; # Exit code _main __code exit $__code