Closed tangentstorm closed 4 years ago
Appears to be a parser bug. Handling all the forms of this composition properly is kinda weird. Consider this:
a:5>;b:1+;a b\0
in k6 it evaluates to 0 1 2 3 4 5
A {10>x}{x+1}\0
works
B (10>){x+1}\0
doesn't work
The root node of the expression should be the \
adverb in both cases. In A that holds. In B the root node is the >
verb with 10
as left and {x+1}\0
as right, which is an infinite loop trying to find a fixed point.
The reason is that after parsing (10>)
with parseNoun
, the condition node.t == 8 && !node.r
is matched in parseEx
, while not in the other case.
@matiasmorant's diagnosis is accurate; I've tweaked the parser to correctly fold the AST for all combinations of (nominal verb|lambda)(nominal verb|lambda)adverb
.
(one of these days I really need to rewrite this damn parser from scratch. yeesh.)
but:
Shouldn't these do the same thing?
But
(10>){1+x}\0
loops forever.