diff --git a/alpaga/grammar_lexer.mll b/alpaga/grammar_lexer.mll
index effa0a6b287559517d091baf648f88ec527ef4ac..5716c08bf5e1d840a78e8f28313376110a2ae922 100644
--- a/alpaga/grammar_lexer.mll
+++ b/alpaga/grammar_lexer.mll
@@ -21,7 +21,10 @@ rule token = parse
   | "rules" { RULES }
   | id as s { IDENTIFIER s }
   | eof { EOF }
-  | _ as x { failwith (Printf.sprintf "unexpected char '%c'\n" x)}
+  | _ as x { let open Lexing in
+             failwith (Printf.sprintf "unexpected char '%c' at line %d col %d\n" x
+                         (lexbuf.lex_curr_p.pos_lnum)
+                         (lexbuf.lex_curr_p.pos_cnum - lexbuf.lex_curr_p.pos_bol))}
 and action level s = parse
   | '}' { if level = 0 then CODE s else action (level-1) (s ^ "}") lexbuf }
   | '{' { action (level + 1) (s ^ "{") lexbuf }