|
| 1 | +Test examples directory |
| 2 | +======================== |
| 3 | + |
| 4 | +Automata example: |
| 5 | + $ sgen run ../examples/automata.sg |
| 6 | + {} |
| 7 | + accept |
| 8 | + {} |
| 9 | + {} |
| 10 | + |
| 11 | +Binary4 example: |
| 12 | + $ sgen run ../examples/binary4.sg |
| 13 | + { [(+b b1 4 1)] [(+b b1 3 0)] [(+b b1 2 0)] [(+b b1 1 0)] } |
| 14 | + { [(+b b2 4 1)] [(+b b2 3 1)] [(+b b2 2 0)] [(+b b2 1 0)] } |
| 15 | + { [(+b r 4 1)] [(+b r 3 0)] [(+b r 2 0)] [(+b r 1 0)] } |
| 16 | + { [(+b r 4 1)] [(+b r 3 1)] [(+b r 2 0)] [(+b r 1 0)] } |
| 17 | + { [(+b r 4 0)] [(+b r 3 1)] [(+b r 2 1)] [(+b r 1 1)] } |
| 18 | + { [(+b r2 4 0)] [(+b r2 3 1)] [(+b r2 2 1)] [(+b r2 1 1)] } |
| 19 | + |
| 20 | +Circuits example: |
| 21 | + $ sgen run ../examples/circuits.sg |
| 22 | + { [(-c3 0) (-1 0) (-c2 0) (-not 0 0) 0 0] [(-c3 0) (-c2 1) 0 0] } |
| 23 | + { [(-0 1)] [(-not 0 0)] } |
| 24 | + |
| 25 | +Lambda calculus example: |
| 26 | + $ sgen run ../examples/lambda.sg |
| 27 | + [(out (%cons r X7)) (ida (exp (%cons l X7) d))] |
| 28 | + [(out X7) (x (exp X7 d))] |
| 29 | + |
| 30 | +Linear lambda example: |
| 31 | + $ sgen run ../examples/linear_lambda.sg |
| 32 | + {} |
| 33 | + {} |
| 34 | + |
| 35 | +MALL (multiplicative-additive linear logic) example: |
| 36 | + $ sgen run ../examples/mall.sg |
| 37 | + { [(-3 (%cons r (%cons l X4))) (-3 (%cons r (%cons r X4))) || (slice c b)] [(c X11) (d X11) || (slice c a)] } |
| 38 | + |
| 39 | +MLL (multiplicative linear logic) example: |
| 40 | + $ sgen run ../examples/mll.sg |
| 41 | + {} |
| 42 | + |
| 43 | +Natural numbers example: |
| 44 | + $ sgen run ../examples/nat.sg |
| 45 | + (+nat (s (s (s 0)))) |
| 46 | + (res 1) |
| 47 | + (res 0) |
| 48 | + |
| 49 | +NPDA (non-deterministic pushdown automaton) example: |
| 50 | + $ sgen run ../examples/npda.sg |
| 51 | + { [accept] [accept] } |
| 52 | + accept |
| 53 | + accept |
| 54 | + {} |
| 55 | + |
| 56 | +Prolog-style examples: |
| 57 | + $ sgen run ../examples/prolog.sg |
| 58 | + (s (s (s (s 0)))) |
| 59 | + [(-grandparent tom Z0) Z0] |
| 60 | + { [ok (-to 1)] [(-from 5)] [(-from 4)] [(-from 5)] } |
| 61 | + |
| 62 | +Stack example: |
| 63 | + $ sgen run ../examples/stack.sg |
| 64 | + (save 0) |
| 65 | + |
| 66 | +Sum types example: |
| 67 | + $ sgen run ../examples/sumtypes.sg |
| 68 | + a |
| 69 | + |
| 70 | +Syntax reference: |
| 71 | + $ sgen run ../examples/syntax.sg |
| 72 | + a |
| 73 | + { [c] [b] [a] } |
| 74 | + (%string hello world) |
| 75 | + (function a b) |
| 76 | + { [(-f X0) (-f Y0) (r X0 Y0) || (!= X Y)] [(+f b)] [(+f a)] } |
| 77 | + { [(r b a) || (!= b a)] [(r a b) || (!= a b)] } |
| 78 | + (+n2 (s (s 0))) |
| 79 | + { [(+field test2) (%cons (+f b) (%cons ok %nil))] [(+field test1) (%cons (+f a) (%cons ok %nil))] } |
| 80 | + [(+f a) ok] |
| 81 | + [(+f b) ok] |
| 82 | + (-field test2) |
| 83 | + |
| 84 | +Turing machine example: |
| 85 | + $ sgen run ../examples/turing.sg |
| 86 | + reject |
| 87 | + reject |
| 88 | + reject |
| 89 | + accept |
| 90 | + accept |
| 91 | + accept |
| 92 | + accept |
| 93 | + accept |
0 commit comments