Commit b2b410d9 by Ralf Jung

### auto-generate exercises from solutions

parent db028517
 ... ... @@ -28,10 +28,12 @@ _*_.tex *.glob *.v.d *.vio Makefile.coq* Makefile.coq Makefile.coq.conf .Makefile.coq.d *.crashcoqide .coqdeps.d .lia.cache build-dep _opam .lia.cache ... ...
 ... ... @@ -5,6 +5,7 @@ stages: variables: CPU_CORES: "10" MAKE_TARGET: "ci" .template: &template stage: build ... ...
 # Generate an exercise for each solution. SOLUTIONS := \$(wildcard solutions/*.v) EXERCISES := \$(addprefix exercises/,\$(notdir \$(SOLUTIONS))) exercises: \$(EXERCISES) .PHONY: exercises \$(EXERCISES): exercises/%.v: solutions/%.v gen-exercises.awk \$(HIDE)echo "Generating exercise file \$@ from \$<" \$(HIDE)gawk -f gen-exercises.awk < \$< > \$@ # CI make target ci: all +@make -B exercises # force make (in case exercise files have been edited directly) if [ -n "\$\$(git status --porcelain)" ]; then echo 'ERROR: Exercise files are not up-to-date with solutions. `git diff` after re-making them:'; git diff; exit 1; fi
 ... ... @@ -100,3 +100,35 @@ If you would like to know more about Iris, we recommend to take a look at: Ralf Jung, Robbert Krebbers, Jacques-Henri Jourdan, Aleš Bizjak, Lars Birkedal, Derek Dreyer. A detailed description of the Iris logic and its model ## Generating the exercises If you want to contribute to the tutorial, note that the files in `exercises/` are generated from the corresponding files in `solutions/`. Run `make exercises` to re-generate those files. This requires `gawk` to be installed (which should usually be available on Linux but might have to be installed separately on macOS). The syntax for the solution files is as follows: ``` (* BEGIN SOLUTION *) solution here. (* END SOLUTION *) ``` is replaced by ``` (* exercise *) Admitted. ``` and the more powerful ``` (* BEGIN SOLUTION *) solution here. (* END SOLUTION BEGIN TEMPLATE exercise template here. END TEMPLATE *) ``` is replaced by ``` exercise template here. ```