-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #39 from kanaka/misc-since-jan-2022
Misc since jan 2022
- Loading branch information
Showing
84 changed files
with
3,742 additions
and
1,232 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
name: Push (compose tests) | ||
|
||
on: | ||
push: {} | ||
pull_request: | ||
branches: [ master ] | ||
workflow_dispatch: {} | ||
|
||
jobs: | ||
tests-and-stats: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
submodules: recursive | ||
|
||
- name: Install JavaScript and ClojureScript node modules | ||
run: | | ||
( cd js && npm install ) | ||
( cd cljs && npm install ) | ||
- name: JavaScript Step Tests | ||
run: make test^js | ||
|
||
- name: JavaScript Regression Tests | ||
run: make REGRESS=1 test^js | ||
|
||
- name: Python Step Tests | ||
run: make test^python | ||
|
||
- name: Python Regression Tests | ||
run: make REGRESS=1 test^python | ||
|
||
- name: ClojureScript Step Tests | ||
run: make test^cljs | ||
|
||
- name: ClojureScript Regression Tests | ||
run: make REGRESS=1 test^cljs | ||
|
||
- name: Generate stats | ||
run: | | ||
make stats # Build compressed artifacts | ||
make stats # Without the build noise |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,3 +10,6 @@ notes | |
*.pyc | ||
*.pyz | ||
*-minipy.py | ||
cljs/.shadow-cljs | ||
cljs/build | ||
cljs/src-min |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
[submodule "python/minipy"] | ||
path = python/minipy | ||
url = https://github.com/kanaka/minipy | ||
[submodule "js/regpack"] | ||
path = js/regpack | ||
url = https://github.com/siorki/regpack |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
Copyright (C) 2017 Joel Martin <[email protected]> | ||
Copyright (C) 2024 Joel Martin <[email protected]> | ||
|
||
miniMAL is licensed under the MPL 2.0 (Mozilla Public License 2.0). | ||
The text of the MPL 2.0 license is included below and can be found at | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,84 @@ | ||
STEPS = step1_read_print step2_eval step3_env step4_if_fn_do \ | ||
step5_tco step6_file step7_interop step8_macros \ | ||
step9_try stepA_miniMAL | ||
STEPS = step0_repl step1_read_print step2_eval step3_env \ | ||
step4_if_fn_do step5_tco step6_file step7_interop \ | ||
step8_macros step9_try stepA_miniMAL | ||
|
||
MIN_FILES = src/miniMAL/miniMAL.cljs miniMAL | ||
MIN_FILES = $(foreach S,$(STEPS),src-min/miniMAL/$(S).cljc) miniMAL | ||
BUILD_FILES = $(foreach S,$(STEPS),build/$(S).js) miniMAL.js | ||
|
||
all: $(MIN_FILES) | ||
.SECONDARY: | ||
|
||
src/miniMAL/miniMAL.cljs: src/miniMAL/stepA_miniMAL.cljs | ||
all: $(MIN_FILES) $(BUILD_FILES) | ||
|
||
# | ||
# Compressed | ||
# | ||
src-min/miniMAL/%.cljc: src/miniMAL/%.cljc | ||
@echo "Compressing $@" | ||
@mkdir -p src-min/miniMAL/ | ||
@cat $< \ | ||
| egrep -v "^ *$$|^ *;" \ | ||
| sed 's/^ *//' \ | ||
| tr '\n' ' ' \ | ||
| sed 's/ *(/(/g' \ | ||
| sed 's/) */)/g' \ | ||
| sed 's/ *"/"/g' \ | ||
| sed 's/ *\[/[/g' \ | ||
| sed 's/] */]/g' \ | ||
| sed 's/" *\([^n]\)/"\1/g' \ | ||
| sed 's/\<ast\>/A/g' \ | ||
| sed 's/\<env\>/E/g' \ | ||
| sed 's/\<a0\>/a/g' \ | ||
| sed 's/\<a1\>/b/g' \ | ||
| sed 's/\<a2\>/c/g' \ | ||
| sed 's/\<a3\>/d/g' \ | ||
| sed 's/stepA-miniMAL/miniMAL/' \ | ||
| sed 's/\<EVAL\>/X/g' \ | ||
| sed 's/\<eval-ast\>/Y/g' \ | ||
| sed 's/\<new-env\>/Z/g' \ | ||
| sed \ | ||
-e 's/ *(/(/g' \ | ||
-e 's/) */)/g' \ | ||
-e 's/ *"/"/g' \ | ||
-e 's/ *\[/[/g' \ | ||
-e 's/] */]/g' \ | ||
-e 's/ *{/{/g' \ | ||
-e 's/" *\([^n]\)/"\1/g' \ | ||
-e 's/\<new-env\>/Y/g' \ | ||
-e 's/\([^-]\)\<env\>/\1E/g' \ | ||
-e 's/\<ast\>/A/g' \ | ||
-e 's/\<EVAL\>/X/g' \ | ||
-e 's/\<a0\>/a/g' \ | ||
-e 's/\<a1\>/b/g' \ | ||
-e 's/\<a2\>/c/g' \ | ||
-e 's/\<a3\>/d/g' \ | ||
-e 's/\<rest\>/R/g' \ | ||
-e 's/\((ns [^)]*)\)/\1(def R rest)/' \ | ||
-e 's/\<js\/JSON.parse\>/P/g' \ | ||
-e 's/\((ns [^)]*)\)/\1(def P js\/JSON.parse)/' \ | ||
-e 's/ *#?(:org.babashka\/nbb *\(.*\) *#_nbb-end */\1/' \ | ||
-e 's/ *:cljs *\(.*\)) *#_cljs-end *//' \ | ||
> $@ | ||
|
||
miniMAL: src/miniMAL/miniMAL.cljs | ||
@echo "#!/usr/bin/lumo -q" > $@ | ||
@cat $< \ | ||
| sed "s/(ns.*:require\([^)]*)\))/(require \'\1/" \ | ||
| sed 's/defn -main\[& args\]/let [args (seq (.slice js\/process.argv 4))]/' \ | ||
miniMAL: src-min/miniMAL/stepA_miniMAL.cljc | ||
echo "Compressing $@" | ||
echo "#!/usr/bin/env nbb" > $@ | ||
cat $< \ | ||
| sed "s/(ns [^)]*)//" \ | ||
| sed 's/defn -main\[& args\]/let [args (seq (.slice js\/process.argv 3))]/' \ | ||
>> $@ | ||
@chmod +x $@ | ||
chmod +x $@ | ||
|
||
node_modules/.bin/shadow-cljs: | ||
npm install | ||
|
||
# Full ClojureScript Compiled | ||
build/%.js: node_modules/.bin/shadow-cljs src/miniMAL/%.cljc | ||
node_modules/.bin/shadow-cljs release $* | ||
chmod +x $@ | ||
|
||
.PHONY: clean | ||
miniMAL.js: node_modules/shadow-cljs src/miniMAL/stepA_miniMAL.cljc | ||
node_modules/.bin/shadow-cljs release miniMAL | ||
chmod +x $@ | ||
|
||
stats: $(foreach S,$(STEPS),src/miniMAL/$(S).cljs) $(MIN_FILES) | ||
# | ||
# Stats | ||
# | ||
stats^%: src/miniMAL/%.cljc src-min/miniMAL/%.cljc | ||
@wc $^ | grep -v "total" | ||
|
||
|
||
.PHONY: clean stats | ||
|
||
stats: $(foreach s,$(STEPS),stats^$(s)) miniMAL core.json | ||
@wc miniMAL core.json | grep -v "total" | ||
|
||
clean: | ||
rm -f $(MIN_FILES) | ||
rm -f $(BUILD_FILES) | ||
rm -fr build/cljs-runtime | ||
rmdir -p build || true | ||
rmdir -p src-min/miniMAL || true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.