[m-dev.] I think there's a bug in the debugger

Ralph Becket rafe at csse.unimelb.edu.au
Fri Jan 16 17:17:12 AEDT 2009


Am I imagining this or should the THEN and ELSE events in this trace
be COND and THEN events, respectively?

Here's the predicate in question:

:- pred zm_array_ti_expr_tail : parser(base_ti_expr_tail) `with_inst` parser.

zm_array_ti_expr_tail(bte_array_of(KeyTIEs, ValueTIE, IsListSyntax), S, !Ts) :-
    peek_token(_, LineNum, !.Ts),
    ( if keyword("array", S, !Ts) then
        expect("list of type-inst expressions in brackets after `array'",
            brackets(lsquare, comma_list(zm_ti_expr), rsquare), KeyTIEs,
            S, !Ts),
        expect("`of' after array indices",
            keyword("of"), _, S, !Ts),
        expect("type-inst expression after `of'",
            zm_ti_expr, ValueTIE, S, !Ts),
        IsListSyntax = no
      else if keyword("list", S, !Ts) then
        expect("`of' after `list'",
            keyword("of"), _, S, !Ts),
        expect("type-inst expression after `list of'",
            zm_ti_expr, ValueTIE, S, !Ts),
        KeyTIEs = [p_ti_expr_init(raw_ti_expr(none, bte_int), LineNum, S)],
        IsListSyntax = yes
      else
        fail
    ).

Here's part of the trace:

mdb> r
   14111:   5053 35 CALL pred zinc_parser.zm_array_ti_expr_tail/4-0 (semidet) /home/mercury/rafe/g12-goliath/g12/zinc/src/frontend/zinc_parser.m:778 (/home/mercury/rafe/g12-goliath/g12/zinc/src/frontend/zinc_parser.m:694)
mdb>
   14112:   5054 36 CALL pred zinc_lexer.peek_token/3-0 (det) /home/mercury/rafe/g12-goliath/g12/zinc/src/frontend/zinc_lexer.m:262 (/home/mercury/rafe/g12-goliath/g12/zinc/src/frontend/zinc_parser.m:779)
mdb> f
   14114:   5054 36 EXIT pred zinc_lexer.peek_token/3-0 (det) /home/mercury/rafe/g12-goliath/g12/zinc/src/frontend/zinc_lexer.m:262 (/home/mercury/rafe/g12-goliath/g12/zinc/src/frontend/zinc_parser.m:779)
mdb>

*** This THEN event should be a COND event.

   14115:   5053 35 THEN pred zinc_parser.zm_array_ti_expr_tail/4-0 (semidet) c2;?; /home/mercury/rafe/g12-goliath/g12/zinc/src/frontend/zinc_parser.m:780
mdb>
   14116:   5055 36 CALL pred zinc_parser.keyword/4-0 (semidet) /home/mercury/rafe/g12-goliath/g12/zinc/src/frontend/zinc_parser.m:2468 (/home/mercury/rafe/g12-goliath/g12/zinc/src/frontend/zinc_parser.m:780)
mdb> f
   14124:   5055 36 EXIT pred zinc_parser.keyword/4-0 (semidet) /home/mercury/rafe/g12-goliath/g12/zinc/src/frontend/zinc_parser.m:2468 (/home/mercury/rafe/g12-goliath/g12/zinc/src/frontend/zinc_parser.m:780)
mdb>

*** This ELSE event should be a THEN event.

   14125:   5053 35 ELSE pred zinc_parser.zm_array_ti_expr_tail/4-0 (semidet) c2;t; /home/mercury/rafe/g12-goliath/g12/zinc/src/frontend/zinc_parser.m:783
mdb>
   14126:   5058 36 CALL pred zinc_parser.expect/6-0 (det) /home/mercury/rafe/g12-goliath/g12/zinc/src/frontend/zinc_parser.m:2519 (/home/mercury/rafe/g12-goliath/g12/zinc/src/frontend/zinc_parser.m:781)

I suspect a fencepost error in the event printer.

-- Ralph
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at csse.unimelb.edu.au
Administrative Queries: owner-mercury-developers at csse.unimelb.edu.au
Subscriptions:          mercury-developers-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the developers mailing list