buzz-language / buzz

👨‍🚀 buzz, A small/lightweight statically typed scripting language
https://buzz-lang.dev
MIT License
1.15k stars 31 forks source link

More aggressive constant folding #246

Open giann opened 5 months ago

giann commented 5 months ago

Right now we do constant folding in specific locations. We could systematically check if a node is constant before generating it. BUT it requires to separate type checking in their own functions so we could do:

type checking -> is it constant ? yes -> toValue
                                  no  -> generate

We already do this work in the JIT since type checking has already been done at this point.