Tuesday, December 26, 2006

Libraries

Libraries, etc.

Logical types has the following libraries, systems, and sample code. All provided with the usual caveats (they are not guaranteed to work, and Logical Types is not liable for you downloading and using this code):

Libraries
utils

a set of utilities useful for building production systems

contains modules:
Module test status documentation
utils 1/4 submodules testedno
utils.graph 0/1 new preds testedno
utils.random 0/10 preds testedno
utils.series 3/3 preds/funcs testedno
utils.xml 2/3 submodules testedno
utils.xml.facade 1/1 pred testedno
utils.xml.pprint 2/2 preds testedno
utils.xml.transform 4/9 funcs/preds tested no

qcheck2

A testing/verification framework for Mercury programs

see qcheck2 justification (work in progress)

Systems
ltq

Extends Mercury with op/3 declarations, allowing syntax modification

see installation instructions
see ltq doc
see write_canonical that interprets op/3 declarations

samples: hello.m and play.m

Fixes/Patches
anys

A set of fixes to the utilities provided in the Mercury extras distribution supporting operations with the any mode

see anys-diffus.zip simply to apply patches

Alpha: You Have Been Warned!
matrix

Work in progress to add a viable matrix protocol; will be rolled into the utils library.

tiffany

A very small, thread-un-safe, foreign interface to libtiff; also requires matrix (which it already bundles).


Contact Information: dauclair at hotmail.com 703-300-0447
Copyright © 2006-2007, Logical Types, LLC. All rights reserved.

Literature

Literature

We have the works available under the following
topics:

Language Modification
January 3, 2006 Mutable syntax
in Mercury
Testing/Verification
work in progress Testing with qcheck2
Miscellanea
January 16, 2006PADL
symposium post mortem





Rule-Based Logic System


Rule-based

Systems

Rule-based systems process data according
to sets of constraints established by the user. The results of these
systems is a collection of rule findings that can be used to construct
the final product or to assist the user in rendering an informed
decision.



The above description may seem all-too-general, as that describes
the what most programs do. This is indeed correct: rule-based
programming is sufficiently powerful enough to describe any
computable system. In fact, the rule-based approach is now being
viewed by the mainstream as the preferred method for workflow
analysis, process, resource scheduling, service-based systems, etc.
Nearly every software system has a set of rules, explicit or implied,
to which it adheres. The rule-based programming style model these
rule constructs directly and facilitate their manipulation as the
system grows and changes.

Deductive

Logic

The traditional approach to building logic systems
is to construct a set of clauses where the head of the clause matches a
condition and the rest of the clause verifies the match through
a set of goals for that match. These clauses are known as
rules and a set of rules is a predicate, and this predicate can be
used, in turn, as a goal in a new rule. Deductive logic matches
problem specifications very closely and is a very effective way to
convert a set of requirements into a production system. Some examples
of types of problems that are easily modelled in deductive logic are
expert systems, planning systems and scheduling systems.


Deductive systems are used when the rules are clear, when the
user requires certain outcomes, and are very good at "explaining"
what the rule findings are and how they were arrived at.

Inductive

Logic

The opposite approach to a deductive system is an
inductive one. Whereas in an deductive system, the user has very
exacting control over the process and outcome, in an inductive system,
the rules are obtained by deriving the relations between input data and
their outcomes, with very little guidance, if any, from the builder of
the system. Traditional inductive systems required very clean
data and had little tolerance for deviation -- a slight perturbation
in the data set could cause the system to fall into an undefined
state. Modern inductive systems have taken a different approach:
reaping the benefits of recent advances in probability and statistics,
these systems (such as Bayesian systems and neural networks) are
highly redundant and adaptive. These new systems consistently perform
well: they have excellent success narrowing to a classification from
apparently unrelated attributes, and they have a high rate of stability,
being very fault-tolerant, even in the presence of very noisy data.
It is also trivial to convert a statically trained inductive system
to one that learns continuously from new inputs and outcomes.



Inductive systems are used when users cannot explain how they arrive
at decisions (attributing the outcomes to a "feel" for the situation),
and where gradual trends result in eventual changes to outcomes.
These systems excel at making the correct decision with a very high
degree of confidence, but are poor at explaining what prompted the
decision.


Our
Approach

Logical Types, LLC uses both deductive
and inductive logic to build systems as the needs of the customer
demand:




  • To rediscover the implicit rules of a phoneme-based name matching
    system, we created a purely inductive system that output a new
    program that had the phoneme contruction rules explicit.

  • A human resource scheduling system that required a set
    of clearly stated rules that filled duty times with a pool
    of personnel under a guiding principle of "fairness" was built
    using purely deductive logic.

  • A combined learning system and knowledge-engineered rule-based
    expert system was designed using a deductive rule manager with
    a supervised learning, Bayesian-like, component.



Contact Information: dauclair at hotmail dot com 703-300-0447
Copyright © 2006-2007, Logical Types, LLC. All rights reserved.

Tuesday, July 25, 2006

Archived News: 2006-07

2006-07 17:

The various data structures provided in the ROTD
extras/ distribution that handles solver
types (particularly the various any
modes) do not compile because of purity issues;
also, since their release, the coding style has
changed for module qualification. The fixes to
get these types compiled are
here. For the
Mercury team's review are the
diffs to fold
back into the distribution.


Tuesday, May 2, 2006

Archived News: 2006-05

2006-05 13:

We present a complete rewrite of Mercury's

QuickCheck
implementation:
qcheck2 (the sample
unit test module (peano_unit_tests)
requires the peano
module in order to run). The essence of testing
à la qcheck --
type discernment to obtain (random) test values
with a test specification language -- remains
unchanged. The new features of this new version
enhance the system with:




  1. complete control over what is reported and
    when it is reported;

  2. dynamic control over ranges of random
    number-like values (ints,
    floats and chars) as
    well as the random number generator type itself;

  3. and for the code-hacker: qcheck2
    is broken up into separate modules along
    functional lines



The documentation for qcheck (upon
which qcheck2 is built) is a model
for any system to follow; so, documentation, to
include a system description and transition guide,
for qcheck2 is under development.




Update 2006-05-20:

As the test description
(Description) may now be of any
type -- even non-comparable types, such as,
for example, function types -- using a map
with Description keys is will cause
errors when using Description types
that cannot be compared. As such, the
qstate now uses an
assoc_list to accumulate the test
results.






Update 2006-05-21:

Added information to the summary
report: this report now shows which predicates
were not tested. The work-in-progress
documentation
now covers the reporting facility comprehensively.





12:

ltq
(Logical Types Quicksilver compiler) now comes
with qcpt (QuickCheck Predicate
Types), a system that discerns the interface
predicates and functions of a system (to
facilitate comprehensive unit testing). Perhaps
even more important is the inclusion of a README
that doubles as a HOWTO and INSTALL document.


11:

Completed the document describing an implementation
of mutable syntax for Mercury. This article in
available in the literature section (see above).


Thursday, April 6, 2006

Archived News: 2006-04

2006-04 30:

The graph module takes a rather
non-directed approach to locating a path from
Node1 to NodeN. This is
fine if the path has no associated cost, but if
one is looking for the best path (where a path has
an associated cost), this laissez-faire
approach becomes problematic.



As I often need a efficient path in a graph, I
have added best_path/5 and other
supporting predicates that cannot be implemented
well operationally given the protocol of module
graph and submitted these changes to
the Mercury team for review. While they consider
these changes, I provide the implementation here
as module doug_graph, with an
associated example. Locating the best path in the
given example using
the naive path implementation took
over 20 seconds; the reimplementation here
completes the computations in less than a
second.


27:

The following Mercury compiler distributions are
available from here on request:





  • mercury-2006-04-26-rotd-powerpc.apple.darwin8.5


  • mercury-2006-04-26-rotd-sparc.sun.solaris2.8



These distributions include the extras/, the
samples/ (in extras/) and
the HTML documentation (in doc/).

Saturday, March 4, 2006

Archived News: 2006-03

2006-03

29873210165432108:

The Mercury development team has fixed the problem
with nesting of disjunctive terms when output with
term_io.write_term/4 with
ROTD-2006-03-07 compiler distribution. It, along
with the op/3 declaration enhancement
(ltq), are available from us. Send an email (see
contact information below) if you wish
to obtain one of the following distributions:





  • mercury-2006-03-25101854310789-rotd-powerpc.apple.darwin8.35


  • mercury-2006-03-287210185431079-rotd-sparc.sun.solaris2.8



These distributions include the extras/, the
samples/ (in extras/) and
the HTML documentation (in doc/).



0346:

term_io.write_term/4 does not properly handle
disjunctions. I've submitted a patch to the Mercury
development team, but in the interim, I've included the
change in distributions (as dopp relies on
write_term/4 to output the op/3-free
code results). Also, compiler/prog_io.m has
quite a few disjunctions handling (now dead) declaration
types, I've submitted this patch to the Mercury team, but
have also patched local distributions. The most recent
distributions available are:



  • mercury-2006-03-01-rotd-fixed-write_term-sparc.sun.solaris2.8

  • mercury-2006-03-0134-rotd-fixed-write_term-powerpc.apple.darwin8.3


Both these distributions have ltq included.
Email me if you wish a copy of one of the above distributions
or of the stable release (0.12.2) on either architecture.


Update 2006-03-08:
The Mercury team has corrected the compiler so
that terms are appropriately parenthesized. This eliminates
the need for my term_io.write_term/4 hack, so
future releases of the distributions from this site will revert
to straight-up Mercury. Enhancements, such as op/3
declarations, will be included in extras/ (the
source code) and in bin/.



02:

There is quite a debate going on at the developers
discussion forum as to the merits, extent and implementation
of the op/3 declaration. Up to this point,
we have patched the Mercury compiler distribution so that
it accepts and processes op/3 declarations. This
has proved to be rather onerous as new distributions have been
coming out regularly. Instead, prompted by the Mercury team,
I have developed an op/3 preprocessing system.
ltq <Executable> ("Logical Types
Quicksilver")
creates build/Makefile, then executes the Makefile which calls
dopp <Dependencies> ("Dynamic Op
PreProcessor")
which translates op/3-enhanced files into plain
vanilla Mercury ones. The Makefile then builds the executable
with the 'mmc --make --infer-all
<Executable>
' command.
This build system is locally
available from this site
, and also included in Mercury
distributions that we produce from this month onward.



Update 2006-03-10:
I have updated ltq so that it
takes any number of arbitrary command-line arguments
(these preceed the <Executable> argument).
These arguments are passed, unmolested, to mmc.

Update 2006-03-13:

Currently, we are fully integrating
op/3 declarations into working
products. In building auxilary libraries we
have found that we need to mirror
mmc's library-building indicator
(prepending 'lib' to the target module's name).
Adding this functionality required a
modification to ltq's build
process. This change is reflected in build
system offered here. We leave the library
installation process to mmc; that
is, noddingly: in the generated
Makefile, there is an command that passes the
proper arguments to mmc with a
make install command.

Update 2006-03-24:

The library building and installation process
differed slightly in ltq.
Eliminated that difference and published a new
version of this
system
.

Update 2006-03-29:

ltq now automatically creates the
build/ directory (the repository of
build products, including the files converted
from op/3-enhanced sources to
canonically represented sources). This
eliminates errors in ltq's build
process when it cannot find the nonexistent
directory. The new distribution is available,
as always, here.


Sunday, February 26, 2006

Archived News: 2006-02

2006-02



17:The bleeding-edge releases of the Mercury compiler
(the ROTD (release of the day) 2006-02-11),
both for standard Mercury and the Quicksilver
enhancements from Logical Types (op/3
declarations and binary-trees and -sets with
externalizable structure) are compiled and available
for Mac OSX.4 systems. These releases are alpha
quality, but do contain several interesting
developments, such as improved constraint logic
programming syntax, injections (bi-directional maps)
and improved term-as-XML handling. Please email if you
wish to obtain a copy (see contact
information
).
Update 2006-02-19:
The Quicksilver distribution has been updated
to the ROTD-2006-02-1618.

Update 2006-02-268:

There are a new set of distributions
available:



  • ROTD-2006-02-235
    distribution now available for
    sparc.sun.solaris2.8

  • ROTD-2006-02-23 distribution
    for powerpc.apple.darwin8.3

  • Quicksilver ROTD-2006-02-25
    distribution for powerpc.apple.darwin8.3
    and for the sparc.sun.solaris2.8 as well




Thursday, February 2, 2006

[Patch] Implemented op/3 declaration for Mercury compiler

From:doug.dot.auclair.at.logicaltypes.dot.com
To: mercury.dash.developers.at.cs.dot.mu.dot.oz.dot.au
Subject: [Patch] Implemented op/3 declaration for Mercury compiler
Date:Thu, 12 Jan 2006 12:52:28 -0500

Dear all,

This mail was originally sent from my hotmail.com account; apparently
your mail server rejects emails from this server, so I am resending
this message from my logicaltypes.com server.

Sincerely,
Doug Auclair

> Date: Sun, 08 Jan 2006 20:23:21 +0000
>
> Dear all,
>
> I've implemented the op/3 that has LOCAL (within the current module
> only) extent for the Mercury compiler, 0.12.1. [I consider the
> global effect of op/3 in Prolog a disadvantage. As I use op/3
> frequently, I do not wish syntax for one purpose in one module to
> spill over into syntax used for another purpose in another module]
> I've changed the following files to make this change. I've run the
> old compiler and the new compiler through the test suite -- they
> both had the same test results. I've also included in my
> downloading area a couple of programs that use the op/3
> declaration. New compiler archives for Mac and Sun, as well as
> sample programs and installation instructions are available from my
> site, http://www.logicaltypes.com, under the Latest Developments
> section, until such time you are ready to roll these changes into
> your repository.
>
> Although, in theory, this change should make the compiler slower in
> compiling programs, I have not noticed a slowdown on either Sun or
> Mac implementation.
>
> See you at the PADL/POPL.
>
> Sincerely,
> Doug Auclair
>
>
> library/ops.m -----
> D-Auclairs-Computer:~ dauclair$ diff
> /Volumes/2006-01-06/projects/mercury/ops.m
> /Volumes/DOUGSTICK/ops.m.~1.47.2.2.~
> 26,30d25
> <
> < % modified: January 1, 2006, DMA (Douglas M. Auclair) -- Happy New Year!
> < % changed: Added a map implementation for the Mercury syntax to allow for
> < % mutable syntax with an op/3 declaration.
> <
> 154,159d148
> < % ops__category is used to index the op_table so that
> < % lookups are semidet rather than nondet.
> < % Prefix and binary_prefix operators have ops__category `before'.
> < % Infix and postfix operators have ops__category `after'.
> < :- type ops__category ---> before ; after.
> <
> 164,165d152
> < :- import_module string, require.
> <
> 177a165,170
>>
>> % ops__category is used to index the op_table so that
>> % lookups are semidet rather than nondet.
>> % Prefix and binary_prefix operators have ops__category `before'.
>> % Infix and postfix operators have ops__category `after'.
>> :- type ops__category ---> before ; after.
>
> compiler/prog_io_typeclass.m -----
> D-Auclairs-Computer:~ dauclair$ diff
> /Volumes/2006-01-06/projects/mercury/prog_io_typeclass.m
> /Volumes/DOUGSTICK/prog_io_typeclass.m.~1.33.2.1.~
> 46d45
> < :- import_module parse_tree__prog_io_util.
> 51c50
> < :- import_module int, string, std_util, require, set, map, ops.
> ---
>> :- import_module int, string, std_util, require, set, map.
> 201,202d199
> < init_mercury_op_map(init_mercury_op_table,
> < OpMap),
> 204c201
> < Item, OpMap, _),
> ---
>> Item),
> 680,682c677
> < init_mercury_op_map(init_mercury_op_table, OpMap),
> < parse_item(DefaultModuleName, VarSet, MethodTerm, Result0,
> < OpMap, _),
> ---
>> parse_item(DefaultModuleName, VarSet, MethodTerm, Result0),
>
> compiler/prog_io_util.m -----
> D-Auclairs-Computer:~ dauclair$ diff /Volumes/DOUGSTICK/PARSER.M
> /Volumes/DOUGSTICK/parser.m.~1.44.2.2.~
> 158c158
> < FileName, Result, !IO).
> ---
>> FileName, Result, !IO).
> 166,167c166
> < FileName, String, EndPos,
> < Result).
> ---
>> FileName, String, EndPos, Result).
> 190c189
> < FileName, Tokens, Result).
> ---
>> FileName, Tokens, Result).
> D-Auclairs-Computer:~ dauclair$ vi /Volumes/DOUGSTICK/PARSER.M
> D-Auclairs-Computer:~ dauclair$ diff
> /Volumes/2006-01-06/projects/mercury/prog_io_typeclass.m
> /Volumes/DOUGSTICK/prog_io_typeclass.m.~1.33.2.1.~
> 46d45
> < :- import_module parse_tree__prog_io_util.
> 51c50
> < :- import_module int, string, std_util, require, set, map, ops.
> ---
>> :- import_module int, string, std_util, require, set, map.
> 201,202d199
> < init_mercury_op_map(init_mercury_op_table,
> < OpMap),
> 204c201
> < Item, OpMap, _),
> ---
>> Item),
> 680,682c677
> < init_mercury_op_map(init_mercury_op_table, OpMap),
> < parse_item(DefaultModuleName, VarSet, MethodTerm, Result0,
> < OpMap, _),
> ---
>> parse_item(DefaultModuleName, VarSet, MethodTerm, Result0),
> D-Auclairs-Computer:~ dauclair$ diff
> /Volumes/2006-01-06/projects/mercury/prog_io_util.m
> /Volumes/DOUGSTICK/prog_io_util.m.~1.32.2.1.~
> 29,48c29
> < :- import_module list, map, std_util, term, ops.
> <
> <
> %-----------------------------------------------------------------------------%
> < % DMA: mercury_op_map type
> <
> < :- type op_map == map(pair(string, category), op_info).
> < :- type mercury_op_map ---> mercury_op_map(table, op_map).
> < :- instance op_table(mercury_op_map).
> < :- pred init_mercury_op_map(table::in, mercury_op_map::out) is det.
> <
> < % We expose the op info so we may add information as we encounter op/3
> < % directives. This means we must also expose the category type.
> <
> < :- type op_info ---> op_info(specifier, priority).
> <
> < :- func op_specifier_from_string(string) = specifier.
> < :- func op_category_from_specifier(specifier) = category.
> <
> <
> %-----------------------------------------------------------------------------%
> <
> ---
>> :- import_module list, map, std_util, term.
> 168c149
> < :- import_module bool, string, std_util, term, set, require.
> ---
>> :- import_module bool, string, std_util, term, set.
> 595,673d575
> < % DMA mercury_op_map implementation
> <
> < op_specifier_from_string(String) = Specifier :-
> < specifier_from_string(String, Spec) ->
> < Specifier = Spec
> < ;
> < error("Unknown op specifier: " ++ String).
> <
> < :- pred specifier_from_string(string::in, specifier::out) is semidet.
> <
> < specifier_from_string("fx", fx).
> < specifier_from_string("fy", fy).
> < specifier_from_string("xf", xf).
> < specifier_from_string("yf", yf).
> < specifier_from_string("xfx", xfx).
> < specifier_from_string("yfx", yfx).
> < specifier_from_string("xfy", xfy).
> < specifier_from_string("fxx", fxx).
> < specifier_from_string("fyx", fyx).
> < specifier_from_string("fxy", fxy).
> <
> < op_category_from_specifier(fx) = before.
> < op_category_from_specifier(fy) = before.
> < op_category_from_specifier(xf) = after.
> < op_category_from_specifier(yf) = after.
> < op_category_from_specifier(xfx) = after.
> < op_category_from_specifier(yfx) = after.
> < op_category_from_specifier(xfy) = after.
> < op_category_from_specifier(fxx) = before.
> < op_category_from_specifier(fyx) = before.
> < op_category_from_specifier(fxy) = before.
> <
> < init_mercury_op_map(Table, mercury_op_map(Table, map.init)).
> <
> < :- pred lookup_info(op_map::in, pair(string, category)::in,
> < priority::out, class::out) is semidet.
> < lookup_info(Ops, Op - Cat, Priority, Class) :-
> < search(Ops, Op - Cat, op_info(Specifier, Priority)),
> < op_specifier_to_class(Specifier, Class).
> <
> < :- instance op_table(mercury_op_map) where [
> < (lookup_infix_op(mercury_op_map(Table, Ops), Op, Pri, Left, Right) :-
> < lookup_infix_op(Table, Op, P0, L0, R0) ->
> < Pri = P0,
> < Left = L0,
> < Right = R0
> < ;
> < lookup_info(Ops, Op - after, Pri, infix(Left, Right))),
> < (lookup_operator_term(mercury_op_map(Table, _), Pri, Left, Right) :-
> < lookup_operator_term(Table, Pri, Left, Right)),
> < (lookup_prefix_op(mercury_op_map(Table, Ops), Op, Pri, After) :-
> < lookup_prefix_op(Table, Op, P0, A0) ->
> < Pri = P0,
> < After = A0
> < ;
> < lookup_info(Ops, Op - before, Pri, prefix(After))),
> < (lookup_binary_prefix_op(mercury_op_map(Table, Ops), Op, Pri,
> < Left, Right) :-
> < lookup_binary_prefix_op(Table, Op, P0, L0, R0) ->
> < Pri = P0,
> < Left = L0,
> < Right = R0
> < ;
> < lookup_info(Ops, Op - before, Pri, binary_prefix(Left, Right))),
> < (lookup_postfix_op(mercury_op_map(Table, Ops), Op, Pri, Before) :-
> < lookup_postfix_op(Table, Op, P0, B0) ->
> < Pri = P0,
> < Before = B0
> < ;
> < lookup_info(Ops, Op - after, Pri, postfix(Before))),
> < (lookup_op(mercury_op_map(Table, Ops), Op) :-
> < lookup_op(Table, Op)
> < ;
> < search(Ops, Op - before, _)
> < ;
> < search(Ops, Op - after, _)),
> < (max_priority(mercury_op_map(Table, _)) = max_priority(Table)),
> < (arg_priority(mercury_op_map(Table, _)) = arg_priority(Table))
> < ].
>
> compiler/prog_io.m -----
>
> D-Auclairs-Computer:~ dauclair$ diff
> /Volumes/2006-01-06/projects/mercury/prog_io.m
> /Volumes/DOUGSTICK/prog_io.m.~1.234.2.6.~
> 54,56d53
> < % modified: December 29, 2005, DMA (Douglas M. Auclair)
> < % changed: Added the op/3 declaration implementation
> <
> 166,167c163
> < maybe_item_and_context::out,
> < mercury_op_map::in, mercury_op_map::out) is det.
> ---
>> maybe_item_and_context::out) is det.
> 176,177c172
> < maybe_item_and_context::out,
> < mercury_op_map::in, mercury_op_map::out) is det.
> ---
>> maybe_item_and_context::out) is det.
> 288,289d282
> < :- import_module ops. % DMA 2005-12-29
> <
> 616d608
> < init_mercury_op_map(init_mercury_op_table, OpMap),
> 618,619c610
> < ModuleName, RevMessages, _, _, _,
> < OpMap, _, !IO),
> ---
>> ModuleName, RevMessages, _, _, _, !IO),
> 659d649
> < init_mercury_op_map(init_mercury_op_table, Syntax),
> 661,662c651
> < RevMessages0, RevItems0, MaybeSecondTerm, Error0,
> < Syntax, Syn0, !IO),
> ---
>> RevMessages0, RevItems0, MaybeSecondTerm, Error0, !IO),
> 666c655
> < MaybeSecondItem, Syn0, Syn1),
> ---
>> MaybeSecondItem),
> 670c659
> < Error0, Error1, Syn1, !IO)
> ---
>> Error0, Error1, !IO)
> 675c664
> < Error0, Error1, Syn0, !IO)
> ---
>> Error0, Error1, !IO)
> 704,705c693
> < module_error::out, mercury_op_map::in, mercury_op_map::out,
> < io__state::di, io__state::uo) is det.
> ---
>> module_error::out, io__state::di, io__state::uo) is det.
> 708c696
> < Messages, Items, MaybeSecondTerm, Error, !Syntax, !IO) :-
> ---
>> Messages, Items, MaybeSecondTerm, Error, !IO) :-
> 720c708
> < read_term_with_op_table(!.Syntax, SourceFileName,
> MaybeFirstTerm, !IO),
> ---
>> parser__read_term(SourceFileName, MaybeFirstTerm, !IO),
> 722,723c710
> < process_read_term(RootModuleName, MaybeFirstTerm, MaybeFirstItem,
> < !Syntax),
> ---
>> process_read_term(RootModuleName, MaybeFirstTerm, MaybeFirstItem),
> 735c722
> < !Syntax, !IO)
> ---
>> !IO)
> 842,850c829,834
> < message_list::in, message_list::out,
> < item_list::in, item_list::out,
> < module_error::in,module_error::out,
> < mercury_op_map::in,
> < io__state::di, io__state::uo) is det.
> <
> < read_items_loop(ModuleName, SourceFileName, !Msgs, !Items, !Error,
> < Syn0, !IO) :-
> < read_item(ModuleName, SourceFileName, MaybeItem, !IO, Syn0, Syn1),
> ---
>> message_list::in, message_list::out, item_list::in, item_list::out,
>> module_error::in,module_error::out, io__state::di, io__state::uo)
>> is det.
>>
>> read_items_loop(ModuleName, SourceFileName, !Msgs, !Items, !Error, !IO) :-
>> read_item(ModuleName, SourceFileName, MaybeItem, !IO),
> 852c836
> < !Msgs, !Items, !Error, Syn1, !IO).
> ---
>> !Msgs, !Items, !Error, !IO).
> 856,861c840,843
> < :- pred read_items_loop_2(maybe_item_or_eof::in, module_name::in,
> file_name::in,
> < message_list::in, message_list::out,
> < item_list::in, item_list::out,
> < module_error::in, module_error::out,
> < mercury_op_map::in,
> < io__state::di, io__state::uo) is det.
> ---
>> :- pred read_items_loop_2(maybe_item_or_eof::in, module_name::in,
>> file_name::in, message_list::in, message_list::out,
>> item_list::in, item_list::out, module_error::in, module_error::out,
>> io__state::di, io__state::uo) is det.
> 865c847
> < read_items_loop_2(eof, _ModuleName, _SourceFile, !Msgs, !Items,
> !Error, _, !IO).
> ---
>> read_items_loop_2(eof, _ModuleName, _SourceFile, !Msgs, !Items,
>> !Error, !IO).
> 869c851
> < SourceFileName, !Msgs, !Items, _Error0, Error,
> Syntax, !IO) :-
> ---
>> SourceFileName, !Msgs, !Items, _Error0, Error, !IO) :-
> 878c860
> < Error1, Error, Syntax, !IO).
> ---
>> Error1, Error, !IO).
> 881c863
> < _Error0, Error, Syntax, !IO) :-
> ---
>> _Error0, Error, !IO) :-
> 887c869
> < Error1, Error, Syntax, !IO).
> ---
>> Error1, Error, !IO).
> 890c872
> < !Msgs, !Items, !Error, Syntax, !IO) :-
> ---
>> !Msgs, !Items, !Error, !IO) :-
> 964c946
> < Syntax, !IO).
> ---
>> !IO).
> 997,1004c979,983
> < io::di, io::uo,
> < mercury_op_map::in, mercury_op_map::out)
> < is det.
> <
> < read_item(ModuleName, SourceFileName, MaybeItem, !IO, !Syntax) :-
> < parser__read_term_with_op_table(!.Syntax, SourceFileName,
> < MaybeTerm, !IO),
> < process_read_term(ModuleName, MaybeTerm, MaybeItem, !Syntax).
> ---
>> io::di, io::uo) is det.
>>
>> read_item(ModuleName, SourceFileName, MaybeItem, !IO) :-
>> parser__read_term(SourceFileName, MaybeTerm, !IO),
>> process_read_term(ModuleName, MaybeTerm, MaybeItem).
> 1007,1008c986
> < maybe_item_or_eof::out,
> < mercury_op_map::in, mercury_op_map::out) is det.
> ---
>> maybe_item_or_eof::out) is det.
> 1010c988
> < process_read_term(_ModuleName, eof, eof) --> [].
> ---
>> process_read_term(_ModuleName, eof, eof).
> 1012,1013c990,991
> < syntax_error(ErrorMsg, LineNumber)) --> [].
> < process_read_term(ModuleName, term(VarSet, Term), MaybeItemOrEof) -->
> ---
>> syntax_error(ErrorMsg, LineNumber)).
>> process_read_term(ModuleName, term(VarSet, Term), MaybeItemOrEof) :-
> 1015c993
> < { convert_item(MaybeItem, MaybeItemOrEof) }.
> ---
>> convert_item(MaybeItem, MaybeItemOrEof).
> 1023c1001
> < parse_item(ModuleName, VarSet, Term, Result, !Syntax) :-
> ---
>> parse_item(ModuleName, VarSet, Term, Result) :-
> 1028c1006
> < parse_decl(ModuleName, VarSet, Decl, Result, !Syntax)
> ---
>> parse_decl(ModuleName, VarSet, Decl, Result)
> 1034,1035c1012,1013
> < parse_dcg_clause(ModuleName, VarSet,
> < DCG_H, DCG_B, DCG_Context, Result)
> ---
>> parse_dcg_clause(ModuleName, VarSet, DCG_H, DCG_B,
>> DCG_Context, Result)
> 1097c1075
> < error(ErrMessage, Term)) :-
> ---
>> error(ErrMessage, Term)) :-
> 1121c1099
> < parse_decl(ModuleName, VarSet, F, Result) -->
> ---
>> parse_decl(ModuleName, VarSet, F, Result) :-
> 1130,1131c1108
> < maybe_item_and_context::out,
> < mercury_op_map::in, mercury_op_map::out) is det.
> ---
>> maybe_item_and_context::out) is det.
> 1133c1110
> < parse_decl_2(ModuleName, VarSet, F, Attributes, Result, !Syntax) :-
> ---
>> parse_decl_2(ModuleName, VarSet, F, Attributes, Result) :-
> 1142c1119
> < NewAttributes, Result, !Syntax)
> ---
>> NewAttributes, Result)
> 1145c1122
> < Attributes, R, !Syntax)
> ---
>> Attributes, R)
> 1155c1132
> < % process_decl(ModuleName, VarSet, Atom, Args, Attributes, Result)
> ---
>> % process_decl(ModuleName, VarSet, Attributes, Atom, Args, Result)
> 1161,1162c1138
> < decl_attrs::in, maybe1(item)::out,
> < mercury_op_map::in, mercury_op_map::out) is semidet.
> ---
>> decl_attrs::in, maybe1(item)::out) is semidet.
> 1164,1165c1140
> < process_decl(ModuleName, VarSet, "type", [TypeDecl], Attributes, Result,
> < !_Syntax) :-
> ---
>> process_decl(ModuleName, VarSet, "type", [TypeDecl], Attributes, Result) :-
> 1168,1169c1143
> < process_decl(ModuleName, VarSet, "pred", [PredDecl], Attributes, Result,
> < !_Syntax) :-
> ---
>> process_decl(ModuleName, VarSet, "pred", [PredDecl], Attributes, Result) :-
> 1172,1173c1146
> < process_decl(ModuleName, VarSet, "func", [FuncDecl], Attributes, Result,
> < !_Syntax) :-
> ---
>> process_decl(ModuleName, VarSet, "func", [FuncDecl], Attributes, Result) :-
> 1176,1177c1149
> < process_decl(ModuleName, VarSet, "mode", [ModeDecl], Attributes, Result,
> < !_syntax) :-
> ---
>> process_decl(ModuleName, VarSet, "mode", [ModeDecl], Attributes, Result) :-
> 1180,1181c1152
> < process_decl(ModuleName, VarSet, "inst", [InstDecl], Attributes, Result,
> < !_syntax) :-
> ---
>> process_decl(ModuleName, VarSet, "inst", [InstDecl], Attributes, Result) :-
> 1186c1157
> < Result, !_syntax) :-
> ---
>> Result) :-
> 1191c1162
> < Result, !_syntax) :-
> ---
>> Result) :-
> 1196c1167
> < Result, !_syntax) :-
> ---
>> Result) :-
> 1200,1216c1171,1262
> < process_decl(_ModuleName, VarSet, "op", OpSpec, Attributes, Result,
> < Map0, Map1) :-
> < OpSpec = [functor(integer(Priority), _, _),
> < functor(atom(Spec), _, _),
> < OpFunctor] ->
> < Map0 = mercury_op_map(T, M0),
> < Map1 = mercury_op_map(T, Map),
> < OpFunctor = functor(atom(Op), _, _),
> < Specifier = op_specifier_from_string(Spec),
> < det_insert(M0, Op - op_category_from_specifier(Specifier),
> < op_info(Specifier, Priority), Map),
> < parse_symlist_decl(parse_op_specifier, make_op, make_use,
> < OpFunctor, Attributes, VarSet, Result)
> < ;
> < Result = error("Bad op format", functor(atom("op"), OpSpec,
> < context("meh", 42))),
> < Map1 = Map0.
> ---
>> process_decl(_ModuleName, VarSet, "import_sym", [SymSpec], Attributes,
>> Result) :-
>> parse_symlist_decl(parse_symbol_specifier, make_sym, make_import,
>> SymSpec, Attributes, VarSet, Result).
>>
>> process_decl(_ModuleName, VarSet, "use_sym", [SymSpec],
>> Attributes, Result) :-
>> parse_symlist_decl(parse_symbol_specifier, make_sym, make_use,
>> SymSpec, Attributes, VarSet, Result).
>>
>> process_decl(_ModuleName, VarSet, "export_sym", [SymSpec], Attributes,
>> Result) :-
>> parse_symlist_decl(parse_symbol_specifier, make_sym, make_export,
>> SymSpec, Attributes, VarSet, Result).
>>
>> process_decl(_ModuleName, VarSet, "import_pred", [PredSpec], Attributes,
>> Result) :-
>> parse_symlist_decl(parse_predicate_specifier, make_pred, make_import,
>> PredSpec, Attributes, VarSet, Result).
>>
>> process_decl(_ModuleName, VarSet, "use_pred", [PredSpec], Attributes,
>> Result) :-
>> parse_symlist_decl(parse_predicate_specifier, make_pred, make_use,
>> PredSpec, Attributes, VarSet, Result).
>>
>> process_decl(_ModuleName, VarSet, "export_pred", [PredSpec], Attributes,
>> Result) :-
>> parse_symlist_decl(parse_predicate_specifier, make_pred, make_export,
>> PredSpec, Attributes, VarSet, Result).
>>
>> process_decl(_ModuleName, VarSet, "import_func", [FuncSpec], Attributes,
>> Result) :-
>> parse_symlist_decl(parse_function_specifier, make_func, make_import,
>> FuncSpec, Attributes, VarSet, Result).
>>
>> process_decl(_ModuleName, VarSet, "use_func", [FuncSpec], Attributes,
>> Result) :-
>> parse_symlist_decl(parse_function_specifier, make_func, make_use,
>> FuncSpec, Attributes, VarSet, Result).
>>
>> process_decl(_ModuleName, VarSet, "export_func", [FuncSpec], Attributes,
>> Result) :-
>> parse_symlist_decl(parse_function_specifier, make_func, make_export,
>> FuncSpec, Attributes, VarSet, Result).
>>
>> process_decl(_ModuleName, VarSet, "import_cons", [ConsSpec], Attributes,
>> Result) :-
>> parse_symlist_decl(parse_constructor_specifier, make_cons,
>> make_import,
>> ConsSpec, Attributes, VarSet, Result).
>>
>> process_decl(_ModuleName, VarSet, "use_cons", [ConsSpec], Attributes,
>> Result) :-
>> parse_symlist_decl(parse_constructor_specifier, make_cons, make_use,
>> ConsSpec, Attributes, VarSet, Result).
>>
>> process_decl(_ModuleName, VarSet, "export_cons", [ConsSpec], Attributes,
>> Result) :-
>> parse_symlist_decl(parse_constructor_specifier, make_cons,
>> make_export,
>> ConsSpec, Attributes, VarSet, Result).
>>
>> process_decl(_ModuleName, VarSet, "import_type", [TypeSpec], Attributes,
>> Result) :-
>> parse_symlist_decl(parse_type_specifier, make_type, make_import,
>> TypeSpec, Attributes, VarSet, Result).
>>
>> process_decl(_ModuleName, VarSet, "use_type", [TypeSpec], Attributes,
>> Result) :-
>> parse_symlist_decl(parse_type_specifier, make_type, make_use,
>> TypeSpec, Attributes, VarSet, Result).
>>
>> process_decl(_ModuleName, VarSet, "export_type", [TypeSpec], Attributes,
>> Result) :-
>> parse_symlist_decl(parse_type_specifier, make_type, make_export,
>> TypeSpec, Attributes, VarSet, Result).
>>
>> process_decl(_ModuleName, VarSet, "import_adt", [ADT_Spec], Attributes,
>> Result) :-
>> parse_symlist_decl(parse_adt_specifier, make_adt, make_import,
>> ADT_Spec, Attributes, VarSet, Result).
>>
>> process_decl(_ModuleName, VarSet, "use_adt", [ADT_Spec],
>> Attributes, Result) :-
>> parse_symlist_decl(parse_adt_specifier, make_adt, make_use,
>> ADT_Spec, Attributes, VarSet, Result).
>>
>> process_decl(_ModuleName, VarSet, "export_adt", [ADT_Spec], Attributes,
>> Result) :-
>> parse_symlist_decl(parse_adt_specifier, make_adt, make_export,
>> ADT_Spec, Attributes, VarSet, Result).
>>
>> process_decl(_ModuleName, VarSet, "import_op", [OpSpec], Attributes,
>> Result) :-
>> parse_symlist_decl(parse_op_specifier, make_op, make_import,
>> OpSpec, Attributes, VarSet, Result).
> 1218,1219c1264,1272
> < process_decl(_ModuleName, VarSet0, "interface", [], Attributes, Result,
> < !_syntax) :-
> ---
>> process_decl(_ModuleName, VarSet, "use_op", [OpSpec], Attributes, Result) :-
>> parse_symlist_decl(parse_op_specifier, make_op, make_use,
>> OpSpec, Attributes, VarSet, Result).
>>
>> process_decl(_ModuleName, VarSet, "export_op", [OpSpec],
>> Attributes, Result) :-
>> parse_symlist_decl(parse_op_specifier, make_op, make_export,
>> OpSpec, Attributes, VarSet, Result).
>>
>> process_decl(_ModuleName, VarSet0, "interface", [], Attributes, Result) :-
> 1224,1225c1277
> < process_decl(_ModuleName, VarSet0, "implementation", [],
> Attributes, Result,
> < !_syntax) :-
> ---
>> process_decl(_ModuleName, VarSet0, "implementation", [],
>> Attributes, Result) :-
> 1230,1231c1282
> < process_decl(ModuleName, VarSet, "external", Args, Attributes, Result,
> < !_syntax) :-
> ---
>> process_decl(ModuleName, VarSet, "external", Args, Attributes, Result) :-
> 1253c1304
> < Result, !_syntax) :-
> ---
>> Result) :-
> 1256c1307
> < Result0 = ok(ModuleNameSym),
> ---
>> Result0 = ok(ModuleNameSym),
> 1266c1317
> < Attributes, Result, !_syntax) :-
> ---
>> Attributes, Result) :-
> 1280c1331
> < Attributes, Result, !_syntax) :-
> ---
>> Attributes, Result) :-
> 1300,1301c1351
> < process_decl(ModuleName, VarSet, "pragma", Pragma, Attributes, Result,
> < !_sytax):-
> ---
>> process_decl(ModuleName, VarSet, "pragma", Pragma, Attributes, Result):-
> 1305,1306c1355
> < process_decl(ModuleName, VarSet, "promise", Assertion, Attributes, Result,
> < !_syntax):-
> ---
>> process_decl(ModuleName, VarSet, "promise", Assertion, Attributes, Result):-
> 1311c1360
> < Result, !_syntax):-
> ---
>> Result):-
> 1316c1365
> < Result, !_syntax):-
> ---
>> Result):-
> 1318c1367
> < Result).
> ---
>> Result).
> 1321c1370
> < Attributes, Result, !_syntax):-
> ---
>> Attributes, Result):-
> 1323c1372
> < Attributes, Result).
> ---
>> Attributes, Result).
> 1325,1326c1374
> < process_decl(ModuleName, VarSet, "typeclass", Args, Attributes, Result,
> < !_syntax):-
> ---
>> process_decl(ModuleName, VarSet, "typeclass", Args, Attributes, Result):-
> 1330,1331c1378
> < process_decl(ModuleName, VarSet, "instance", Args, Attributes, Result,
> < !_syntax):-
> ---
>> process_decl(ModuleName, VarSet, "instance", Args, Attributes, Result):-
> 1336,1337c1383,1384
> < [VersionNumberTerm, ModuleNameTerm, VersionNumbersTerm],
> < Attributes, Result, !_syntax) :-
> ---
>> [VersionNumberTerm, ModuleNameTerm, VersionNumbersTerm],
>> Attributes, Result) :-
> 1383c1430
> < term::out) is semidet.
> ---
>> term::out) is semidet.
> 3572a3620,3622
>> :- pred make_op(list(op_specifier)::in, sym_list::out) is det.
>> make_op(X, op(X)).
>>
> 3621a3672,3675
>> ; Functor = "op" ->
>> parse_op_specifier(Term, Result0),
>> process_maybe1(make_op_symbol_specifier, Result0,
>> Result)
> 3662a3717,3720
>> :- pred make_op_symbol_specifier(op_specifier::in,
>> sym_specifier::out) is det.
>>
>> make_op_symbol_specifier(OpSpec, op(OpSpec)).
>>
> 3674,3693d3731
> < :- pred make_op(list(op_specifier)::in, sym_list::out) is det.
> < make_op(X, op(X)).
> <
> <
> %-----------------------------------------------------------------------------%
> <
> < % For the moment, an OpSpecifier is just a symbol name specifier.
> < % XXX We should allow specifying the fixity of an operator
> <
> < :- pred parse_op_specifier(term::in, maybe1(op_specifier)::out) is det.
> <
> < parse_op_specifier(Term, Result) :-
> < parse_symbol_name_specifier(Term, R),
> < process_maybe1(make_op_specifier, R, Result).
> <
> < :- pred make_op_specifier(sym_name_specifier::in,
> op_specifier::out) is det.
> <
> < make_op_specifier(X, sym(X)).
> <
> <
> %-----------------------------------------------------------------------------%
> <
> 4144a4183,4197
>>
>> %-----------------------------------------------------------------------------%
>>
>> % For the moment, an OpSpecifier is just a symbol name specifier.
>> % XXX We should allow specifying the fixity of an operator
>>
>> :- pred parse_op_specifier(term::in, maybe1(op_specifier)::out) is det.
>>
>> parse_op_specifier(Term, Result) :-
>> parse_symbol_name_specifier(Term, R),
>> process_maybe1(make_op_specifier, R, Result).
>>
>> :- pred make_op_specifier(sym_name_specifier::in, op_specifier::out) is det.
>>
>> make_op_specifier(X, sym(X)).
>
> compiler/basics.m -----
>
> There's an extra (redundant) import of the string module.

Monday, January 2, 2006

Archived News: 2006-01

2006-01
31:Quicksilver version 0.12.2 for Mac OS-X.4 is available along
with
installation
instructions
.

Update (2006-03-04):


I have removed all distributions from this repository.
Please email me if you wish to obtain a copy of any distribution
mentioned here.
31:Quicksilver version 0.12.2 for Solaris 8 is available along with
installation
instructions
.
31:Logical Types, LLC is no longer producing binary distributions
of Mercury that do not support op/3 declarations.
Quicksilver (Mercury with op/3 support)
is a strict superset of Mercury and what Logical Types
produces.
16:I've posted a review
of the PADL-2006
.
06:Here is a module that prints out a parsed term in its
canonical form
(write_canonical.m;
useful for inspecting terms with op/3 syntax) and
a test module (test_op.m)
that exercises write_canonical. This can be used
with the regular Mercury compiler, but is designed for Quicksilver
compiling modules with embedded op/3 declarations.
04:Mercury compiler enhanced with op/3
declarations for
both PowerPC architecture Mac OS-X.4 systems (with installation
instructions) and Sparc architecture Solaris 8 systems
(with its own installation instructions) available for
download. The compiler executable is named "lqc"
for "Logical Types Quicksilver
Compiler". A supporting document, detailing the
changes to the compiler to permit users to insert
op/3 declarations (followed eventually by the typed
operators in context) into module implementations, will follow in
short order.

Update (2006-01-31):


These distributions (and the ones mentioned below) are
obsolete. Email me for the current
stable release.