błąd szczegółowy z ocamlyacc
W żubrach wystarczy dodać
%verbose-error
do pliku, aby błędy parsera były bardziej szczegółowe. Czy jest jakiś sposób na uzyskanie podobnej funkcjonalności z ocamlyacc?
Tutaj jest odpowiedzią na podobne pytanie, ale nie mogłem nic z tego zrobić. Tak nazywam funkcje lexera i parsera:
let rec foo () =
try
let line = input_line stdin in
(try
let _ = (Parser.latexstatement lexer_token_safe (Lexing.from_string line)) in
print_string ("SUCCESS\n")
with
LexerException s -> print_string ("$L" ^ line ^ "\n")
| Parsing.Parse_error -> print_string ("$P" ^ line ^ "\n")
| _ -> print_string ("$S " ^ line ^ "\n"));
flush stdout;
foo ();
with
End_of_file -> ()
;;
foo ();;