forked from glen/fostr
feat: Add OCaml code generation
Also start using nailgun to speed up code generation. Resolves #6.
This commit is contained in:
parent
380177b274
commit
f789ed94fd
10 changed files with 128 additions and 4 deletions
15
bin/fosgen
15
bin/fosgen
|
@ -5,6 +5,7 @@ erro() { printf "%s\n" "$*" >&2; }
|
|||
|
||||
##### Set defaults:
|
||||
SUPPRESS_ERR=YES
|
||||
USE_NAILGUN=YES
|
||||
LANGUAGE=Python
|
||||
|
||||
##### Extract command line options:
|
||||
|
@ -14,18 +15,23 @@ do
|
|||
-h|--help)
|
||||
echo
|
||||
echo "Usage:"
|
||||
echo " fosgen [-d] [-l LANGUAGE] FILE"
|
||||
echo " fosgen [-d] [-j] [-l LANGUAGE] FILE"
|
||||
echo
|
||||
echo "Writes to standard output the code generated from the fostr"
|
||||
echo "program in FILE, targeting the specified LANGUAGE (which"
|
||||
echo "defaults to Python)."
|
||||
echo
|
||||
echo "The -d option writes diagnostic output to standard error."
|
||||
echo "The -j option uses the Spoofax Sunshine JAR directly, rather"
|
||||
echo "than via nailgun."
|
||||
exit
|
||||
;;
|
||||
-d)
|
||||
SUPPRESS_ERR=''
|
||||
;;
|
||||
-j)
|
||||
USE_NAILGUN=''
|
||||
;;
|
||||
-l)
|
||||
shift
|
||||
LANGUAGE="$1"
|
||||
|
@ -67,5 +73,12 @@ then
|
|||
exec 2>/dev/null
|
||||
fi
|
||||
|
||||
if [[ $USE_NAILGUN ]]
|
||||
then
|
||||
$BINDIR/let_sun_shine
|
||||
$BINDIR/ng sunshine transform -p $PROJDIR -n $LANGUAGE -i $PROGRAM
|
||||
exit $?
|
||||
fi
|
||||
|
||||
java -jar $SUNJAR transform -p $PROJDIR -l $PROJDIR -l $MVN_REPO -n $LANGUAGE -i $PROGRAM
|
||||
exit $?
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue