sed is already Turing-complete (https://catonmat.net/proof-that-sed-is-turing-complete).
I'm not sure how what you are proposing is any better than sed. I said math envy since you resorted to using algebraic ring theory when there was a much simpler solution. xD