igordejanovic / rustemo

LR/GLR parser generator for Rust https://igordejanovic.github.io/rustemo/
Apache License 2.0
30 stars 3 forks source link

Add partial no-std support #7

Open stevefan1999-personal opened 8 months ago

stevefan1999-personal commented 8 months ago

This PR just introduced Clippy rules that translate some std use to core/alloc as much as possible, despite there are some features required manual std feature marking. However, the biggest obstacle would still be petgraph since it is not yet no-std ready. So I keep this as more of a preparation. Once petgraph is going for 0.7.0 we can immediately change to no_std.

Missing features:

  1. Actual no_std codegen for the compiler. This shouldn't be hard because the surface area on the generated code isn't that large.
  2. Decide whether we should use BTreeSet or we use hashbrown directly.
  3. Another point is that we don't need a HashDoS resistant hash table at all because the place we used a hash table for is only needed to detect ambiguities.
  4. Maybe optimize to use smallvec, too?
igordejanovic commented 8 months ago

I don't have experience with no_std so I'll leave directing this change to you. BTreeSet/Map IIRC is used in places where deterministic ordering was needed but this could be revisited. Also for HashDoS resistant maps.