Answer
Production rules in extended Backus–Naur
Work Step by Step
production rules in extended Backus–Naur form that
generate all decimal numerals consisting of an optional
sign,
- a nonnegative integer, and a decimal fraction that
is either the empty string or a decimal point followed by
an optional positive integer optionally preceded by some
number of zeros.
- numeral ::= sign? nonzerodigit digit∗ decimal? | sign? 0 decimal?
- sign ::= + | −
- nonzerodigit ::= 1 | 2 | · · · | 9
- digit ::= 0 | nonzerodigit
- decimal ::= .digit∗