Various improvements
This commit is contained in:
parent
31b1c9df4c
commit
76bc7825af
141
langs/claro.yaml
141
langs/claro.yaml
|
@ -3,107 +3,104 @@ name: "Claro"
|
||||||
|
|
||||||
info:
|
info:
|
||||||
impl: "Claro"
|
impl: "Claro"
|
||||||
version: "0.1.0"
|
|
||||||
year: 2021
|
year: 2021
|
||||||
desc: "Optionally compiled or interpreted, high-level, toy programming language, with an eye towards providing standardized Software Engineering best practices out of the box"
|
desc: "High-level toy programming language providing standardized Software Engineering best practices out of the box"
|
||||||
ext:
|
ext:
|
||||||
- claro
|
- claro
|
||||||
web:
|
web:
|
||||||
home: "https://clarolang.com/"
|
home: "https://clarolang.com/"
|
||||||
source: "https://github.com/JasonSteving99/claro-lang/"
|
source: "https://github.com/JasonSteving99/claro-lang"
|
||||||
category: recreational
|
category: general
|
||||||
mode: compiled or interpreted
|
mode:
|
||||||
platform: Bazel
|
- compiled
|
||||||
|
- interpreted
|
||||||
|
platform: []
|
||||||
syntax:
|
syntax:
|
||||||
- java
|
- c
|
||||||
typing: static
|
typing: static
|
||||||
paradigm:
|
paradigm:
|
||||||
- functional
|
- functional
|
||||||
- imperative
|
- imperative
|
||||||
usage: literally just Jason Steving
|
usage: personal
|
||||||
|
|
||||||
install:
|
install:
|
||||||
apt:
|
apt:
|
||||||
- default-jdk
|
- default-jdk
|
||||||
manual: |
|
manual: |
|
||||||
install -d "${pkg}/usr/local/bin"
|
install -d "${pkg}/opt/claro/programs"
|
||||||
|
install -d "${pkg}/usr/local/bin"
|
||||||
|
|
||||||
# Pull resources from the latest Claro repo release.
|
# Pull resources from the latest Claro repo release.
|
||||||
ver="$(latest_release JasonSteving99/claro-lang)"
|
ver="$(latest_release JasonSteving99/claro-lang | sed 's/^v//')"
|
||||||
|
|
||||||
# Pull the tarball of the built Bazel repo's bazel-bin instead of just the sources.
|
# Pull the tarball of the built Bazel repo's bazel-bin instead of just the sources.
|
||||||
wget "https://github.com/JasonSteving99/claro-lang/releases/download/${ver}/claro-lang-bazel-bin.tar.gz"
|
wget "https://github.com/JasonSteving99/claro-lang/releases/download/v${ver}/claro-lang-bazel-bin.tar.gz"
|
||||||
tar -xzvf claro-lang-bazel-bin.tar.gz
|
tar -xf claro-lang-bazel-bin.tar.gz
|
||||||
|
|
||||||
#####################################################################################################
|
#####################################################################################################
|
||||||
# We don't want to depend on Bazel at all for rebuilding, it's just one file changing. Rebuild it using
|
# We don't want to depend on Bazel at all for rebuilding, it's just one file changing. Rebuild it using
|
||||||
# the packaged jar files and then update the jar holding that recompiled file and run the Bazel gen'd
|
# the packaged jar files and then update the jar holding that recompiled file and run the Bazel gen'd
|
||||||
# run script which points at all the correct jar runfiles. First though, we need to slightly modify
|
# run script which points at all the correct jar runfiles. First though, we need to slightly modify
|
||||||
# the Bazel gen'd runscript to rebuild using the packaged jars for us (without explicitly rerunning Bazel
|
# the Bazel gen'd runscript to rebuild using the packaged jars for us (without explicitly rerunning Bazel
|
||||||
# itself since this is super slow and involves starting up a new Bazel server...).
|
# itself since this is super slow and involves starting up a new Bazel server...).
|
||||||
pushd claro_programs/ > /dev/null
|
pushd claro_programs
|
||||||
fancydelim=$(printf '\001') # https://stackoverflow.com/a/25821096/10027370
|
|
||||||
|
|
||||||
|
read -r -d '' MY_SCRIPT <<"EOF" ||:
|
||||||
|
REBUILD_CLASSPATH="${CLASSPATH}"
|
||||||
# For the purpose of rebuilding, we need lombok and autovalue on the classpath.
|
# For the purpose of rebuilding, we need lombok and autovalue on the classpath.
|
||||||
MY_SCRIPT=' REBUILD_CLASSPATH="${CLASSPATH}"\n'
|
REBUILD_CLASSPATH+=":lombok-1.18.20.jar"
|
||||||
MY_SCRIPT+=' REBUILD_CLASSPATH+=":lombok-1.18.20.jar"\n'
|
REBUILD_CLASSPATH+=":auto-value-1.5.3.jar"
|
||||||
MY_SCRIPT+=' REBUILD_CLASSPATH+=":auto-value-1.5.3.jar"\n'
|
javac -classpath $REBUILD_CLASSPATH Conditions.java
|
||||||
MY_SCRIPT+=' javac -classpath $REBUILD_CLASSPATH Conditions.java\n'
|
|
||||||
# There's an assumption that the dir ./com/claro/ was made in the tarball before this.
|
# There's an assumption that the dir ./com/claro/ was made in the tarball before this.
|
||||||
MY_SCRIPT+=' mv Conditions*.class com/claro\n'
|
mv Conditions*.class com/claro
|
||||||
MY_SCRIPT+=' jar -uf "${RUNPATH}src/java/com/claro/claro_programs/conditions_compiled_claro_image.jar" com/claro/Conditions*.class\n'
|
jar -uf "${RUNPATH}src/java/com/claro/claro_programs/conditions_compiled_claro_image.jar" com/claro/Conditions*.class
|
||||||
MY_SCRIPT+=' java -classpath $CLASSPATH "${ARGS[@]}"\n'
|
java -classpath $CLASSPATH "${ARGS[@]}"
|
||||||
# We insert our own exit here to short-circuit the Bazel run script's call to JAVABIN which is
|
EOF
|
||||||
# invalid on this host machine.
|
|
||||||
MY_SCRIPT+=' exit $?\n'
|
|
||||||
|
|
||||||
# Insert MY_SCRIPT into the Bazel run script just before java gets executed. We're reusing Bazel's run
|
# Insert MY_SCRIPT into the Bazel run script just before java gets executed. We're reusing Bazel's run
|
||||||
# script basically just to get a conveniently curated CLASSPATH variable generated to point to all the
|
# script basically just to get a conveniently curated CLASSPATH variable generated to point to all the
|
||||||
# randomly scattered jar files that Bazel places throughout bazel-bin/.
|
# randomly scattered jar files that Bazel places throughout bazel-bin/.
|
||||||
sed -n "H;\${x;s/\n//;s${fancydelim}create_and_run_classpath_jar\nelse\n${fancydelim}&${MY_SCRIPT}\n${fancydelim};p;}" conditions_compiled_claro_image > conditions_compiled_claro_image2
|
sed -i "s|exec \$JAVABIN.*|${MY_SCRIPT//$'\n'/\\n}|" conditions_compiled_claro_image
|
||||||
|
|
||||||
# I'm not good enough with sed to figure out how to avoid this extra temporary stop in a second file. Oh well.
|
chmod -R u+rw *
|
||||||
chmod 777 conditions_compiled_claro_image
|
|
||||||
cat conditions_compiled_claro_image2 > conditions_compiled_claro_image
|
|
||||||
rm conditions_compiled_claro_image2
|
|
||||||
|
|
||||||
popd > /dev/null
|
popd
|
||||||
#####################################################################################################
|
#####################################################################################################
|
||||||
|
|
||||||
cp -R claro_programs "${pkg}/usr/local/bin"
|
cp -R claro_programs/. "${pkg}/opt/claro/programs/"
|
||||||
|
|
||||||
wget "https://github.com/JasonSteving99/claro-lang/releases/download/v0.1.0/claro_compiler_binary_deploy.jar"
|
wget "https://github.com/JasonSteving99/claro-lang/releases/download/v${ver}/claro_compiler_binary_deploy.jar"
|
||||||
cp claro_compiler_binary_deploy.jar "${pkg}/usr/local/bin"
|
cp claro_compiler_binary_deploy.jar "${pkg}/opt/claro/"
|
||||||
|
|
||||||
setup: |
|
setup: |
|
||||||
cp -R /usr/local/bin/* "${HOME}/src"
|
cp -R /opt/claro/programs "./"
|
||||||
|
|
||||||
main: "claro_programs/Conditions.claro"
|
main: "programs/Conditions.claro"
|
||||||
template: |
|
template: |
|
||||||
# Thanks for trying out Claro during its early development stages!
|
# Thanks for trying out Claro during its early development stages!
|
||||||
# To learn Claro by example, check out:
|
# To learn Claro by example, check out:
|
||||||
# https://clarolang.com/tree/main/src/java/com/claro/claro_programs
|
# https://clarolang.com/tree/main/src/java/com/claro/claro_programs
|
||||||
|
|
||||||
print("Hello, world!");
|
print("Hello, world!");
|
||||||
|
|
||||||
run: |
|
|
||||||
# Skip rebuilding the entire compiler all over again and instead just use the pre-built Claro compiler jar.
|
|
||||||
chmod +rw claro_programs/Conditions.java
|
|
||||||
java -jar claro_compiler_binary_deploy.jar --java_source --silent --classname=Conditions --package=com.claro \
|
|
||||||
< claro_programs/Conditions.claro \
|
|
||||||
> claro_programs/Conditions.java \
|
|
||||||
&& \
|
|
||||||
pushd claro_programs/ > /dev/null \
|
|
||||||
&& \
|
|
||||||
./conditions_compiled_claro_image \
|
|
||||||
&& \
|
|
||||||
popd > /dev/null
|
|
||||||
|
|
||||||
repl: |
|
repl: |
|
||||||
java -jar claro_compiler_binary_deploy.jar --repl --silent
|
java -jar /opt/claro/claro_compiler_binary_deploy.jar --repl --silent
|
||||||
|
|
||||||
|
# Skip rebuilding the entire compiler all over again and instead just
|
||||||
|
# use the pre-built Claro compiler jar.
|
||||||
|
compile: |
|
||||||
|
java -jar /opt/claro/claro_compiler_binary_deploy.jar \
|
||||||
|
--java_source --silent \
|
||||||
|
--classname=Conditions --package=com.claro \
|
||||||
|
< programs/Conditions.claro \
|
||||||
|
> programs/Conditions.java
|
||||||
|
run: |
|
||||||
|
set -e
|
||||||
|
|
||||||
|
cd programs
|
||||||
|
./conditions_compiled_claro_image ||:
|
||||||
|
|
||||||
|
java -jar /opt/claro/claro_compiler_binary_deploy.jar --repl --silent
|
||||||
|
|
||||||
input: |
|
input: |
|
||||||
print(123 * 234);
|
print(123 * 234);
|
||||||
|
|
||||||
skip:
|
|
||||||
- runrepl
|
|
||||||
|
|
Loading…
Reference in New Issue