How Pattern works #15
Replies: 1 comment 1 reply
-
The best thing for now is probably the talk I gave, which is linked at the top of the readme. Especially the demo at the end of it. You can also join #pattern on clojurians if you have questions. There are a lot of examples in the test suite, especially the pattern_test.clj and r3_test.clj files. I'm sorry there isn't yet any really great source of documentation or clear introduction! Since your interest is especially in code parsing, you'd probably like to look at the test/compiler_course directory. For instance pass 2 "shrink" uses dialects for clearer expressivity (I use dialects everywhere in my primary project). It also uses the Pattern has a lot of capabilities, but I can only think of one that I'm really not using: the pattern.nanopass.pass namespace together with the on-mutual rule combinator I built to support it. They evolved from my study of the nanopass compiler but turned out complex and not really useful. The point is that if you're not using those you don't need to worry that you're using some weird flaky feature as you're exploring the project! |
Beta Was this translation helpful? Give feedback.
-
Hey there!
I am the author of a linting library called Splint that uses a hand-built s-expression pattern matching system (which I've named Spat) which is very similar to what Pattern does. The difference is that mine is a macro that builds a function to "efficiently" perform the check and bindings.
Spat is quite fast for my needs, but it's also pretty feature-limited. Pattern is extremely expressive and I would love to learn from it. Do you have any documentation or high level descriptions of how it works? Or any resources on how you learned to implement it?
Beta Was this translation helpful? Give feedback.
All reactions