#!/bin/bash
# Runs the example with the flags of SPRITE_INTERPRETER_FLAGS.
set -euo pipefail
cd "$(dirname "$0")"
: "${SPRITE_HOME:=$(cd ../.. && pwd)/install}"
export SPRITE_HOME
export SPRITE_INTERPRETER_FLAGS="${SPRITE_INTERPRETER_FLAGS:-backend:cxx}"
export LC_ALL=C.UTF-8 PYTHONIOENCODING=utf-8
unset CURRYPATH
# By file name.  The program must define a symbol "main".
echo '% sprite-exec program.curry'
"$SPRITE_HOME/bin/sprite-exec" program.curry
# By module name.  The -m switch looks the module up on CURRYPATH.
echo '% CURRYPATH=. sprite-exec -m program'
CURRYPATH=. "$SPRITE_HOME/bin/sprite-exec" -m program
# With another goal.  The -g switch names the symbol to evaluate.
echo '% sprite-exec program.curry -g mainalt'
"$SPRITE_HOME/bin/sprite-exec" program.curry -g mainalt
