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

(Incomplete) Implementation of ISO 14977 compliant EBNF parser #64

Closed
wants to merge 4 commits into from

Conversation

hbina
Copy link

@hbina hbina commented Oct 31, 2020

Implementation of ISO 14977 compliant EBNF parser

Prior to this PR, this crate only supports BNF parser.
It also didn't use lingos that align with EBNF.
I needed something more "official" and also more powerful since EBNF contains more operators than just defining-separator-symbol.

Admittedly, I am quite sure that BNF can do everything that EBNF can do.
It just requires a bit manual work.

Another functionality that I wanted is the ability to validate a given string and not just generate them.
I will leave that to another PR.

Note

  1. Figure out why when parsing for definition_list in something like (5 * {"abcde"} - "xyz") | "fghi"; we will get the following single_definition => (5 * {"abcde"} - "xyz") (with the space included). This should have been detected by the implicit whitespaces...

Using pest

Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
Using pest because I find nom to not be robust enough to express.
I might be wrong and it turns out to be easier to implement with nom.
But there are some things that are simply not easily expressable
using nom parses. For example, how to express nested group-sequence?

For now I am quite tired, this seems to be a lot more complicated that
I thought it would be. Turns out this EBNF is quite powerful. I originally
intended to use this as a verification tool for DNS names but I think I will just
use pest after learning how comprehensive it is. Or just manual parsing.

I will leave this to someone more capable.

Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
Signed-off-by: Hanif Ariffin <hanif.ariffin.4326@gmail.com>
@hbina hbina changed the title Iso 14977 take 3 Implementation of ISO 14977 compliant EBNF parser Oct 31, 2020
@hbina hbina changed the title Implementation of ISO 14977 compliant EBNF parser (Incomplete) Implementation of ISO 14977 compliant EBNF parser Oct 31, 2020
@coveralls
Copy link

coveralls commented Nov 2, 2020

Coverage Status

Coverage decreased (-7.09%) to 76.895% when pulling 139917f on hbina:iso_14977_take_3 into 08a19f8 on shnewto:main.

Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
@shnewto
Copy link
Owner

shnewto commented Nov 30, 2022

@hbina thanks for keeping this open for reference for so long! the code base has changed quite a bit since the last activity here so I'm going to close this but I still think ebnf would be a very cool thing to see implemented!

@shnewto shnewto closed this Nov 30, 2022
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

Successfully merging this pull request may close these issues.

3 participants