This is a function from a parser module. I have trouble understanding one line of code
let rec e1 tokens =
match tokens with
Tokenizer.IfTok :: tokens1 ->
let (testAST, tokens2) = e1 tokens1
in
(match tokens2 with
Tokenizer.ThenTok :: tokens3 ->
let (thenAST, tokens4) = e1 tokens3
in
(match tokens4 with
Tokenizer.ElseTok :: tokens5 ->
let (elseAST, tokens6) = e1 tokens5
in
(If(testAST, thenAST, elseAST), tokens6)
| _ -> raise (Syntax ("e1: missing else.")))
| _ -> raise (Syntax ("e1: missing then.")))
| _ -> e2 tokens
and e2 tokens = ........
I have no idea how this line works
let (testAST, tokens2) = e1 tokens1 in
I know it declares a local variable which is a tuple, but where does the value (testAST, tokens2) come from? It doesn't seem to have anything to do with tokens or tokens1. Also does this line only declares a tuple or it also calls the function? Thanks!