File mttroot/mtt/bin/trans/mtt_optimise.sh artifact 3b8f7df6f9 part of check-in df4560e091


#! /bin/sh

set -e

filename="$1"

# get expression to optimise

lhs=`cat ${filename} | gawk '{ print $1 }'`
rhs=`cat ${filename} | gawk '{ print $2 }'`

# set work file names

tmp="$0.tmp"
log="$0.log"


cat <<EOF | reduce > $log
off echo$
load scope$
on double$
on noconvert$
on rounded$
off int$
off nat$

out "${tmp}"$
optimize mtt_tmp0 :=: ${rhs} iname mtt_tmp$
write "${lhs} := mtt_tmp0"$
shut "${tmp}"$

;end;
EOF

mv ${tmp} ${filename}

exit 0

MTT: Model Transformation Tools
GitHub | SourceHut | Sourceforge | Fossil RSS ]