mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-25 06:14:18 +00:00
Estimated hours taken: 4 Branches: main Allow subterms to be tracked through partial unifications in the declarative debugger. This involves adding new types of atomic goals to the program representation stored with the executable of programs compiled with `--trace rep'. Remove the ``unsafe'' from the cast goal representation to bring the program representation up to date with Mark's recent change. browser/declarative_execution.m: Read partial unification atomic goals from bytecode. browser/declarative_tree.m: Handle partial unifications when tracking a subterm. compiler/prog_rep.m: If a construction or deconstruction unification is a partial unification then generate a partial construction or deconstruction goal type. Make atomic_goal_info_to_byte_list return the list of variables bound by the atomic goal so we can check if a deconstruction is a partial unification (the LHS will be in the list of bound variables). Wrap the arguments of the RHS of the partial unification in a maybe type, so that we can tell which were input. mdbcomp/program_representation.m: Add a new atomic goal `unify_partial_rep' to represent partial unifications. tests/debugger/declarative/Mmakefile: tests/debugger/declarative/partial.exp: tests/debugger/declarative/partial.inp: tests/debugger/declarative/partial.m: Test tracking of subterms through partial unifications.
37 lines
364 B
Mathematica
37 lines
364 B
Mathematica
:- module partial.
|
|
|
|
:- interface.
|
|
|
|
:- import_module io.
|
|
|
|
:- pred main(io::di, io::uo) is det.
|
|
|
|
:- implementation.
|
|
|
|
main(!IO) :-
|
|
p(X),
|
|
io.write(X, !IO),
|
|
nl(!IO).
|
|
|
|
:- type t
|
|
---> t(
|
|
a :: int,
|
|
b :: int
|
|
).
|
|
|
|
:- pred p(t::out) is det.
|
|
|
|
p(X) :-
|
|
a(A),
|
|
b(B),
|
|
X = t(A, _),
|
|
X = t(_, B).
|
|
|
|
:- pred a(int::out) is det.
|
|
|
|
a(1).
|
|
|
|
:- pred b(int::out) is det.
|
|
|
|
b(2).
|