yamlscript

Ingy döt Net 2023-10-03T20:12:28.192569Z

A ton of work on the YS ecosystem has happened over the last month, but not much useful to show yet. Today I reached a big milestone in that I got the simplest test form to go through all 7 stages of compilation 🙂 This is the compiler flow https://github.com/yaml/yamlscript/blob/clojure/clojure/src/yamlscript/compiler.clj#L22-L28

Ingy döt Net 2023-10-03T20:13:43.970729Z

One thing I added to the python binding is the compile method which returns the Clojure code value of the YS input

$ python3 -c 'import yamlscript; print(yamlscript.compile("inc: 41"))'
(inc 41)

$ python3 -c 'import yamlscript; print(yamlscript.load("inc: 41"))'
42

Ingy döt Net 2023-10-03T20:14:56.857619Z

Also all the compilation phases have tests now. They are defined here: https://github.com/yaml/yamlscript/blob/clojure/clojure/test/data.yaml

Ingy döt Net 2023-10-03T20:16:35.611909Z

I have a pretty cool way of turning that one file into unit tests for each stage of compilation. For example to test the resolver stage I have this file: https://github.com/yaml/yamlscript/blob/clojure/clojure/test/yamlscript/resolver_test.clj

Ingy döt Net 2023-10-03T20:19:19.510229Z

Here's the output of a test run:

$ TEST_VERBOSE=1 make test
lein test

lein test yamlscript.builder-test
* test-3: Basic function call with 2 args (test all phases)

lein test yamlscript.compiler-test
* test-3: Basic function call with 2 args (test all phases)

lein test yamlscript.composer-test
* test-3: Basic function call with 2 args (test all phases)
* test-1: Most YAML syntax forms in one example

lein test yamlscript.constructor-test
* test-3: Basic function call with 2 args (test all phases)

lein test yamlscript.core-test
* test-3: Basic function call with 2 args (test all phases)

lein test yamlscript.expander-test
* test-3: Basic function call with 2 args (test all phases)

lein test yamlscript.parser-test
* test-3: Basic function call with 2 args (test all phases)
* test-1: Most YAML syntax forms in one example
* test-2: Nested parse events test

lein test yamlscript.printer-test
* test-3: Basic function call with 2 args (test all phases)

lein test yamlscript.resolver-test
* test-3: Basic function call with 2 args (test all phases)

Ran 12 tests containing 12 assertions.
0 failures, 0 errors.

🎉 2