If you haven’t heard of it check this out:
http://www.tinlizzie.org/ometa/
I was just reading his Ph.D. dissertation linked on that page and this quote is really jumping out at me:
OMeta’s key insight is the realization that all of the passes in a traditional compiler are essentially pattern matching operations:
• a lexical analyzer finds patterns in a stream of characters to produce a stream of tokens;
• a parser matches a stream of tokens against a grammar (which itself is a collection of productions, or patterns) to produce abstract syntax trees (ASTs);
• a typechecker pattern-matches on ASTs to produce ASTs annotated with types;
• more generally, visitors pattern-match on ASTs to produce other ASTs;
• finally, a (naive) code generator pattern-matches on ASTs to produce code.
He is so right. It seems that pattern matching might be the other side of the coin of Transformation. Great stuff.