caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Sham K" <shaawm@gmail.com>
To: caml-list@yquem.inria.fr
Subject: Error location in Camlp4
Date: Thu, 24 Apr 2008 14:47:26 +0200	[thread overview]
Message-ID: <7c835afc0804240547o2bae6f31wc53afde417a52636@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 980 bytes --]

Hello Everyone,

I have written a tokenizer (using parser constructs in camlp4) which
tokenizes a character stream of a string. I use this to define a lexer
(using Token.lexer_func_of_parser) as shown in turorials and manuals on
camlp4. Then I make use of EXTEND statements to interpret token stream to
according to  some syntax to build some Abstract syntax tree.

All this works fine. However, whenever there is error I just get
"Stdpp.Exc_located" with no indications of the location of error. (It is
just (_,_) )

The camlp4 manual says that in the action part of rules, a variable loc is
always defined which can be used to raise errors.
But the complier complains that loc is not defined when I try to use loc in
try ... with statements.

Can someone explain how I can print error locations. It works with standard
lexer plexer, but not with my lexer. I do not quite
see what else I should include in my lexer to enable error location
reporting.

Thanks for your time.
Sham

[-- Attachment #2: Type: text/html, Size: 1049 bytes --]

                 reply	other threads:[~2008-04-24 12:47 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7c835afc0804240547o2bae6f31wc53afde417a52636@mail.gmail.com \
    --to=shaawm@gmail.com \
    --cc=caml-list@yquem.inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).