lama_byterun/stdlib/regression/test10.expr

19 lines
497 B
Text
Raw Normal View History

2020-01-22 22:30:34 +03:00
import Ostap;
import List;
import Fun;
fun many (a) {
memo (
fun (k) {
empty @ lift({})
| many (a) |> fun (as) {a @ fun (x) {as +++ singleton (x)}} $ k
}
)
}
local a = token ("a"), b = token ("b");
local bad_alter = a | a |> fun (x) {b @ fun (y) {x ++ y}};
2020-01-30 23:36:15 +03:00
--logOn ();
2020-01-22 22:30:34 +03:00
printf ("Parsing ""aaa"" with many ... %s\n", parseString (many (a) |> bypass (eof), "aaa").string);
printf ("Parsing ""ab"" with bad_alter ... %s\n", parseString (bad_alter |> bypass (eof), "ab").string)