I ended up doing this:
{ID Head} = {Letter} + [_] - [:.]
{ID Tail} = {AlphaNumeric} + [_-] - [:.]
Identifier = {ID Head} {ID Tail}*
My Identifier can not start with a number.
I think the - [:.] part may not be needed but I will include it for clarity.
Thanks for the help.
Truman
--- In GOLDParser@yahoogroups.com, "Devin Cook" <GOLD-Admin@...> wrote:
>
> You define your Identifier set as:
>
>
>
> {ID} = {Letter} + {Digit} + [_-] - [:]
>
>
>
> Which includes the single dash. You also defined your identifier terminal
> as:
>
>
>
> Identifier = {ID}
>
>
>
> This means that your identifier will contain one character from the {ID}
> set. You can remove the dash from the {ID} set. The set also contains the
> digit set, so it includes 0.9. This means that that your identifier can also
> be a number such as 9. I would recommend changing your definitions to:
>
>
>
> {ID} = {Letter} + {Digit} + [_]
>
>
>
> Identifier = {Letter}{ID}+
>
>
>
>
>
> - Devin
>
>
>
>
>
> _____
>
> From: GOLDParser@yahoogroups.com [mailto:GOLDParser@yahoogroups.com] On
> Behalf Of lacktrum
> Sent: Friday, April 03, 2009 5:20 PM
> To: GOLDParser@yahoogroups.com
> Subject: [GOLD Parser] Hyphen in identifier
>
>
>
> I am new to this and I am trying to parse a conditional and math script that
> I am developing.
>
> I am failing on hyphens in the Identifiers and the math -.
>
> Failing on:
> Line / State 34 Reduce-Reduce Conflict
>
> My grammar:
>
> "Name" = 'Operation'
> "Author" = 'Truman Lackey'
> "Version" = '0.01'
> "About" = 'Comparison and mathematical operators'
>
> "Start Symbol" = <Statement>
>
> ! ------------------------------------------------- Sets
>
> {ID} = {Letter} + {Digit} + [_-] - [:]
> {String Ch} = {Printable} - ["]
> {Char Ch} = {Printable} - ['']
> {Hex Digit} = {Digit} + [abcdef] + [ABCDEF]
>
> ! ------------------------------------------------- Terminals
>
> Identifier = {ID}
> MemberName = '.' {ID}
> DecLiteral = {Digit}+ ( [UuLl] | [Uu][Ll] | [Ll][Uu] )?
> HexLiteral = '0'[xX]{Hex Digit}+ ( [UuLl] | [Uu][Ll] | [Ll][Uu] )?
> RealLiteral = {Digit}*'.'{Digit}+
> StringLiteral = '"'( {String Ch} | '\'{Printable} )* '"'
> CharLiteral = '' ( {Char Ch} | '\'{Printable} )''
>
> <Valid ID>
> ::= Identifier
>
> <Qualified ID>
> ::= <Valid ID> <Member List>
>
> <Member List>
> ::= <Member List> MemberName
> | !Zero or more
>
> <Literal>
> ::= true
> | false
> | DecLiteral
> | HexLiteral
> | RealLiteral
> | CharLiteral
> | StringLiteral
> | null
>
> ! ------------------------------------------------- Rules
>
> <Expression>
> ::= <Conditional Exp> '=' <Expression>
> | <Conditional Exp> '+=' <Expression>
> | <Conditional Exp> '-=' <Expression>
> | <Conditional Exp> '*=' <Expression>
> | <Conditional Exp> '/=' <Expression>
> | <Conditional Exp> '^=' <Expression>
> | <Conditional Exp> '&=' <Expression>
> | <Conditional Exp> '|=' <Expression>
> | <Conditional Exp> '%=' <Expression>
> | <Conditional Exp> '<<=' <Expression>
> | <Conditional Exp> '>>=' <Expression>
> | <Conditional Exp>
>
> <Conditional Exp>
> ::= <Or Exp> '?' <Or Exp> ':' <Conditional Exp>
> | <Or Exp>
>
> <Or Exp>
> ::= <Or Exp> '||' <And Exp>
> | <And Exp>
>
> <And Exp>
> ::= <And Exp> '&&' <Logical Or Exp>
> | <Logical Or Exp>
>
> <Logical Or Exp>
> ::= <Logical Or Exp> '|' <Logical Xor Exp>
> | <Logical Xor Exp>
>
> <Logical Xor Exp>
> ::= <Logical Xor Exp> '^' <Logical And Exp>
> | <Logical And Exp>
>
> <Logical And Exp>
> ::= <Logical And Exp> '&' <Equality Exp>
> | <Equality Exp>
>
> <Equality Exp>
> ::= <Equality Exp> '==' <Compare Exp>
> | <Equality Exp> '!=' <Compare Exp>
> | <Compare Exp>
>
> <Compare Exp>
> ::= <Compare Exp> '<' <Shift Exp>
> | <Compare Exp> '>' <Shift Exp>
> | <Compare Exp> '<=' <Shift Exp>
> | <Compare Exp> '>=' <Shift Exp>
> | <Shift Exp>
>
> <Shift Exp>
> ::= <Shift Exp> '<<' <Add Exp>
> | <Shift Exp> '>>' <Add Exp>
> | <Add Exp>
>
> <Add Exp>
> ::= <Add Exp> '+' <Mult Exp>
> | <Add Exp> '-' <Mult Exp>
> | <Mult Exp>
>
> <Mult Exp>
> ::= <Mult Exp> '*' <Unary Exp>
> | <Mult Exp> '/' <Unary Exp>
> | <Mult Exp> '%' <Unary Exp>
> | <Unary Exp>
>
> <Unary Exp>
> ::= '!' <Unary Exp>
> | '~' <Unary Exp>
> | '-' <Unary Exp>
> | '++' <Unary Exp>
> | '--' <Unary Exp>
> | <Negate Exp>
>
> <Negate Exp>
> ::= '-' <Primary>
> | <Primary>
>
> <Primary>
> ::= <Qualified ID>
> | <Literal>
>
> <Statement>
> ::= <Expression>
>
> Help in fixing this would be appreciated.
>
> Thanks,
>
> Truman
>
>
>
>
>
> [Non-text portions of this message have been removed]
>