1
votes
let confere_tipo msg tinf tdec =
  if tinf <> tdec
  then failwith (msg ^ " deve ser do tipo " ^ tinf)

File "semantico.ml", line 50, characters 0-3:
Error: Syntax error

What am I doing wrong?

1
This function alone compiles fine. You probably have an error before its definition. Please try and find the minimal amount of code needed to reproduce the error and edit your post with that (along with any other useful information, such as your OCaml version). - Marth
I confirm the @Marth comment, the function also compiles on my machine. - alifirat

1 Answers

3
votes

This function looks valid, so your problem is in the code preceding it. I assume that this function starts on line 50, and according to your error message the compiler is offended by the first three characters of line 50, which would be let. My guess is that the expression immediately preceding this function was not properly terminated. The dirty way to fix this would be to add a ;; before this function is declared, but it would be easier to fix if I could see a bit more of your code.