Closed bash-spbu closed 4 years ago
Looking like some tail-call optimization issue.
Also I probably should mention that this example is not an issue when there is only one token combinator:
import Ostap;
fun pure(v) {
empty @ lift(v)
}
local parse =
token(".") |> fun(e1) {
pure(Dot(e1)) };
case parseString(parse |> bypass(eof), ".") of
Succ(_) -> printf("Yes")
| Fail(_, _, _) -> printf("No")
esac
Works as expected.
Maybe it will help to localize the problem.
Fixed in 7748144.
Problem:
I faced some strange behaviour when wanted to use Do-notation with Ostap's parsers.
Consider the following example:
When I compile & run this I get a segfault somewhere (unfortunatelly GDB cannot locate it precisely).
But if we inline
pure
definition (what should not change the semantics, should it?), everything will be OK:Result:
Yes
Expected behaviour:
Same semantics for both snippets.
Environment: