Modernize build/run scripts. Put `main` in its own Main module.
Chris Pressey
5 years ago
0 | 0 |
*.hi
|
1 | 1 |
*.o
|
2 | |
Burro
|
|
2 |
*.jsmod
|
|
3 |
demo/burro.js
|
|
4 |
bin/*.exe
|
|
0 |
#!/bin/sh
|
|
1 |
|
|
2 |
THIS=`realpath $0`
|
|
3 |
DIR=`dirname $THIS`
|
|
4 |
NAME=`basename $THIS`
|
|
5 |
SRC=$DIR/../src
|
|
6 |
if [ "x$FORCE_HUGS" != "x" ] ; then
|
|
7 |
exec runhugs -i$SRC $SRC/Main.hs $*
|
|
8 |
elif [ -x $DIR/$NAME.exe ] ; then
|
|
9 |
exec $DIR/$NAME.exe $*
|
|
10 |
elif command -v runhaskell 2>&1 >/dev/null ; then
|
|
11 |
exec runhaskell -i$SRC $SRC/Main.hs $*
|
|
12 |
elif command -v runhugs 2>&1 >/dev/null ; then
|
|
13 |
exec runhugs -i$SRC $SRC/Main.hs $*
|
|
14 |
else
|
|
15 |
echo "Cannot run $NAME; neither $NAME.exe, nor runhaskell, nor runhugs found."
|
|
16 |
exit 1
|
|
17 |
fi
|
0 | 0 |
#!/bin/sh
|
1 | 1 |
|
2 | |
if [ x`which ghc` = x -a x`which runhugs` = x ]; then
|
3 | |
echo "Neither ghc nor runhugs found on search path."
|
4 | |
exit 1
|
|
2 |
PROG=burro
|
|
3 |
|
|
4 |
if command -v ghc >/dev/null 2>&1; then
|
|
5 |
echo "building $PROG.exe with ghc"
|
|
6 |
(cd src && ghc --make Main.hs -o ../bin/$PROG.exe)
|
|
7 |
else
|
|
8 |
echo "ghc not found, not building $PROG.exe"
|
5 | 9 |
fi
|
6 | 10 |
|
7 | |
if [ x`which ghc` = x ]; then
|
8 | |
echo "ghc not found on search path. Use Hugs to run."
|
9 | |
exit 0
|
|
11 |
# For this to work, you need hastec installed.
|
|
12 |
|
|
13 |
if command -v hastec_patience_my_pet >/dev/null 2>&1; then
|
|
14 |
echo "building $PROG.js with hastec"
|
|
15 |
(cd src && hastec --make HasteMain.hs -o ../demo/$PROG.js)
|
|
16 |
else
|
|
17 |
echo "hastec not found, not building $PROG.js"
|
10 | 18 |
fi
|
11 | |
|
12 | |
ghc --make src/Language/Burro.lhs
|
13 | |
|
14 | |
# Burro${O}: Burro.lhs
|
15 | |
# ${HC} ${HCFLAGS} -c $*.lhs
|
16 | |
#
|
17 | |
# ${PROG}: ${OBJS}
|
18 | |
# ${HC} -o ${PROG} -O ${OBJS}
|
19 | |
# strip ${PROG}
|
496 | 496 |
|
497 | 497 |
> interpret text = run (parse text) newstate
|
498 | 498 |
|
499 | |
> main = do
|
500 | |
> [fileName] <- getArgs
|
501 | |
> burroText <- readFile fileName
|
502 | |
> putStrLn $ show $ interpret burroText
|
503 | |
|
504 | 499 |
Although we have proved that Burro programs form a group, it is not a
|
505 | 500 |
mechanized proof, and only goes so far in helping us tell if the
|
506 | 501 |
implementation (which, for an executable semantics, is one and the same
|
|
0 |
module Main where
|
|
1 |
|
|
2 |
import System.Environment
|
|
3 |
import Language.Burro
|
|
4 |
|
|
5 |
main = do
|
|
6 |
args <- getArgs
|
|
7 |
case args of
|
|
8 |
[fileName] -> do
|
|
9 |
c <- readFile fileName
|
|
10 |
burroText <- readFile fileName
|
|
11 |
putStrLn $ show $ interpret burroText
|
|
12 |
_ -> do
|
|
13 |
putStrLn "Usage: burro <filename.burro>"
|