# What is the BNF (or BNF-like) syntax for a specific number of repetitions?

I would like to write something like

``````<byte> ::= <bit>*8
``````

to mean that a `<byte>` is a sequence of exactly 8 `<bit>`'s.

Is there a way to do this in BNF or a widely used extension of BNF? How?

In BNF, you would just define that by repeating the symbol:

``````<byte> ::= <bit> <bit> <bit> <bit> <bit> <bit> <bit> <bit>
``````

On the other hand, Augmented Backus–Naur form defines repetition:

``````<example> ::= *<bit>
``````

The above means:

``````<example> ::= "" | <bit> <example>
``````

So, none or more `bit`.

For one or more you can say:

``````<example> ::= 1*<bit>
``````

For a range (for example one to four), inclusive:

``````<example> ::= 1*4<bit>
``````

Or a fixed number:

``````<example> ::= 8*8<bit>
``````

Which you can also write like this:

``````<example> ::= 8<bit>
``````

Note: In ABNF, `<` and `>` are optional.

• Thanks. Based on the reference, it looks like this is called "specific repetition." – Ana Nimbus Oct 10 '19 at 20:53