Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

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