25 ms·
> just inspect which tokens are seen and directly construct AST nodes I'll repeat myself: this is not possible because you need to recursively construct the no
by almostgotcaught 1y ago
> just inspect which tokens are seen and directly construct AST nodes
I'll repeat myself: this is not possible because you need to recursively construct the nodes (how else would you get a tree...).
- ossopite 1y agoI think I'm missing something here. if you have a grammar rule R with children A and B, and a function in your recursive descent parser that corresponds to R, why can R not call the parser functions for A and B, which return AST nodes themselves, and then construct another AST node using the result of those? Where was the visitor pattern required here?
- mrkeen 1y agoMe too. No-one's denying that recursion is happening. We're just not sure about it being synonymous with the Visitor Pattern.