logoalt Hacker News

jokoon01/15/20262 repliesview on HN

the parser does


Replies

ceronman01/15/2026

The parsers in crafting interpreters do not use the visitor pattern. The visitor pattern is used when you already have a tree structure or similar. The parser is what gives you such tree structure, the AST. When you have this structure, you typically use the visitor pattern to process it for semantic analysis, code generation, etc.

tonyedgecombe01/15/2026

I’ve only glanced at the second part but I don’t remember that being the case.