nanopass-framework-scheme icon indicating copy to clipboard operation
nanopass-framework-scheme copied to clipboard

Why no top-level cata if the full "in -> out" cata syntax is used?

Open akeep opened this issue 7 years ago • 1 comments

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.

akeep avatar Dec 26 '16 22:12 akeep

Originally reported by @rrnewton in akeep/nanopass-framework#11

akeep avatar Dec 26 '16 22:12 akeep