swift-nav / plover

Plover is a language for matrix algebra on embedded systems.
http://swift-nav.github.io/plover
MIT License
47 stars 14 forks source link

Terrifying error message from extra comma #43

Closed peddie closed 8 years ago

peddie commented 8 years ago
 printf "\nCorrect solution to within %e!\n", tol;

yields

plover: compileStat not implemented: ((TupleLit' [((ConcreteApp' ((Get' (Ref (FnType (FnT [(Tag "examples/prelude.plv" (line 60, column 11) NoTag,"x$451$594$596",True,ArgIn,StringType)] (Just ArgIn) (IntType IDefault))) "printf"))) [((StrLit' "\nCorrect solution to within %e!\n"))] (IntType IDefault))),((Get' (Ref (FloatType FDefault) "tol$562")))]))

Removing the comma fixes it:

printf "\nCorrect solution to within %e!\n" tol;

We should do a better error message . . .

scottswift commented 8 years ago

how's this? https://github.com/swift-nav/plover/pull/45

Loading module testing...
  Loading module prelude...
Error at "examples/testing.plv" (line 11, column 11):
  printf ("hi there", 22);
          ^
Nontrivial tuples not supported.  Did you mean to call a function?

Error at "examples/prelude.plv" (line 60, column 3):
  printf (x :: string) __VARARGS__ :: int;
  ^
at "examples/prelude.plv" (line 60, column 11):
  printf (x :: string) __VARARGS__ :: int;
          ^
at "examples/testing.plv" (line 11, column 3):
  printf ("hi there", 22);
  ^
Could not unify type
   (string, int)
with type
   string
Error at "examples/testing.plv" (line 11, column 3):
  printf "hi there", 22;
  ^
Nontrivial tuples not supported.  Did you mean to call a function?
peddie commented 8 years ago

That's so much better I can't even understand it.