Skip to content

EBNF * does not parse correctly #574

@padfoot9445

Description

@padfoot9445

When I was reworking my parser, I arrived at this sub-grammar:

[Production($"NTTypeAndIdentifierCSVElement: NTFunctionArgDeclModifiersCombined NTType Identifier Comma?")]
[Production($"NTFunctionArgDeclModifiersCombined: NTFunctionArgDeclModifier*")]
...

which fails to parse one of my test-cases. However,

[Production($"NTTypeAndIdentifierCSVElement: NTFunctionArgDeclModifiersCombined? NTType Identifier Comma?")]
[Production($"NTFunctionArgDeclModifiersCombined: NTFunctionArgDeclModifier*")]
...

works fine. It may be another case where I have mis-understood what is permissible in the parser, but at least to my understanding these two grammars should be equivalent.

The full code in both situations is listed below:

https://github.com/padfoot9445/NewExpr/tree/junk/working
https://github.com/padfoot9445/NewExpr/tree/junk/notworking

Note that although in working csly is only at version 3.5.4 (I am reluctant to upgrade because of the ominous "faliure" annotation in github), I did try upgrading in the notworking branch, which is at version 3.7.4.

In particular, SmallLangTest/ParserTest has two test faliures (Test__Function_Definition__Does_Not_Throw and Test__Parse_AllPrograms__Does_Not_Throw) in notworking, and working passes all tests; the only modification between them is the csly version and the change as mentioned above.

Edit: I accidentally did something to my git history. It should be fixed now, and I did reproduce the issue on the new branches.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions