Remix.run Logo
catlifeonmars 2 days ago

Do you run an optimization pass on the AST between parsing and evaluation?

HarHarVeryFunny 2 days ago | parent | next [-]

For an interpreter / AST executor, I think a big win would be efficient parsing in the first place, in particular using a precedence parser for expressions vs recursive descent, which would avoid the need to optimize the AST to remove the 1:1 "unit productions" in the grammar.

pizlonator 2 days ago | parent | prev [-]

I run a “resolve” pass.

That’s where for example getter inference happens.