mirror of
https://github.com/Mercury-Language/mercury.git
synced 2025-12-15 05:44:58 +00:00
Estimated hours taken: 55
This change adds a more sophisticated oracle to the declarative
debugger. The oracle now tries to remember previous answers and uses
them if available, and only asks the user if there is no other
information.
browser/declarative_oracle.m:
- Add the type "oracle_assumption", which identifies an
internal assumption of the oracle.
- Add the type "oracle_answer", which the oracle returns to the
caller. This holds either the truth value, or a reason why
the truth value cannot be given yet.
- Implement a knowledge base to store the previous answers.
This data structure is designed to be able to store arbitrary
assertions, although at this stage only one kind of assertion
is used.
- Where possible, use the KB to answer questions, instead of
asking the user.
- Update comments.
browser/declarative_debugger.m:
- Use the new interface to the oracle. Handle "don't know"
answers in a simple way: either save the question and ask it
later or return without finding any bug.
- Move the debugger_command type to this module.
- Move the UI stuff to a new module.
browser/declarative_user.m:
New module to handle interaction between the debugger/oracle
and the user.
tests/debugger/declarative/Mmakefile:
tests/debugger/declarative/oracle_db.{m,inp,exp}
Add a test case for the new feature.
34 lines
1.1 KiB
Mathematica
34 lines
1.1 KiB
Mathematica
%---------------------------------------------------------------------------%
|
|
% Copyright (C) 1998-1999 The University of Melbourne.
|
|
% This file may only be copied under the terms of the GNU Library General
|
|
% Public License - see the file COPYING.LIB in the Mercury distribution.
|
|
%---------------------------------------------------------------------------%
|
|
|
|
:- module browser_library.
|
|
|
|
:- interface.
|
|
|
|
:- pred browser_library__version(string::out) is det.
|
|
|
|
:- implementation.
|
|
|
|
:- import_module browse, frame, help, parse, util.
|
|
:- import_module debugger_interface.
|
|
:- import_module declarative_debugger, declarative_oracle, declarative_user.
|
|
:- import_module interactive_query, dl, name_mangle.
|
|
|
|
% See library/library.m for why we implement this predicate this way.
|
|
|
|
:- pragma c_code(browser_library__version(Version::out),
|
|
will_not_call_mercury, "
|
|
ConstString version_string =
|
|
MR_VERSION "", configured for "" MR_FULLARCH;
|
|
/*
|
|
** Cast away const needed here, because Mercury declares Version
|
|
** with type String rather than ConstString.
|
|
*/
|
|
Version = (String) (Word) version_string;
|
|
").
|
|
|
|
%---------------------------------------------------------------------------%
|