Tree grammar ported (close #42)