[0] https://blog.bracha.org/primordialsoup.html?snapshot=Amplefo... [1]https://newspeaklanguage.org [2]https://blog.bracha.org/primordialsoup.html?snapshot=Amplefo...
Crafting Interpreters
31–40 of 62 posts
Re: Crafting Interpreters
#32I stopped reading when he started using the visitor pattern
The visitor pattern is very common in programming language implementations. I've seen it in the Rust compiler, in the Java Compiler, in the Go compiler and in the Roslyn C# compiler. Also used extensively in JetBrains' IDEs. What do you have against this pattern? Or what is a better alternative?
Re: Crafting Interpreters
#33Re: Crafting Interpreters
#34Earlier quoted context omitted.
The visitor pattern is very common in programming language implementations. I've seen it in the Rust compiler, in the Java Compiler, in the Go compiler and in the Roslyn C# compiler. Also used extensively in JetBrains' IDEs. What do you have against this pattern? Or what is a better alternative?
Visitor is heavy of code pattern that can be replaced by elegant, readable switch with exhaustive check, so all operations available by "Kind" enum are covered.
Re: Crafting Interpreters
#35Crafting Interpreters is the one thing that LLM's can do really really well. Because it is so easy to define and test. Here are is a new LUA interpreter implemented in Python: https://github.com/rhulha/MoonPie And here is a new language: https://github.com/rhulha/EasyScript
Re: Crafting Interpreters
#36Earlier quoted context omitted.
The visitor pattern is very common in programming language implementations. I've seen it in the Rust compiler, in the Java Compiler, in the Go compiler and in the Roslyn C# compiler. Also used extensively in JetBrains' IDEs. What do you have against this pattern? Or what is a better alternative?
Visitor is heavy of code pattern that can be replaced by elegant, readable switch with exhaustive check, so all operations available by "Kind" enum are covered.
Re: Crafting Interpreters
#37I love this book! I do wish there was a new edition that updated the version of Java used in the tree-walk interpreter. There's been some additions to the language, like sealed classes and exhaustive switches, that could really benefit the implementation.
Re: Crafting Interpreters
#38Earlier quoted context omitted.
What’s bad about the visitor pattern? /gen
https://grugbrain.dev/ grug very elated find big brain developer Bob Nystrom redeem the big brain tribe and write excellent book on recursive descent: Crafting Interpreters book available online free, but grug highly recommend all interested grugs purchase book on general principle, provide much big brain advice and grug love book very much except visitor pattern (trap!) Grug says bad. In all seriousness, the rough a…
Grug doesn't elaborate much, but here's the author's take in slightly more detail.
Re: Crafting Interpreters
#39I love this book! I do wish there was a new edition that updated the version of Java used in the tree-walk interpreter. There's been some additions to the language, like sealed classes and exhaustive switches, that could really benefit the implementation.
It's a fun little exercise left to the reader to upgrade to current Java. It pretty much eliminates the need for his ad-hoc code generation tool.
Re: Crafting Interpreters
#40Really I would love to know how parse context sensitive stuff like typedef which will have "switched" syntax for some tokens. Would like to know things like "hoisting" in C++, where you can you the class and struct after the code inside the function too, but I just find it hard to describe them in rigorous formal language and grammar. Hacky solution for PEG such as adding a context stack requires careful management o…
I know it's no solace to you, but Rust and Go don't even have this problem Afaik, and it's avoidable by careful consideration.