Glen Whitney
04ad85ee38
This is performed using the sunshine executable jar, which must be separately downloaded, and a bash script in this project, called hel2py. Although the process is a bit cumbersome, it meets the original goals of this repository, so this will likely be the last commit.
30 lines
1.1 KiB
Bash
Executable File
30 lines
1.1 KiB
Bash
Executable File
#!/bin/bash
|
|
while [[ $1 = -* ]]
|
|
do
|
|
case $1 in
|
|
-h|--help)
|
|
echo
|
|
echo "To use this script to 'compile' a helloworld program, you must set"
|
|
echo "environment variables:"
|
|
echo " SUNSHINE_JAR to the full path to the executable sunshine jar downloaded from Metaborg"
|
|
echo " ECLIPSE_INSTALL to the directory where your eclipse executable (with Spoofax plugin) resides"
|
|
echo " HELLOWORLD_PROJECT to the project directory of this project"
|
|
echo "(or of course you could make a copy of this script with those directories hardcoded)."
|
|
echo
|
|
echo "Usage:"
|
|
echo " hel2py [-q] FILE"
|
|
echo "You can specify -q to suppress standard error output."
|
|
echo "Writes the Python translation of FILE to standard out."
|
|
echo "So you can 'execute' the file with"
|
|
echo " hel2py -q FILE | python3 -"
|
|
exit
|
|
;;
|
|
-q)
|
|
shift
|
|
exec 2>/dev/null
|
|
;;
|
|
esac
|
|
done
|
|
|
|
java -jar $SUNSHINE_JAR transform -i $1 -n "Generate Python" -p $HELLOWORLD_PROJECT -l $HELLOWORLD_PROJECT -l "${ECLIPSE_INSTALL}/plugins"
|