BNFC / bnfc

BNF Converter
http://bnfc.digitalgrammars.com/
586 stars 165 forks source link

Detect and report invalid identifiers #186

Closed gdetrez closed 4 years ago

gdetrez commented 8 years ago

This issue was first discussed in the mailing list

The lbnf reference specify that "An identifier is a nonempty sequence of letters, starting with a capital letter." but bnfc will accept a rule such as cat . Type = "Foo";, generating invalid haskell code.

Instead, bnfc should detect the invalid identifier and print a error message.

pascalh commented 8 years ago

I'd like to work on that issue as I already said on the mailing list (if it is fine for you).

gdetrez commented 8 years ago

@pascalh yes, I saw, thanks for volunteering! It seems that I can only assign issue to member of the organization. I sent you an invitation :-)

andreasabel commented 5 years ago

It seems that lower case identifiers are for defined identifiers, via the define pragma. This feature is documented in the book Implementing Programming Languages, see http://www.grammaticalframework.org/ipl-book/ , but not in the user manual. Also, there is no check that a definition is actually supplied in the grammar file. A badly implemented and badly documented feature which eventually got broken by some refactoring, see #214.

andreasabel commented 4 years ago

I did serious work on the define feature in #214, #266, and #285, addressing the lowercase label issue. Error reporting is better now. Also, apostrophes are now forbidden in identifiers, see #279.

Closing this now, feel free to reopen with new information.