0
votes

I'm new to ocaml. I get the following error when I am trying to execute this code.

let rec parser (edge_lst : edge list) (miniNode_lst: miniNode List) (previousNode : miniNode) (s_lst: stmt list) =
match s_lst with
| [] -> (*no more statements => Add stop node and save the graph*) (edge_lst,miniNode_lst)
| hd :: tl -> 
               let currentNode = createNode(hd) 
               in let miniNode_lst_new = miniNode_lst@[currentNode] and  
               edge_lst_new  = edge_lst@[createEdge(previousNode,currentNode) in
               parser edgePlst_new miniNode_lst_new currentNode tl;

Error: Syntax error: type expected.

Please let me know where exactly I am going wrong here.

1

1 Answers

0
votes

you are using List instead of list in the definition of parser, also ']' is missing (you have one open bracket without closed bracket). And is createEdge works on a tuple ? I believe it is not, and the syntax should be (with the close bracket) :

 edge_lst_new  = edge_lst@[createEdge previousNode currentNode] in