Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor the compiler to use visitors #75

Open
brendanzab opened this issue Jun 5, 2018 · 3 comments
Open

Refactor the compiler to use visitors #75

brendanzab opened this issue Jun 5, 2018 · 3 comments

Comments

@brendanzab
Copy link
Member

brendanzab commented Jun 5, 2018

I poke fun at expression parser/evaluator written in OO style, because really the visitor pattern is just asking for it. But I have a weird, almost morbid fondness for such things written in plain old ANSI C. It’s complicated between me and C don’t ask me about it I’m not ready

Drn’t Tran Ma 🦖

At the moment we create lots of intermediate data structures between the stages in the compiler, and it would be nice to cut that down!

Using the visitor pattern might make things more efficient by allowing us to fuse various traversals into single passes. Ultimately it might even be a good idea (or even necessary) to push the visitor abstraction back to the nameless library as well. The challenge would be to continue to maintain a nice, readable codebase in the process.

Resources

brendanzab added a commit that referenced this issue Jun 12, 2018
@brendanzab
Copy link
Member Author

Just made a repo with some visitor stuff from the Zero-Overhead blog post: brendanzab/rust-visitors.

@brendanzab
Copy link
Member Author

I also have a (currently broken) branch with some experiments at https://github.com/pikelet-lang/pikelet/tree/visitors

@brendanzab
Copy link
Member Author

brendanzab commented Jul 25, 2018

One concern is that Moniker (the name-binding library we use) is currently designed in a way that might make this hard to get much value out of. It would be neat to see if we could move Moniker to a model that more looks like what is described in Visitors Unchained and implemented in alphaLib.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant