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

WIP:Format formalization #30

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

guygastineau
Copy link

I have a first draft of BNF-derivative formalization of the mds file format.
I can do one for the mdm format too.

The second commit message has a lot of information, so I suggest reading it.

  * Technically I started some sequence class definitions already too.
  * It should be reviewed to catch any silly errors.
  * Some mixing of math text (just set operations and notation) has
    happened. The notation itself still follows BNF pretty closely,
    and I definitely would not call it MBNF. With Wikipedia and some
    knowledge of set operations it should be easy to figure out the
    formalizations.
  * The spec comments at the top of the mds-format.txt file did not
    mention including the length of the blocks, and they were
    unnecessary anyway. The final grammar for the class <mds> is
    very much just that initial specification with a little verbosity.
@Chelsea486MHz
Copy link
Member

Looks good to me!

Do you think the specs could be made fully BNF compliant? Development of future file converters/parsers could be made easier if we get it fully compliant.

Though the current format is good enough, in my opinion.

Comment on lines +30 to +35
where
<character'> = <newline> △ <character>

;; Do we need all of utf8?
;; I tend to prefer generality, but maybe this is too much.
<character> ::= <set of all valid utf8>
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The main deviation I have made is here. Both <newline> △ <character> and <set of all valid utf8> (I should add codepoints to that text) are shortcuts, but otherwise we need to define our <string> class by including EVERY character we want to be valid in this file. Even with just lower and uppercase ascii that will add clutter, but if we want to make sure that Asian, Arabic, Jewish, etc... authors can add their real given name to MDS files, then the grammar should include more than ascii. Defining such a class without shortcuts would mean a seriously long class definition where we would need to include all of the characters (many have to be represented as strings, since they are multibyte).

NB. Multibyte strings don't break the C or ascii rules, so allowing all utf8 codepoints doesn't require any changes in your code (probably).

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given the massive class definitions that would be in the file without the Set based shortcuts I think it would be harder to implement parsers. At least, to make it easier we would need comments explaining what the giant right side content is, so we would essentially have some ad hoc implementation of these shortcuts as informal comments. Anyway, I just thought this perspective would help us think about it. If you think the current approach is fine, then I guess we have no issue. I will work on a formalization for the MDM files in whatever free time I get this week ;)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's keep it that way then. No need to be 100% BNF compliant.

I tried to explore other ways this evening, it's just not worth it. Your current implementation is good!

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In case we want anything from the established extended BNFs https://en.m.wikipedia.org/wiki/Extended_Backus%E2%80%93Naur_form

@guygastineau
Copy link
Author

Hi, sorry I didn't get back to this laast week. I should have time this weekend.

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