pass a lexer and a parser to the tree pattern match or instead of the classes.