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

empty production alternative: Maybe you are missing the "empty" keyword in Letter #138

Open
arater opened this issue Dec 23, 2023 · 1 comment

Comments

@arater
Copy link

arater commented Dec 23, 2023

`
/* Misc ------------------------------------------------------------------*/

Integer ::= Digit | Integer Digit ;
Digit ::= "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | empty ;

Letters ::= Letter Letters | empty;
Letter ::= 'A' | 'B' | 'C' | 'D' | 'E' | 'F' | 'G' | 'H' | 'I' | 'J' | 'K' | 'L' | 'M' | 'N' | 'O' | 'P' | 'Q' | 'R' | 'S' | 'T' | 'U' | 'V' | 'W' | 'X' | 'Y' | 'Z' |
'a' | 'b' | 'c' | 'd' | 'e' | 'f' | 'g' | 'h' | 'i' | 'j' | 'k' | 'l' | 'm' | 'n' | 'o' | 'p' | 'q' | 'r' | 's' | 't' | 'u' | 'v' | 'w' | 'x' | 'y' | 'z' | empty ;

Char ::= PrintableChar | WhitespaceChar ;
PrintableChar ::= 'A' | 'B' | 'C' | 'D' | 'E' | 'F' | 'G' | 'H' | 'I' | 'J' | 'K' | 'L' | 'M' | 'N' | 'O' | 'P' | 'Q' | 'R' | 'S' | 'T' | 'U' | 'V' | 'W' | 'X' | 'Y' | 'Z' |
'a' | 'b' | 'c' | 'd' | 'e' | 'f' | 'g' | 'h' | 'i' | 'j' | 'k' | 'l' | 'm' | 'n' | 'o' | 'p' | 'q' | 'r' | 's' | 't' | 'u' | 'v' | 'w' | 'x' | 'y' | 'z' | "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | OtherSymbols ;

WhitespaceChar ::= Space | Tab | NewLine ;
OtherSymbols ::= '!' | '@' | '#' | '$' | '%' | '^' | '&' | '*' | '(' | ')' | '-' | '+' | '=' | '{' | '}' | '[' | ']' | '|' | '\' | ':' | ';' | '"' | ''' | '<' | '>' | ',' | '.' | '/' | '?' ;
Space ::= ' ' ;
Tab ::= #x9 ;
NewLine ::= CarriageReturn | LineFeed ;

CarriageReturn ::= '\r' ;
LineFeed ::= '\n' ;
`

I am trying to create bnf file for regular expressions grammars but i am getting always this error and i do not understand why it is happening? Can you help me or do you have any regular expressions bnf file that work witc gocc, can you provide me?

@awalterschulze
Copy link
Collaborator

You can try single quotes for Digit as in '0' - '9'
And gocc syntax is different it isn't :==, but only :

You could also try 'A' - 'Z' so you don't have to list all alternatives

But I am just providing some random suggestions, think it will help to go in the right direction, but not necessarily fix all issues

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

No branches or pull requests

2 participants