-
Notifications
You must be signed in to change notification settings - Fork 2
/
l1c
executable file
·56 lines (43 loc) · 802 Bytes
/
l1c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/bash
set -e
unset -v outfile
unset -v filename
unset -v tmpdir
filename=$1
shift 1
while getopts o: opt; do
case $opt in
o) outfile=$OPTARG ;;
*)
echo "$0: Unrecognized argument." >& 2
exit 1
esac
done
shift "$(( OPTIND -1 ))"
if [ -z "$outfile" ]; then
outfile="goprog"
fi
tmpdir=$(mktemp -d)
mkdir -p $tmpdir
echo $filename $outfile $tmpdir
cp $filename $tmpdir/src.l1
pushd $tmpdir
cat <<EOF > main.go
package main
import (
"github.com/eigenhombre/l1/lisp"
_ "embed"
)
//go:embed src.l1
var FileSource string
func main() {
globals := lisp.InitGlobals()
lisp.LexParseEval(lisp.RawCore, &globals)
lisp.LexParseEval(FileSource, &globals)
}
EOF
go mod init myprog
go mod tidy
go build .
popd
mv $tmpdir/myprog $outfile