1

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?

Jan Bodnar
  • 10,969
  • 6
  • 68
  • 77
janepoor
  • 31
  • 1
  • 2

1 Answers1

4

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 [].

Jeffrey Scofield
  • 65,646
  • 2
  • 72
  • 108