mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-26 06:44:24 +00:00
Estimated hours taken: 1 Branches: main Add the command 'pd' to the declarative debugger. This command returns to the procedural debugger at the event corresponding to the current question; it is notionally the inverse of the 'dd' command in the procedural debugger. browser/declarative_user.m: Handle the new command, and add a new alternative to the user_response type. browser/declarative_oracle.m: Handle the new user response, and add a new alternative to the oracle_response type. browser/declarative_debugger.m: Handle the new oracle response, and add a new alternative to the diagnoser_response type. Export some procedures to C so that the back end can interpret the new diagnoser response. Update an old comment. trace/mercury_trace_declarative.c: Handle the new diagnoser response. Rename the function MR_decl_handle_bug_found, since it now also handles the case where a symptom has been found. Interpret the diagnoser response using something like a switch, rather than something like an if-then-else. This gives better error messages if the diagnoser response type is changed. doc/user_guide.texi: Document the new command. tests/debugger/declarative/Mmakefile: tests/debugger/declarative/pd.exp: tests/debugger/declarative/pd.inp: tests/debugger/declarative/pd.m: Test the new feature.
21 lines
373 B
Mathematica
21 lines
373 B
Mathematica
:- module pd.
|
|
:- interface.
|
|
:- import_module io.
|
|
:- pred main(io__state::di, io__state::uo) is det.
|
|
:- implementation.
|
|
:- import_module list.
|
|
|
|
main -->
|
|
io__write(rev([1, 2, 3])),
|
|
io__nl.
|
|
|
|
:- func rev(list(int)) = list(int).
|
|
|
|
rev(As) = rev_2(As, []).
|
|
|
|
:- func rev_2(list(int), list(int)) = list(int).
|
|
|
|
rev_2([], _) = []. % oops
|
|
rev_2([A | As], Bs) = rev_2(As, [A | Bs]).
|
|
|