feat: implement Chapter 7
This commit is contained in:
parent
76456b2c21
commit
98bb2088e4
3 changed files with 55 additions and 0 deletions
|
@ -161,3 +161,42 @@ test sec6_2_dnf_exercise_ex [[
|
|||
p = q
|
||||
]] run better-dnf to Or(And(Not(Atom("p")),Not(Atom("q"))),
|
||||
And(Atom("q"),Atom("p")))
|
||||
|
||||
/** md
|
||||
### Chapter 7
|
||||
|
||||
The content and style of chapter 7 are similar to chapter 6. Again, there is a
|
||||
`trans/chap7.str` Stratego file defining several of the rules used in the examples
|
||||
from the chapter. As before, the examples with a different signature are recast
|
||||
into the SPL signature. Specifically, `Z` becomes `False`, `S(x)` becomes
|
||||
`Impl(True(), x)`, and `P` becomes `Or`.
|
||||
**/
|
||||
|
||||
test sec7_2_b_ex [[
|
||||
(1 -> 0) | 0
|
||||
]] run B to Or(False(), Impl(True(), False()))
|
||||
|
||||
test sec7_2_b_a_ex [[
|
||||
(1 -> 0) | 0
|
||||
]] run BthenA to Impl(True(), False())
|
||||
|
||||
test sec7_2_b_b_fails [[
|
||||
(1 -> 0) | 0
|
||||
]] run Btwice fails
|
||||
|
||||
test sec7_2_local_choice_fails [[
|
||||
(1 -> 0) | 0
|
||||
]] run maybeB-id-thenB fails
|
||||
|
||||
test sec7_2_seq_no_dist_over_choice_ex [[
|
||||
(1 -> 0) | 0
|
||||
]] run maybeBtwice-idthenB to Or(False(), Impl(True(), False()))
|
||||
|
||||
test sec7_3_repeat_small_ex [[
|
||||
(1 -> 0) | 0
|
||||
]] run repeatmaybeAB to Impl(True(), False())
|
||||
|
||||
test sec7_3_repeat_big_ex [[
|
||||
(1 -> (1 -> (1 -> (1 -> 0)))) | 0
|
||||
]] run repeatmaybeAB to Impl(True(), Impl(True(), Impl(True(),
|
||||
Impl(True(), False()))))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue