K
Size: a a a
K
B
P
K
K
[
h
[
B
B
B
B
B
kk
[
A
K
ACTION. Поправим.getAction
:: (Ord term, Pretty term)
=> Goto' (Term term) -- ^ GOTO function
-> Act (Term term)
getAction goto from term = foldMap decide from
where
decide item = case locus item of
Just (Term term')
| term == term' ->
Shift (goto ? from ? Term term)
Nothing
| i1Lookahead item ? term ->
if isStart from && term == Eof
then Accept
else Reduce item
_ -> Expected mempty
A
K
K
The second set of positions will produce Reduce-s. For each terminal (for instance, “+”) that can follow the rule of that position, we produce:
{ someOtherState =>
{ "+" =>
Reduce (Factor "*" Term . { mkR })
}
}