Lines Matching refs:chr

44 \index{library!chr.pl|(}
51 %It includes a compiler, which translates \chr\ programs into
59 This library will replace the older {\tt chr} library.
61 This extended implementation is faster than the existing {\tt chr} library,
113 section introduces the basics of the \chr\ language and how it works.
114 The next section describes more of the \chr\ language,
117 a section on how to write good \chr\ programs. Next the debuggers for
127 \item Write a \chr\ program in a file
128 File\verb/.chr/.
130 \item In \eclipse, load the {\tt chr} library with the query
131 \verb/lib(chr)/. It contains both the compiler and runtime system for
134 \item Compile your \verb/chr/ file into a \verb/pl/ file with the query
138 (\verb/[/File\verb/]./). The \chr\ library is automatically loaded
142 You can compile your \verb/chr/ file and load the resulting \verb/pl/ file
143 at once using the query \verb/chr(/File\verb/)./
149 All example files are in the subdirectory {\tt lib/chr} of the
152 The files ({\tt .chr, .pl}, examples)
182 The example handlers can be loaded using \verb+chr(lib(File))+. For
188 [eclipse 1]: lib(chr), chr(lib(domain)).
206 \section{The \chr\ Language}
212 A \chr\ program (file extension {\tt chr}) may also include other declarations,
245 see the section on writing \chr\ programs). A rule can be named with
266 %simplification \chr\ is a logical equivalence between the heads and
267 %the body provided the guard is true. A propagation \chr\ is an
286 the handler file {\tt minmax.chr}. \begin{verbatim} handler minmax.
323 [eclipse]: chr(minmax).
324 minmax.chr compiled traceable 106874 bytes in 3.37 seconds
333 heads it occurs by the \chr\ compiler. Every time a user-defined
335 applicability of its associated \chrs\ by {\em trying} each \chr. To
336 try a \chr, one of its heads is matched against the constraint goal.
337 If a \chr\ has two heads, the constraint store is searched for a
352 \chr\ programs).
354 If the firing \chr\ is a simplification rule, the matched constraint
355 goals are removed and the body of the \chr\ is executed. Similarly
357 the firing \chr\ is a propagation rule the
358 body of the \chr\ is executed and the next rule is tried. It is remembered
416 \section{More on the \chr\ Language}
419 predicates of the \chr\ language.
422 \subsection{Declarations}\index{declarations!\chr}
452 operator declarations are ignored during compilation from {\tt chr} to
453 {\tt pl} files, the \chr\ operator declarations are taken into account
487 ?-/1} {\em behave different from each other} in \chr\ programs.
489 file by the \chr\ compiler, clauses with {\tt ?-} are {\em executed}
496 \subsection{Options}\index{options!chr}
498 The {\tt option} command allows the user to set options in the \chr\
551 account by the \chr\ compiler. The default is {\tt on}.
558 \subsection{\chr\ Built-In Predicates}
560 There are some built-in predicates to compile {\tt chr} files, for
565 \item {\tt chr2pl(}File)\index{chr2pl/1} compiles ``File'' from a {\tt chr} to {\tt pl} file.
567 \item {\tt chr(}File)\index{chr/1} compiles ``File'' from a {\tt chr} to
570 \item \verb/chr_trace/\index{chr\_trace/0} activates the standard debugger and
572 %\item \verb/chr_opium/\index{chr\_opium/0} opens an Opium window for tracing including constraints.
573 \item \verb/chr_notrace/\index{chr\_notrace/0} stops either debugger.
575 \item {\tt chr\_labeling}\index{chr\_labeling/0}
578 chr\_label\_with(}Constraint)\index{chr\_label\_with/1} checks if ``Constraint'' satisfies a
580 \item {\tt chr\_resolve(}Constraint)\index{chr\_resolve/1} uses the \eclipse\
583 \item {\tt chr\_get\_constraint(}Constraint)\index{chr\_get\_constraint/1}
586 \item {\tt chr\_get\_constraint(}Variable,Constraint)\index{chr\_get\_constraint/2} is the same as
587 {\tt chr\_get\_constraint/1} except that the constraint constrains the variable
599 problems cannot be solved completely. {\em Labeling}\index{labeling!CHR@\chr}
609 The \chr\ run-time system provides {\em built-in labeling}\index{labeling!CHR@\chr!built-in} for
626 The built-in labeling is invoked by calling the \chr\ built-in predicate
627 {\tt chr\_labeling/0} (no arguments). Once called, whenever no more
673 for \chr\ built-in predicates to inspect and manipulate the constraint
677 The predicate {\tt chr\_labeling/0} can be defined as: \begin{verbatim}
690 \section{Writing Good \chr\ Programs}
723 The rules for a constraint can be scattered across the {\tt chr} file
726 the \chr\ compiler. Due to optimizations this order is not necessarily
741 inequality constraints (see handler {\tt domain.chr}). However, the
755 set.chr}, the propagation rule:
824 or if a user-defined constraint is rewritten by a \chr\ into a stronger
831 example, see the constraint handler bool {\tt bool.chr}.
835 \section{Debugging \chr\ Programs}
847 must have been \verb/on/ (default) during compilation (\verb/chr/ to
892 with its name as given in the {\tt chr} source using the \verb/@/
896 \section{The Extended \chr\ Implementation}
899 A new, extended, {\tt chr} library has been developed, with the intention of providing
901 implementation. At the same time, some of the syntax of the \chr\ has
905 debugging {\chr\ } code. Please report any problems encountered while
908 The main user visible differences from the original {\tt chr} library are as
915 \item \chr\ code is no longer compiled with a special command -- the normal
916 compile command will now recognise and compile \chr\ code when the extended
917 {\tt chr} library is loaded. No intermediate Prolog file is produced. The
918 {\tt .chr} extension is no longer supported implicitly.
925 \item The compiler does not try to reorder the {\chr\ } any more. Instead,
930 \item The {\chr\ } are run at the same priority before and after
931 suspensions. Priorities can be specified for {\chr\ } constraints.
932 \item There is no special support for debugging yet. The \chr\ code would be
941 {\chr\ } code, as \verb':- lib(ech).', as long as this occurs before the CHR
947 the {\tt .chr} extension is no longer implicitly supported. Files with
948 the {\tt .chr} extension can still be compiled by explicitly specifying
949 the extension in the compile command, as in {\tt ['file.chr']}. Associated
950 with this change, there are some changes to the declarations of the {\tt .chr}
979 After loading the extended {\tt chr} library, programs containing \chr\ code can
980 be compiled directly. Thus, \chr\ code can be freely mixed with normal Prolog
982 different files in different modules which may all contain \chr\ codes. This
983 was a problem with the old library because \chr\ code had to be compile
986 In the extended library, \chr\ code can occur anywhere in a particular module, and
987 for each module, all the \chr\ code (which may reside in different files)
990 same constraint store. \chr\ code in different modules are entirely
993 In order to allow \chr\ code to occur anywhere inside a module, and also
995 compilation of \chr\ code is always incremental when a new file for a
996 module is compiled, i.e. any existing \chr\
1003 It is possible to clear out old \chr\ code in all modules when compiling a
1005 with the {\tt chr/1} predicate. This first remove any existing \chr\ code in
1007 of {\tt chr/1} of the old library, but no Prolog file is generated. It is
1015 In the old {\tt chr} library, it was not clearly defined when a constraint
1018 In the extended {\tt chr} library, all head constraints
1030 example in the old {\tt chr} directory ({\tt domain.chr}), there is the following rule:
1039 \chr, and can lead to looping under certain circumstances. The two {\tt
1042 \verb+X::[1..2]+), then in the old \chr\ execution, the body goal, the constraint
1045 the new constraint is imposed. With the extended \chr, the old constraint
1092 unlike the old \chr, where for propagation rules, the body is not executed
1133 This behaviour is different from the old {\tt chr} library, and from older
1149 the old {\tt chr} library are supported. Note that the extended compiler can
1171 The old {\chr\ } built-ins, \verb'chr_get_constraint/1' and
1196 A source to source transformation is performed on \chr\ code by the compiler,
1197 and the resulting code is compiled in the same module as the \chr\ code. These
1202 \index{library!chr.pl|)}