formal_list: typ ID { [($1,$2)] } | formal_list COMMA typ ID { ($3,$4) :: $1 }
What does the ::
operator mean?
For instance: a :: b
Is the meaning that we add a to b?
formal_list: typ ID { [($1,$2)] } | formal_list COMMA typ ID { ($3,$4) :: $1 }
What does the ::
operator mean?
For instance: a :: b
Is the meaning that we add a to b?
The ::
operator constructs a list. At the left is a list element (the head), at the right is a list (the tail). The operator is right associative, so you can write: 3 :: 4 :: []
. The empty list is denoted by []
.