nanopass-framework-scheme
nanopass-framework-scheme copied to clipboard
Why no top-level cata if the full "in -> out" cata syntax is used?
We were playing around with a tree example, where we stuck in extra non-terminals for the heck of it:
(define-language LTree2
(entry Tree)
(Tree (t) n l)
(Node (n) (node t0 t1))
(Leaf (l) (leaf i))
(terminals (number (i))))
We wanted to be able to handle the Tree non-terminal with patterns like this:
[,[n -> h] h]
[,[l -> h] h]
These currently result in a "no top-level cata" error. But, would it be possible to permit this? The "n" and "l" identify the target for the cata right? Pattern matching on ,n
and ,l
without catas works fine.
Originally reported by @rrnewton in akeep/nanopass-framework#11