English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
Error location reporting in Menhir
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2007-03-30 (14:02)
From: Joel Reymont <joelr1@g...>
Subject: Error location reporting in Menhir
I currently retrieve location like this during parser errors:

   let rhs_loc n = (Parsing.rhs_start_pos n, Parsing.rhs_end_pos n)

I then report it like this:

   let syntax_error s num =
     parser_error s (rhs_loc num)

In my grammar I report errors like this:

   | INPUT COLON input_decs error { syntax_error "Missing semicolon" 4 }

I don't do anything special in the lexer to adjust lexeme positions.

How do I rewrite my error reporting for Menhir?

	Thanks, Joel