3 ms·
the string '02' is not the same as '2'. I'm not sure I see a problem with the syntax grammar in parsing the string '102'.
by waynesonfire 7y ago
the string '02' is not the same as '2'. I'm not sure I see a problem with the syntax grammar in parsing the string '102'.
- a1369209993 7y agoAnd the string "2-3" is not the same as "-1"; that doesn't make `sum ::= term '-' sum` correct.
- waynesonfire 7y agoconcatenation is associative while subtraction is left-associative. you're getting yourself in trouble defining subtraction in that way.
- a1369209993 7y ago> concatenation is associative while subtraction is left-associative Yes, exactly my point: `sum ::= term '-' sum` is right-associative, and therefore not a correct syntax for subtraction. Similarly, place-value notation[0] is left-associative, so `nat ::= digit | digit nat`, which is right-associative, is not a valid grammer for a place-value-notation natural number. 0: well, big-endian place-value notation, which is what we're talking about here