drewrip / bytor

https://crates.io/crates/bytor
1 stars 0 forks source link

Move off of Arc #6

Closed drewrip closed 5 months ago

drewrip commented 5 months ago

When I first started writing the grammar and the AST for Rascal I found it easiest to wrap lots of the AST nodes in an Arc. To make things easiest to get going I wanted to use the most permissive structure possible and I had this idea in my head that I would parallelize part of the frontend (so I wanted the atomic part of Arc). I'd like to move off of Arc and use Box instead (the more restrictive option).

I haven't looked too far into how much the code base would have to be restructured to accomadate this, but I don't think it should be too bad. If nothing else we should be able to do a one-to-one swap Arc -> Rc, but I'd like to go from Rc -> Box. I'm hoping to get around to this at some point, as I didn't put too much thought into Arc originally.

Most of the work should be in src/ast.rs, however the Arc usage propagates across many other files because of its use in the AST. The only one that might be particularly confusing since rust-analyzer won't pick it up is in src/rascal_grammar.lalrpop. This is the parser generator that I use, and it creates the nodes in the AST using Arc's.

drewrip commented 5 months ago

@THE-COB This might be of interest. Since I haven't fleshed out the design of the compiler or even the source language it is slightly difficult to define issues clearly, but this is one I thought had a clear direction. Moving from reference counting to Box seems like it might have interesting implications.

drewrip commented 5 months ago

Finished with #7