2024-02-23 18:25:56 +03:00
|
|
|
---
|
|
|
|
source: tests/golden_tests.rs
|
2024-05-15 01:25:46 +03:00
|
|
|
input_file: tests/golden_tests/encode_pattern_match/match_num_adt_tup_parser.bend
|
2024-02-23 18:25:56 +03:00
|
|
|
---
|
2024-05-18 15:01:20 +03:00
|
|
|
Scott
|
|
|
|
(Parse) = λa λb (b λc (Result_/Err (String/Nil, c)) λd λe λf (switch (- d 10) { 0: λg λh (Result_/Ok (0, h, g)); _: λi λj λk (switch (- i 29) { 0: λl λm (Result_/Ok (40, m, l)); _: λn λo λp (switch n { 0: λq λr (Result_/Ok (41, r, q)); _: λs λt λu (Result_/Err ((String/Cons (+ s 42) u), t)); } o p); } j k); } f e) a)
|
2024-02-23 18:25:56 +03:00
|
|
|
|
2024-05-15 21:23:26 +03:00
|
|
|
(main) = (Parse * (String/Cons 40 (String/Cons 43 String/Nil)) λc let (d, e, f) = c; (d, (Parse f e)) λg (Result_/Err g))
|
2024-02-23 18:25:56 +03:00
|
|
|
|
2024-05-18 15:01:20 +03:00
|
|
|
(String/Nil) = λa λ* a
|
2024-02-23 18:25:56 +03:00
|
|
|
|
2024-05-18 15:01:20 +03:00
|
|
|
(String/Cons) = λa λb λ* λd (d a b)
|
2024-02-23 18:25:56 +03:00
|
|
|
|
2024-05-10 22:42:32 +03:00
|
|
|
(Result_/Ok) = λa λb λ* (b a)
|
2024-03-19 20:37:30 +03:00
|
|
|
|
2024-05-10 22:42:32 +03:00
|
|
|
(Result_/Err) = λa λ* λc (c a)
|
2024-05-18 15:01:20 +03:00
|
|
|
|
|
|
|
NumScott
|
|
|
|
(Parse) = λa λb (b λc switch c { 0: λd (Result_/Err (String/Nil, d)); _: λ* λe λf λg (switch (- e 10) { 0: λh λi (Result_/Ok (0, i, h)); _: λj λk λl (switch (- j 29) { 0: λm λn (Result_/Ok (40, n, m)); _: λo λp λq (switch o { 0: λr λs (Result_/Ok (41, s, r)); _: λt λu λv (Result_/Err ((String/Cons (+ t 42) v), u)); } p q); } k l); } g f); } a)
|
|
|
|
|
|
|
|
(main) = (Parse * (String/Cons 40 (String/Cons 43 String/Nil)) λc switch c { 0: λd let (e, f, g) = d; (e, (Parse g f)); _: λ* λh (Result_/Err h); })
|
|
|
|
|
2024-05-27 21:09:23 +03:00
|
|
|
(String/Nil) = λa (a String/Nil/tag)
|
2024-05-18 15:01:20 +03:00
|
|
|
|
2024-05-27 21:09:23 +03:00
|
|
|
(String/Cons) = λa λb λc (c String/Cons/tag a b)
|
2024-05-18 15:01:20 +03:00
|
|
|
|
2024-05-27 21:09:23 +03:00
|
|
|
(Result_/Ok) = λa λb (b Result_/Ok/tag a)
|
2024-05-18 15:01:20 +03:00
|
|
|
|
2024-05-27 21:09:23 +03:00
|
|
|
(Result_/Err) = λa λb (b Result_/Err/tag a)
|
|
|
|
|
|
|
|
(String/Nil/tag) = 0
|
|
|
|
|
|
|
|
(String/Cons/tag) = 1
|
|
|
|
|
|
|
|
(Result_/Ok/tag) = 0
|
|
|
|
|
|
|
|
(Result_/Err/tag) = 1
|