You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
There's no reason to include an entire BNF parser in the compiled application if I just have a set grammar that I want to use that is constant. However, this is what happens if I use the bnf crate in my application - it must parse and validate at runtime.
Describe the solution you'd like
Allow BNF syntax to be parsed at compile-time. Make the required functions const (FromStr::from_str is not const)
Describe alternatives you've considered
N/A
Additional context
N/A
The text was updated successfully, but these errors were encountered:
Hey @LoganDark it's a cool idea but fwiw the reason isn't just from_str, the crate we use for parsing, nom isn't const fn compatible. If there's a parser combinator library out there that is const fn compatible I haven't spotted it yet, and it'd take some evaluation to go that route if it exists. Even for some basic errors like the screen shot below there are unstable features required to get there, i.e.
It's not as elegant but I guess you could use the bnf crate to generate the grammar object and serialize it for use in an app you don't want to have to parse and validate at runtime.
I'm not sure deserialization will be easier to manage at compile time, or at least not in ways that seem like they could be a stable-ish feature for this crate. I'll keep my eyes open though, thanks for creating this issue!
Is your feature request related to a problem? Please describe.
There's no reason to include an entire BNF parser in the compiled application if I just have a set grammar that I want to use that is constant. However, this is what happens if I use the bnf crate in my application - it must parse and validate at runtime.
Describe the solution you'd like
Allow BNF syntax to be parsed at compile-time. Make the required functions const (FromStr::from_str is not const)
Describe alternatives you've considered
N/A
Additional context
N/A
The text was updated successfully, but these errors were encountered: