* [Caml-list] Ocamlburg problem
@ 2004-04-23 4:48 Ken Rose
2004-04-23 6:56 ` Christian Lindig
0 siblings, 1 reply; 2+ messages in thread
From: Ken Rose @ 2004-04-23 4:48 UTC (permalink / raw)
To: caml-list
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?
TIA
- ken
-------------------
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [Caml-list] Ocamlburg problem
2004-04-23 4:48 [Caml-list] Ocamlburg problem Ken Rose
@ 2004-04-23 6:56 ` Christian Lindig
0 siblings, 0 replies; 2+ messages in thread
From: Christian Lindig @ 2004-04-23 6:56 UTC (permalink / raw)
To: rose; +Cc: caml-list
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2004-04-23 7:02 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-04-23 4:48 [Caml-list] Ocamlburg problem Ken Rose
2004-04-23 6:56 ` Christian Lindig
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox