caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Christian Lindig <lindig@cs.uni-sb.de>
To: rose@acm.org
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] Ocamlburg problem
Date: Fri, 23 Apr 2004 08:56:51 +0200	[thread overview]
Message-ID: <659EACA3-94F3-11D8-A5C0-000A95DDB608@cs.uni-sb.de> (raw)
In-Reply-To: <4088A020.2000103@tfb.com>


On Apr 23, 2004, at 6:48 AM, Ken Rose wrote:

> Does anyone have any experience debugging OCamlBurg code generators? 
> I'm getting an "Uncovered" exception, and I'm unable to figure out why 
> it's failing.  Debugging tips, anyone?

An Uncovered exception means, your subject tree cannot be matched with 
your rules - a rule is missing. In general it is quite difficult to 
argue that an existing set of rules in complete.

For debugging our OCamlburg rules we have no magic bullet. When an 
Uncovered exception occurs we pretty print the subject tree and inspect 
it manually.

Another trick is to have a set of rules in addition to the existing 
rules. These rules are constructed in way that they always cover the 
subject tree. For example, we are having rules for an "any" nonterminal 
to match a certain kind of expressions.

any : True  ()          {: cat [ "True"  ] :}
any : False ()          {: cat [ "False" ] :}
any : Link(x, w:int)    {: cat [ "Link(";x#mangled_text;",";width w;")" 
] :}
any : Late(string,w:int){: cat [ "Late(";string;",";width w;")" ] :}
any : Bits(bits)        {: cat [ "Bits(b)" ] :}

any : Fetch (any, w:int){: cat [ "Fetch(";any;",";width w;")" ] :}

any : Add(x:any, y:any) {: cat [ "Add(";x;", ";y;")" ] :}
any : Sub(x:any, y:any) {: cat [ "Sub(";x;", ";y;")" ] :}
any : Sx(any)           {: cat [ "Sx(";any;")" ] :}
any : Zx(any)           {: cat [ "Zx(";any;")" ] :}
any : Lobits(any)       {: cat [ "Lobits(";any;")" ] :}

These rules just follow the syntactical structure of the subject tree 
and thus we know it will always match. The semantic actions simply 
build a string of the subject tree. If you guard this set of rules with 
a high cost it will never match when your real rules can find a cover, 
but it matches otherwise and you won't get an Uncovered.

You can find this code here:

	http://www.cminusminus.org/rsync/qc--/src/alpharec.nw



-- Christian

--
http://www.st.cs.uni-sb.de/~lindig/

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


      reply	other threads:[~2004-04-23  7:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-04-23  4:48 Ken Rose
2004-04-23  6:56 ` Christian Lindig [this message]

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=659EACA3-94F3-11D8-A5C0-000A95DDB608@cs.uni-sb.de \
    --to=lindig@cs.uni-sb.de \
    --cc=caml-list@inria.fr \
    --cc=rose@acm.org \
    /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).