I am studying formal languages and playing with writing my own parsers for them. I have a context free grammar parser already that works well. I am wondering if anyone can point me towards actually implemented examples of rewriters. For example, suppose I had the rules
WORD: [A-Z]+
QUOTE: "
And I wanted to input a lot of words,put quotes around each one, and write out the string. Or go back and forth. Something like this:
(WORD [' '])+ <--> (QUOTE WORD QUOTE [' '])+
That seems kind of possible to implement automatically without ambiguity, but I was hoping someone had seen something along that line that already exists.