# Lists in BNFC
If you want to know how list notation works in grammars processed by BNFC, you can write your own examples, generate a parser and then study the `.info` file.
## Lists in Context-Free Grammars
For example, the BNFC-grammar
```c
RA. A ::= [B] ;
separator nonempty B "" ;
RB. B ::= "b" ;
```
is turned into the context-free grammar (CFG)
```c
A -> ListB
ListB -> B
ListB -> B ListB
B -> 'b'
```
One advantags of the built-in list notation is that the BNFC-grammar becomes easier to read.
**Exercise:** Write out (or produce with BNFC) the CFG for
```c
RA. A ::= [B] ;
separator B "," ;
RB. B ::= "b" ;
```
## Lists in Haskell's Algebraic Data Types
Another advantage of the list notation is that it gives us a more concise syntax for the AST.
The algebraic data type for ASTs generated by the first BNFC-grammar is
```haskell
data A = RA [B]
data B = RB
```
If instead we implemented lists of `b`s explicitly in the grammar as follows
```c
RA. A ::= ListB ;
ListBOne. ListB ::= B ;
ListBMore. ListB ::= B ListB ;
RB. B ::= "b" ;
```
we obtain the algebraic data type instead
```haskell
data A = RA ListB
data ListB = ListBOne B | ListBMore B ListB
data B = RB
```
The first one is certainly easier to use once we go on to write Haskell programs by recursion on abstract syntax.