Merge 192.168.1.79:github/yap-6.3
This commit is contained in:
@@ -38,7 +38,7 @@ PROJECT_NAME = "YAP"
|
||||
# could be handy for archiving the generated documentation or if some version
|
||||
# control system is used.
|
||||
|
||||
PROJECT_NUMBER = 6.3.4
|
||||
PROJECT_NUMBER = 6.3.5
|
||||
|
||||
# Using the PROJECT_BRIEF tag one can provide an optional one line description
|
||||
# for a project that appears at the top of each page and should give viewer a
|
||||
@@ -51,14 +51,14 @@ PROJECT_BRIEF = "The YAP Prolog Compiler Manual"
|
||||
# pixels and the maximum width should not exceed 200 pixels. Doxygen will copy
|
||||
# the logo to the output directory.
|
||||
|
||||
PROJECT_LOGO = /Users/vsc/git/yap-6.3/docs/icons/yap_96x96x32.png
|
||||
PROJECT_LOGO = /home/vsc/github/yap-6.3/docs/icons/yap_96x96x32.png
|
||||
|
||||
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path
|
||||
# into which the generated documentation will be written. If a relative path is
|
||||
# entered, it will be relative to the location where doxygen was started. If
|
||||
# left blank the current directory will be used.
|
||||
|
||||
OUTPUT_DIRECTORY = /Users/vsc/git/yap-6.3/Docs
|
||||
OUTPUT_DIRECTORY = /home/vsc/github/yap-6.3/docs
|
||||
|
||||
# If the CREATE_SUBDIRS tag is set to YES then doxygen will create 4096 sub-
|
||||
# directories (in 2 levels) under the output directory of each output format and
|
||||
@@ -152,8 +152,8 @@ FULL_PATH_NAMES = YES
|
||||
# will be relative from the directory where doxygen is started.
|
||||
# This tag requires that the tag FULL_PATH_NAMES is set to YES.
|
||||
|
||||
STRIP_FROM_PATH = /Users/vsc/git/yap-6.3 \
|
||||
/Users/vsc/git/yap-6.3
|
||||
STRIP_FROM_PATH = /home/vsc/github/yap-6.3 \
|
||||
/home/vsc/github/yap-6.3
|
||||
|
||||
# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the
|
||||
# path mentioned in the documentation of a class, which tells the reader which
|
||||
@@ -378,13 +378,13 @@ SUBGROUPING = YES
|
||||
# SEPARATE_MEMBER_PAGES.
|
||||
# The default value is: NO.
|
||||
|
||||
INLINE_GROUPED_CLASSES = NO
|
||||
INLINE_GROUPED_CLASSES = YES
|
||||
|
||||
# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and unions
|
||||
# with only public data fields or simple typedef fields will be shown inline in
|
||||
# the documentation of the scope in which they are defined (i.e. file,
|
||||
# namespace, or group documentation), provided this scope is documented. If set
|
||||
v# to NO, structs, classes, and unions are shown on a separate page (for HTML and
|
||||
# to NO, structs, classes, and unions are shown on a separate page (for HTML and
|
||||
# Man pages) or section (for LaTeX and RTF).
|
||||
# The default value is: NO.
|
||||
|
||||
@@ -522,14 +522,14 @@ CASE_SENSE_NAMES = NO
|
||||
# scope will be hidden.
|
||||
# The default value is: NO.
|
||||
|
||||
HIDE_SCOPE_NAMES = NO
|
||||
HIDE_SCOPE_NAMES = YES
|
||||
|
||||
# If the HIDE_COMPOUND_REFERENCE tag is set to NO (default) then doxygen will
|
||||
# append additional text to a page's title, such as Class Reference. If set to
|
||||
# YES the compound reference will be hidden.
|
||||
# The default value is: NO.
|
||||
|
||||
HIDE_COMPOUND_REFERENCE= NO
|
||||
HIDE_COMPOUND_REFERENCE= YES
|
||||
|
||||
# If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of
|
||||
# the files that are included by a file in the documentation of that file.
|
||||
@@ -775,20 +775,7 @@ WARN_LOGFILE =
|
||||
# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING
|
||||
# Note: If this tag is empty the current directory is searched.
|
||||
|
||||
INPUT = /Users/vsc/git/yap-6.3/pl \
|
||||
/Users/vsc/git/yap-6.3/CXX \
|
||||
/Users/vsc/git/yap-6.3/OPTYap \
|
||||
/Users/vsc/git/yap-6.3/C \
|
||||
/Users/vsc/git/yap-6.3/H \
|
||||
/Users/vsc/git/yap-6.3/include \
|
||||
/Users/vsc/git/yap-6.3/os \
|
||||
/Users/vsc/git/yap-6.3/library \
|
||||
/Users/vsc/git/yap-6.3/packages \
|
||||
/Users/vsc/git/yap-6.3/swi/library
|
||||
|
||||
#\
|
||||
# /Users/vsc/git/yap-6.3/docs/md \
|
||||
# /Users/vsc/git/yap-6.3/INSTALL.md \
|
||||
INPUT = /home/vsc/github/yap-6.3/INSTALL.md /home/vsc/github/yap-6.3/pl /home/vsc/github/yap-6.3/CXX /home/vsc/github/yap-6.3/OPTYap /home/vsc/github/yap-6.3/C /home/vsc/github/yap-6.3/H /home/vsc/github/yap-6.3/include /home/vsc/github/yap-6.3/os /home/vsc/github/yap-6.3/library /home/vsc/github/yap-6.3/swi/library /home/vsc/github/yap-6.3/docs/md
|
||||
|
||||
|
||||
# This tag can be used to specify the character encoding of the source files
|
||||
@@ -829,7 +816,7 @@ RECURSIVE = YES
|
||||
# Note that relative paths are relative to the directory from which doxygen is
|
||||
# run.
|
||||
|
||||
EXCLUDE = *pltotex.pl
|
||||
EXCLUDE = /home/vsc/github/yap-6.3/packages/jpl /home/vsc/github/yap-6.3/packages/swig /home/vsc/github/yap-6.3/packages/myddas/sqlite3/src /home/vsc/github/yap-6.3/packages/gecode/4.4.0 /home/vsc/github/yap-6.3/packages/gecode/4.2.1 /home/vsc/github/yap-6.3/packages/gecode/4.2.0 /home/vsc/github/yap-6.3/packages/gecode/4.0.0 /home/vsc/github/yap-6.3/packages/gecode/3.7.3 /home/vsc/github/yap-6.3/packages/gecode/3.7.2 /home/vsc/github/yap-6.3/packages/gecode/3.7.1 /home/vsc/github/yap-6.3/packages/gecode/3.7.0 /home/vsc/github/yap-6.3/packages/gecode/3.6.0 /home/vsc/github/yap-6.3/packages/gecode/dev /home/vsc/github/yap-6.3/C/traced_absmi_insts.h /home/vsc/github/yap-6.3/H/locals.h /home/vsc/github/yap-6.3/H/globals.h /home/vsc/github/yap-6.3/packages/cplint /home/vsc/github/yap-6.3/packages/CLPBN/examples /home/vsc/github/yap-6.3/packages/CLPBN/horus /home/vsc/github/yap-6.3/packages/prosqlite /home/vsc/github/yap-6.3/packages/pyswip /home/vsc/github/yap-6.3/packages/yap-lbfgs/liblbfgs-1.10 /home/vsc/github/yap-6.3/library/dialect/swi/os /home/vsc/github/yap-6.3/packages/gecode/gecode3_yap.cc /home/vsc/github/yap-6.3/packages/gecode/gecode4_yap.cc /home/vsc/github/yap-6.3/packages/gecode/gecode3.yap /home/vsc/github/yap-6.3/packages/gecode/gecode4.yap /home/vsc/github/yap-6.3/packages/gecode/gecode3_yap_hand_written.yap /home/vsc/github/yap-6.3/packages/gecode/gecode4_yap_hand_written.yap */CMakeFiles/* *~ */
|
||||
|
||||
# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or
|
||||
# directories that are symbolic links (a Unix file system feature) are excluded
|
||||
@@ -845,7 +832,13 @@ EXCLUDE_SYMLINKS = NO
|
||||
# Note that the wildcards are matched against the file with absolute path, so to
|
||||
# exclude all test directories for example use the pattern */test/*
|
||||
|
||||
EXCLUDE_PATTERNS = */CMakeFiles/* *~
|
||||
EXCLUDE_PATTERNS = \
|
||||
/home/vsc/github/yap-6.3/packages/gecode/gecode3_yap.cc \
|
||||
/home/vsc/github/yap-6.3/packages/gecode/gecode4_yap.cc \
|
||||
/home/vsc/github/yap-6.3/packages/gecode/gecode3.yap \
|
||||
/home/vsc/github/yap-6.3/packages/gecode/gecode4.yap \
|
||||
/home/vsc/github/yap-6.3/packages/gecode/gecode3_yap_hand_written.yap \ /home/vsc/github/yap-6.3/packages/gecode/gecode4_yap_hand_written.yap
|
||||
*/CMakeFiles/* *~ */\#* \
|
||||
|
||||
# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
|
||||
# (namespaces, classes, functions, etc.) that should be excluded from the
|
||||
@@ -882,7 +875,7 @@ EXAMPLE_RECURSIVE = NO
|
||||
# that contain images that are to be included in the documentation (see the
|
||||
# \image command).
|
||||
|
||||
IMAGE_PATH = /Users/vsc/git/yap-6.3/docs/icons
|
||||
IMAGE_PATH = /home/vsc/github/yap-6.3/docs/icons
|
||||
|
||||
# The INPUT_FILTER tag can be used to specify a program that doxygen should
|
||||
# invoke to filter for each input file. Doxygen will invoke the filter program
|
||||
@@ -938,7 +931,7 @@ FILTER_SOURCE_PATTERNS =
|
||||
# (index.html). This can be useful if you have a project on for instance GitHub
|
||||
# and want to reuse the introduction page also for the doxygen output.
|
||||
|
||||
USE_MDFILE_AS_MAINPAGE =
|
||||
USE_MDFILE_AS_MAINPAGE =
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to source browsing
|
||||
@@ -1094,9 +1087,7 @@ HTML_FILE_EXTENSION = .html
|
||||
# of the possible markers and block names see the documentation.
|
||||
# This tag requires that the tag GENERATE_HTML is set to YES.
|
||||
|
||||
HTML_HEADER =
|
||||
|
||||
#/Users/vsc/git/yap-6.3/docs/web/bootstrap/header.html
|
||||
HTML_HEADER = /home/vsc/github/yap-6.3/docs/custom/header.html
|
||||
|
||||
# The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each
|
||||
# generated HTML page. If the tag is left blank doxygen will generate a standard
|
||||
@@ -1106,9 +1097,7 @@ HTML_HEADER =
|
||||
# that doxygen normally uses.
|
||||
# This tag requires that the tag GENERATE_HTML is set to YES.
|
||||
|
||||
HTML_FOOTER =
|
||||
|
||||
#/Users/vsc/git/yap-6.3/docs/web/bootstrap/footer.html
|
||||
HTML_FOOTER = /home/vsc/github/yap-6.3/docs/custom/footer.html
|
||||
|
||||
# The HTML_STYLESHEET tag can be used to specify a user-defined cascading style
|
||||
# sheet that is used by each HTML page. It can be used to fine-tune the look of
|
||||
@@ -1122,8 +1111,6 @@ HTML_FOOTER =
|
||||
|
||||
HTML_STYLESHEET =
|
||||
|
||||
#/Users/vsc/git/yap-6.3/docs/web/bootstrap/customdoxygen.css
|
||||
|
||||
# The HTML_EXTRA_STYLESHEET tag can be used to specify additional user-defined
|
||||
# cascading style sheets that are included after the standard style sheets
|
||||
# created by doxygen. Using this option one can overrule certain style aspects.
|
||||
@@ -1135,9 +1122,9 @@ HTML_STYLESHEET =
|
||||
# list). For an example see the documentation.
|
||||
# This tag requires that the tag GENERATE_HTML is set to YES.
|
||||
|
||||
HTML_EXTRA_STYLESHEET =
|
||||
|
||||
# /Users/vsc/git/yap-6.3/docs/solarized-light.css
|
||||
HTML_EXTRA_STYLESHEET = \
|
||||
/home/vsc/github/yap-6.3/docs/custom/customdoxygen.css \
|
||||
/home/vsc/github/yap-6.3/docs/custom/solarized-light.css \
|
||||
|
||||
# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or
|
||||
# other source files which should be copied to the HTML output directory. Note
|
||||
@@ -1147,9 +1134,7 @@ HTML_EXTRA_STYLESHEET =
|
||||
# files will be copied as-is; there are no commands or markers available.
|
||||
# This tag requires that the tag GENERATE_HTML is set to YES.
|
||||
|
||||
HTML_EXTRA_FILES =
|
||||
|
||||
#/Users/vsc/git/yap-6.3/docs/web/bootstrap/doxy-boot.js
|
||||
HTML_EXTRA_FILES = /home/vsc/github/yap-6.3/docs/custom/application.js /home/vsc/github/yap-6.3/docs/custom/assets /home/vsc/github/yap-6.3/docs/custom/bootstrap.min.css /home/vsc/github/yap-6.3/docs/custom/bootstrap.min.js /home/vsc/github/yap-6.3/docs/custom/customdoxygen.css /home/vsc/github/yap-6.3/docs/custom/default /home/vsc/github/yap-6.3/docs/custom/doxy-boot.js /home/vsc/github/yap-6.3/docs/custom/font-awesome.min.css /home/vsc/github/yap-6.3/docs/custom/footer.html /home/vsc/github/yap-6.3/docs/custom/header.html /home/vsc/github/yap-6.3/docs/custom/jquery-3.2.1.min.js /home/vsc/github/yap-6.3/docs/custom/offcanvas.css /home/vsc/github/yap-6.3/docs/custom/offcanvas.js /home/vsc/github/yap-6.3/docs/custom/solarized-light.css /home/vsc/github/yap-6.3/docs/custom/theme.css /home/vsc/github/yap-6.3/docs/custom/yap.css
|
||||
|
||||
# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen
|
||||
# will adjust the colors in the style sheet and background images according to
|
||||
@@ -1314,7 +1299,7 @@ BINARY_TOC = NO
|
||||
# The default value is: NO.
|
||||
# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
|
||||
|
||||
TOC_EXPAND = NO
|
||||
TOC_EXPAND = YES
|
||||
|
||||
# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and
|
||||
# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated that
|
||||
@@ -1551,7 +1536,7 @@ SEARCHENGINE = YES
|
||||
# The default value is: NO.
|
||||
# This tag requires that the tag SEARCHENGINE is set to YES.
|
||||
|
||||
SERVER_BASED_SEARCH = NO
|
||||
SERVER_BASED_SEARCH = YES
|
||||
|
||||
# When EXTERNAL_SEARCH tag is enabled doxygen will no longer generate the PHP
|
||||
# script for searching. Instead the search results are written to an XML file
|
||||
@@ -1594,7 +1579,7 @@ SEARCHDATA_FILE = searchdata.xml
|
||||
# projects and redirect the results back to the right project.
|
||||
# This tag requires that the tag SEARCHENGINE is set to YES.
|
||||
|
||||
EXTERNAL_SEARCH_ID =
|
||||
EXTERNAL_SEARCH_ID = YAP
|
||||
|
||||
# The EXTRA_SEARCH_MAPPINGS tag can be used to enable searching through doxygen
|
||||
# projects other than the one defined by this configuration file, but that are
|
||||
@@ -1883,7 +1868,7 @@ MAN_SUBDIR =
|
||||
# The default value is: NO.
|
||||
# This tag requires that the tag GENERATE_MAN is set to YES.
|
||||
|
||||
MAN_LINKS = NO
|
||||
MAN_LINKS = NOoi9 0
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the XML output
|
||||
@@ -2028,7 +2013,12 @@ SEARCH_INCLUDES = YES
|
||||
# preprocessor.
|
||||
# This tag requires that the tag SEARCH_INCLUDES is set to YES.
|
||||
|
||||
INCLUDE_PATH =
|
||||
INCLUDE_PATH = /home/vsc/github/yap-6.3 \
|
||||
/home/vsc/github/yap-6.3/H \
|
||||
/home/vsc/github/yap-6.3/H/generated \
|
||||
/home/vsc/github/yap-6.3/include \
|
||||
/home/vsc/github/yap-6.3/os \
|
||||
/home/vsc/github/yap-6.3/OPTYap \
|
||||
|
||||
# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
|
||||
# patterns (like *.h and *.hpp) to filter out the header-files in the
|
||||
@@ -2203,7 +2193,7 @@ DOT_FONTPATH =
|
||||
# The default value is: YES.
|
||||
# This tag requires that the tag HAVE_DOT is set to YES.
|
||||
|
||||
CLASS_GRAPH = YES
|
||||
CLASS_GRAPH = NO
|
||||
|
||||
# If the COLLABORATION_GRAPH tag is set to YES then doxygen will generate a
|
||||
# graph for each documented class showing the direct and indirect implementation
|
||||
@@ -2257,7 +2247,7 @@ TEMPLATE_RELATIONS = NO
|
||||
# The default value is: YES.
|
||||
# This tag requires that the tag HAVE_DOT is set to YES.
|
||||
|
||||
INCLUDE_GRAPH = YES
|
||||
INCLUDE_GRAPH = NO
|
||||
|
||||
# If the INCLUDED_BY_GRAPH, ENABLE_PREPROCESSING and SEARCH_INCLUDES tags are
|
||||
# set to YES then doxygen will generate a graph for each documented file showing
|
||||
@@ -2266,7 +2256,7 @@ INCLUDE_GRAPH = YES
|
||||
# The default value is: YES.
|
||||
# This tag requires that the tag HAVE_DOT is set to YES.
|
||||
|
||||
INCLUDED_BY_GRAPH = YES
|
||||
INCLUDED_BY_GRAPH = NO
|
||||
|
||||
# If the CALL_GRAPH tag is set to YES then doxygen will generate a call
|
||||
# dependency graph for every global function or class method.
|
||||
|
4
docs/application.js
Normal file
4
docs/application.js
Normal file
@@ -0,0 +1,4 @@
|
||||
|
||||
$(function () {
|
||||
$('a').tooltip();
|
||||
});
|
7
docs/bootstrap.min.css
vendored
Normal file
7
docs/bootstrap.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
7
docs/bootstrap.min.js
vendored
Normal file
7
docs/bootstrap.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
121
docs/doxy-boot.js
Normal file
121
docs/doxy-boot.js
Normal file
@@ -0,0 +1,121 @@
|
||||
$( document ).ready(function() {
|
||||
|
||||
$("div.headertitle").addClass("page-header");
|
||||
$("div.title").addClass("h1");
|
||||
|
||||
$('li > a[href="index.html"] > span').before("<i class='fa fa-cog'></i> ");
|
||||
$('li > a[href="index.html"] > span').text("BioGears");
|
||||
$('li > a[href="modules.html"] > span').before("<i class='fa fa-square'></i> ");
|
||||
$('li > a[href="namespaces.html"] > span').before("<i class='fa fa-bars'></i> ");
|
||||
$('li > a[href="annotated.html"] > span').before("<i class='fa fa-list-ul'></i> ");
|
||||
$('li > a[href="classes.html"] > span').before("<i class='fa fa-book'></i> ");
|
||||
$('li > a[href="inherits.html"] > span').before("<i class='fa fa-sitemap'></i> ");
|
||||
$('li > a[href="functions.html"] > span').before("<i class='fa fa-list'></i> ");
|
||||
$('li > a[href="functions_func.html"] > span').before("<i class='fa fa-list'></i> ");
|
||||
$('li > a[href="functions_vars.html"] > span').before("<i class='fa fa-list'></i> ");
|
||||
$('li > a[href="functions_enum.html"] > span').before("<i class='fa fa-list'></i> ");
|
||||
$('li > a[href="functions_YapEval.html"] > span').before("<i class='fa fa-list'></i> ");
|
||||
$('img[src="ftv2ns.png"]').replaceWith('<span class="label label-danger">N</span> ');
|
||||
$('img[src="ftv2cl.png"]').replaceWith('<span class="label label-danger">C</span> ');
|
||||
|
||||
$("ul.tablist").addClass("nav nav-pills nav-justified");
|
||||
$("ul.tablist").css("margin-top", "0.5em");
|
||||
$("ul.tablist").css("margin-bottom", "0.5em");
|
||||
$("li.current").addClass("active");
|
||||
$("iframe").attr("scrolling", "yes");
|
||||
|
||||
$("#nav-path > ul").addClass("breadcrumb");
|
||||
|
||||
$("table.params").addClass("table");
|
||||
$("div.ingroups").wrapInner("<small></small>");
|
||||
$("div.levels").css("margin", "0.5em");
|
||||
$("div.levels > span").addClass("btn btn-default btn-xs");
|
||||
$("div.levels > span").css("margin-right", "0.25em");
|
||||
|
||||
$("table.directory").addClass("table table-striped");
|
||||
$("div.summary > a").addClass("btn btn-default btn-xs");
|
||||
$("table.fieldtable").addClass("table");
|
||||
$(".fragment").addClass("well");
|
||||
$(".memitem").addClass("panel panel-default");
|
||||
$(".memproto").addClass("panel-heading");
|
||||
$(".memdoc").addClass("panel-body");
|
||||
$("span.mlabel").addClass("label label-info");
|
||||
|
||||
$("table.memberdecls").addClass("table");
|
||||
$("[class^=memitem]").addClass("active");
|
||||
|
||||
$("div.ah").addClass("btn btn-default");
|
||||
$("span.mlabels").addClass("pull-right");
|
||||
$("table.mlabels").css("width", "100%")
|
||||
$("td.mlabels-right").addClass("pull-right");
|
||||
|
||||
$("div.ttc").addClass("panel panel-primary");
|
||||
$("div.ttname").addClass("panel-heading");
|
||||
$("div.ttname a").css("color", 'white');
|
||||
$("div.ttdef,div.ttdoc,div.ttdeci").addClass("panel-body");
|
||||
|
||||
$('#MSearchBox').parent().remove();
|
||||
|
||||
$('div.fragment.well div.line:first').css('margin-top', '15px');
|
||||
$('div.fragment.well div.line:last').css('margin-bottom', '15px');
|
||||
|
||||
$('table.doxtable').removeClass('doxtable').addClass('table table-striped table-bordered').each(function(){
|
||||
$(this).prepend('<thead></thead>');
|
||||
$(this).find('tbody > tr:first').prependTo($(this).find('thead'));
|
||||
|
||||
$(this).find('td > span.success').parent().addClass('success');
|
||||
$(this).find('td > span.warning').parent().addClass('warning');
|
||||
$(this).find('td > span.danger').parent().addClass('danger');
|
||||
});
|
||||
|
||||
|
||||
|
||||
if($('div.fragment.well div.ttc').length > 0)
|
||||
{
|
||||
$('div.fragment.well div.line:first').parent().removeClass('fragment well');
|
||||
}
|
||||
|
||||
$('table.memberdecls').find('.memItemRight').each(function(){
|
||||
$(this).contents().appendTo($(this).siblings('.memItemLeft'));
|
||||
$(this).siblings('.memItemLeft').attr('align', 'left');
|
||||
});
|
||||
|
||||
function getOriginalWidthOfImg(img_element) {
|
||||
var t = new Image();
|
||||
t.src = (img_element.getAttribute ? img_element.getAttribute("src") : false) || img_element.src;
|
||||
return t.width;
|
||||
}
|
||||
|
||||
$('div.dyncontent').find('img').each(function(){
|
||||
if(getOriginalWidthOfImg($(this)[0]) > $('#content>div.container').width())
|
||||
$(this).css('width', '100%');
|
||||
});
|
||||
|
||||
$(".memitem").removeClass('memitem');
|
||||
$(".memproto").removeClass('memproto');
|
||||
$(".memdoc").removeClass('memdoc');
|
||||
$("span.mlabel").removeClass('mlabel');
|
||||
$("table.memberdecls").removeClass('memberdecls');
|
||||
$("[class^=memitem]").removeClass('memitem');
|
||||
$("span.mlabels").removeClass('mlabels');
|
||||
$("table.mlabels").removeClass('mlabels');
|
||||
$("td.mlabels-right").removeClass('mlabels-right');
|
||||
$(".navpath").removeClass('navpath');
|
||||
$("li.navelem").removeClass('navelem');
|
||||
$("a.el").removeClass('el');
|
||||
$("div.ah").removeClass('ah');
|
||||
$("div.header").removeClass("header");
|
||||
|
||||
$('.mdescLeft').each(function(){
|
||||
if($(this).html()==" ") {
|
||||
$(this).siblings('.mdescRight').attr('colspan', 2);
|
||||
$(this).remove();
|
||||
}
|
||||
});
|
||||
$('td.memItemLeft').each(function(){
|
||||
if($(this).siblings('.memItemRight').html()=="") {
|
||||
$(this).attr('colspan', 2);
|
||||
$(this).siblings('.memItemRight').remove();
|
||||
}
|
||||
});
|
||||
});
|
4
docs/font-awesome.min.css
vendored
Normal file
4
docs/font-awesome.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
392
docs/md/attributes.md
Normal file
392
docs/md/attributes.md
Normal file
@@ -0,0 +1,392 @@
|
||||
Attributed Variables and Co-Routining {#attributes}
|
||||
=======================================
|
||||
@ingroup extensions
|
||||
|
||||
|
||||
YAP supports attributed variables, originally developed at OFAI by
|
||||
Christian Holzbaur. Attributes are a means of declaring that an
|
||||
arbitrary term is a property for a variable. These properties can be
|
||||
updated during forward execution. Moreover, the unification algorithm is
|
||||
aware of attributed variables and will call user defined handlers when
|
||||
trying to unify these variables.
|
||||
|
||||
Attributed variables provide an elegant abstraction over which one can
|
||||
extend Prolog systems. Their main application so far has been in
|
||||
implementing constraint handlers, such as Holzbaur's CLPQR, Fruewirth
|
||||
and Holzbaur's CHR, and CLP(BN).
|
||||
|
||||
Different Prolog systems implement attributed variables in different
|
||||
ways. Originally, YAP used the interface designed by SICStus
|
||||
Prolog. This interface is still
|
||||
available through the <tt>atts</tt> library, and is used by CLPBN.
|
||||
|
||||
From YAP-6.0.3 onwards we recommend using the hProlog, SWI style
|
||||
interface. We believe that this design is easier to understand and
|
||||
work with. Most packages included in YAP that use attributed
|
||||
variables, such as CHR, CLP(FD), and CLP(QR), rely on the SWI-Prolog
|
||||
interface.
|
||||
|
||||
+ @ref SICS_attributes
|
||||
+ @ref New_Style_Attribute_Declarations
|
||||
+ @ref CohYroutining
|
||||
+ @ref AttributeVariables_Builtins
|
||||
|
||||
@section SICS_attributes SICStus Style attribute declarations.
|
||||
|
||||
The YAP library `atts` implements attribute variables in the style of
|
||||
SICStus Prolog. Attributed variables work as follows:
|
||||
|
||||
+ Each attribute must be declared beforehand. Attributes are described
|
||||
as a functor with name and arity and are local to a module. Each
|
||||
Prolog module declares its own sets of attributes. Different modules
|
||||
may have attributes with the same name and arity.
|
||||
|
||||
+ The built-in put_atts/2 adds or deletes attributes to a
|
||||
variable. The variable may be unbound or may be an attributed
|
||||
variable. In the latter case, YAP discards previous values for the
|
||||
attributes.
|
||||
|
||||
+ The built-in get_atts/2 can be used to check the values of
|
||||
an attribute associated with a variable.
|
||||
|
||||
+ The unification algorithm calls the user-defined predicate
|
||||
verify_attributes/3 before trying to bind an attributed
|
||||
variable. Unification will resume after this call.
|
||||
|
||||
+ The user-defined predicate
|
||||
<tt>attribute_goal/2</tt> converts from an attribute to a goal.
|
||||
|
||||
+ The user-defined predicate
|
||||
<tt>project_attributes/2</tt> is used from a set of variables into a set of
|
||||
constraints or goals. One application of <tt>project_attributes/2</tt> is in
|
||||
the top-level, where it is used to output the set of
|
||||
floundered constraints at the end of a query.
|
||||
|
||||
|
||||
Attributes are compound terms associated with a variable. Each attribute
|
||||
has a <em>name</em> which is <em>private</em> to the module in which the
|
||||
attribute was defined. Variables may have at most one attribute with a
|
||||
name. Attribute names are defined through the following declaration:
|
||||
|
||||
~~~~~
|
||||
:- attribute AttributeSpec, ..., AttributeSpec.
|
||||
~~~~~
|
||||
|
||||
where each _AttributeSpec_ has the form ( _Name_/ _Arity_).
|
||||
One single such declaration is allowed per module _Module_.
|
||||
|
||||
Although the YAP module system is predicate based, attributes are local
|
||||
to modules. This is implemented by rewriting all calls to the
|
||||
built-ins that manipulate attributes so that attribute names are
|
||||
preprocessed depending on the module. The `user:goal_expansion/3`
|
||||
mechanism is used for this purpose.
|
||||
|
||||
|
||||
The attribute manipulation predicates always work as follows:
|
||||
|
||||
+ The first argument is the unbound variable associated with
|
||||
attributes,
|
||||
+ The second argument is a list of attributes. Each attribute will
|
||||
be a Prolog term or a constant, prefixed with the <tt>+</tt> and <tt>-</tt> unary
|
||||
operators. The prefix <tt>+</tt> may be dropped for convenience.
|
||||
|
||||
The following three procedures are available to the user. Notice that
|
||||
these built-ins are rewritten by the system into internal built-ins, and
|
||||
that the rewriting process <em>depends</em> on the module on which the
|
||||
built-ins have been invoked.
|
||||
|
||||
|
||||
The user-predicate predicate verify_attributes/3 is called when
|
||||
attempting to unify an attributed variable which might have attributes
|
||||
in some _Module_.
|
||||
|
||||
|
||||
Attributes are usually presented as goals. The following routines are
|
||||
used by built-in predicates such as call_residue/2 and by the
|
||||
Prolog top-level to display attributes:
|
||||
|
||||
|
||||
Constraint solvers must be able to project a set of constraints to a set
|
||||
of variables. This is useful when displaying the solution to a goal, but
|
||||
may also be used to manipulate computations. The user-defined
|
||||
project_attributes/2 is responsible for implementing this
|
||||
projection.
|
||||
|
||||
|
||||
The following examples are taken from the SICStus Prolog
|
||||
manual. The sketches the implementation of a simple finite domain
|
||||
`solver`. Note that an industrial strength solver would have to
|
||||
provide a wider range of functionality and that it quite likely would
|
||||
utilize a more efficient representation for the domains proper. The
|
||||
module exports a single predicate `domain( _-Var_, _?Domain_)` which
|
||||
associates _Domain_ (a list of terms) with _Var_. A variable can be
|
||||
queried for its domain by leaving _Domain_ unbound.
|
||||
|
||||
We do not present here a definition for project_attributes/2.
|
||||
Projecting finite domain constraints happens to be difficult.
|
||||
|
||||
~~~~~
|
||||
:- module(domain, [domain/2]).
|
||||
|
||||
:- use_module(library(atts)).
|
||||
:- use_module(library(ordsets), [
|
||||
ord_intersection/3,
|
||||
ord_intersect/2,
|
||||
list_to_ord_set/2
|
||||
]).
|
||||
|
||||
:- attribute dom/1.
|
||||
|
||||
verify_attributes(Var, Other, Goals) :-
|
||||
get_atts(Var, dom(Da)), !, % are we involved?
|
||||
( var(Other) -> % must be attributed then
|
||||
( get_atts(Other, dom(Db)) -> % has a domain?
|
||||
ord_intersection(Da, Db, Dc),
|
||||
Dc = [El|Els], % at least one element
|
||||
( Els = [] -> % exactly one element
|
||||
Goals = [Other=El] % implied binding
|
||||
; Goals = [],
|
||||
put_atts(Other, dom(Dc))% rescue intersection
|
||||
)
|
||||
; Goals = [],
|
||||
put_atts(Other, dom(Da)) % rescue the domain
|
||||
)
|
||||
; Goals = [],
|
||||
ord_intersect([Other], Da) % value in domain?
|
||||
).
|
||||
verify_attributes(_, _, []). % unification triggered
|
||||
% because of attributes
|
||||
% in other modules
|
||||
|
||||
attribute_goal(Var, domain(Var,Dom)) :- % interpretation as goal
|
||||
get_atts(Var, dom(Dom)).
|
||||
|
||||
domain(X, Dom) :-
|
||||
var(Dom), !,
|
||||
get_atts(X, dom(Dom)).
|
||||
domain(X, List) :-
|
||||
list_to_ord_set(List, Set),
|
||||
Set = [El|Els], % at least one element
|
||||
( Els = [] -> % exactly one element
|
||||
X = El % implied binding
|
||||
; put_atts(Fresh, dom(Set)),
|
||||
X = Fresh % may call
|
||||
% verify_attributes/3
|
||||
).
|
||||
~~~~~
|
||||
|
||||
Note that the _implied binding_ `Other=El` was deferred until after
|
||||
the completion of `verify_attribute/3`. Otherwise, there might be a
|
||||
danger of recursively invoking `verify_attribute/3`, which might bind
|
||||
`Var`, which is not allowed inside the scope of `verify_attribute/3`.
|
||||
Deferring unifications into the third argument of `verify_attribute/3`
|
||||
effectively serializes the calls to `verify_attribute/3`.
|
||||
|
||||
Assuming that the code resides in the file domain.yap, we
|
||||
can use it via:
|
||||
|
||||
~~~~~
|
||||
| ?- use_module(domain).
|
||||
~~~~~
|
||||
|
||||
Let's test it:
|
||||
|
||||
~~~~~
|
||||
| ?- domain(X,[5,6,7,1]), domain(Y,[3,4,5,6]), domain(Z,[1,6,7,8]).
|
||||
|
||||
domain(X,[1,5,6,7]),
|
||||
domain(Y,[3,4,5,6]),
|
||||
domain(Z,[1,6,7,8]) ?
|
||||
|
||||
yes
|
||||
| ?- domain(X,[5,6,7,1]), domain(Y,[3,4,5,6]), domain(Z,[1,6,7,8]),
|
||||
X=Y.
|
||||
|
||||
Y = X,
|
||||
domain(X,[5,6]),
|
||||
domain(Z,[1,6,7,8]) ?
|
||||
|
||||
yes
|
||||
| ?- domain(X,[5,6,7,1]), domain(Y,[3,4,5,6]), domain(Z,[1,6,7,8]),
|
||||
X=Y, Y=Z.
|
||||
|
||||
X = 6,
|
||||
Y = 6,
|
||||
Z = 6
|
||||
~~~~~
|
||||
|
||||
To demonstrate the use of the _Goals_ argument of
|
||||
verify_attributes/3, we give an implementation of
|
||||
freeze/2. We have to name it `myfreeze/2` in order to
|
||||
avoid a name clash with the built-in predicate of the same name.
|
||||
|
||||
~~~~~
|
||||
:- module(myfreeze, [myfreeze/2]).
|
||||
|
||||
:- use_module(library(atts)).
|
||||
|
||||
:- attribute frozen/1.
|
||||
|
||||
verify_attributes(Var, Other, Goals) :-
|
||||
get_atts(Var, frozen(Fa)), !, % are we involved?
|
||||
( var(Other) -> % must be attributed then
|
||||
( get_atts(Other, frozen(Fb)) % has a pending goal?
|
||||
-> put_atts(Other, frozen((Fa,Fb))) % rescue conjunction
|
||||
; put_atts(Other, frozen(Fa)) % rescue the pending goal
|
||||
),
|
||||
Goals = []
|
||||
; Goals = [Fa]
|
||||
).
|
||||
verify_attributes(_, _, []).
|
||||
|
||||
attribute_goal(Var, Goal) :- % interpretation as goal
|
||||
get_atts(Var, frozen(Goal)).
|
||||
|
||||
myfreeze(X, Goal) :- put_atts(Fresh, frozen(Goal)), Fresh = X. ~~~~~
|
||||
|
||||
Assuming that this code lives in file myfreeze.yap,
|
||||
we would use it via:
|
||||
|
||||
~~~~~
|
||||
| ?- use_module(myfreeze).
|
||||
| ?- myfreeze(X,print(bound(x,X))), X=2.
|
||||
|
||||
bound(x,2) % side effect
|
||||
X = 2 % bindings
|
||||
~~~~~
|
||||
|
||||
The two solvers even work together:
|
||||
|
||||
~~~~~
|
||||
| ?- myfreeze(X,print(bound(x,X))), domain(X,[1,2,3]),
|
||||
domain(Y,[2,10]), X=Y.
|
||||
|
||||
bound(x,2) % side effect
|
||||
X = 2, % bindings
|
||||
Y = 2
|
||||
~~~~~
|
||||
|
||||
The two example solvers interact via bindings to shared attributed
|
||||
variables only. More complicated interactions are likely to be found
|
||||
in more sophisticated solvers. The corresponding
|
||||
verify_attributes/3 predicates would typically refer to the
|
||||
attributes from other known solvers/modules via the module prefix in
|
||||
Module:get_atts/2`.
|
||||
|
||||
@}
|
||||
|
||||
@{
|
||||
|
||||
@defgroup New_Style_Attribute_Declarations hProlog and SWI-Prolog style Attribute Declarations
|
||||
|
||||
The following documentation is taken from the SWI-Prolog manual.
|
||||
|
||||
Binding an attributed variable schedules a goal to be executed at the
|
||||
first possible opportunity. In the current implementation the hooks are
|
||||
executed immediately after a successful unification of the clause-head
|
||||
or successful completion of a foreign language (built-in) predicate. Each
|
||||
attribute is associated to a module and the hook attr_unify_hook/2 is
|
||||
executed in this module. The example below realises a very simple and
|
||||
incomplete finite domain reasoner.
|
||||
|
||||
~~~~~
|
||||
:- module(domain,
|
||||
[ domain/2 % Var, ?Domain %
|
||||
]).
|
||||
:- use_module(library(ordsets)).
|
||||
|
||||
domain(X, Dom) :-
|
||||
var(Dom), !,
|
||||
get_attr(X, domain, Dom).
|
||||
domain(X, List) :-
|
||||
list_to_ord_set(List, Domain),
|
||||
v put_attr(Y, domain, Domain),
|
||||
X = Y.
|
||||
|
||||
% An attributed variable with attribute value Domain has been %
|
||||
% assigned the value Y %
|
||||
|
||||
attr_unify_hook(Domain, Y) :-
|
||||
( get_attr(Y, domain, Dom2)
|
||||
-> ord_intersection(Domain, Dom2, NewDomain),
|
||||
( NewDomain == []
|
||||
-> fail
|
||||
; NewDomain = [Value]
|
||||
-> Y = Value
|
||||
; put_attr(Y, domain, NewDomain)
|
||||
)
|
||||
; var(Y)
|
||||
-> put_attr( Y, domain, Domain )
|
||||
; ord_memberchk(Y, Domain)
|
||||
).
|
||||
|
||||
% Translate attributes from this module to residual goals %
|
||||
|
||||
attribute_goals(X) -->
|
||||
{ get_attr(X, domain, List) },
|
||||
[domain(X, List)].
|
||||
~~~~~
|
||||
|
||||
Before explaining the code we give some example queries:
|
||||
|
||||
The predicate `domain/2` fetches (first clause) or assigns
|
||||
(second clause) the variable a <em>domain</em>, a set of values it can
|
||||
be unified with. In the second clause first associates the domain
|
||||
with a fresh variable and then unifies X to this variable to deal
|
||||
with the possibility that X already has a domain. The
|
||||
predicate attr_unify_hook/2 is a hook called after a variable with
|
||||
a domain is assigned a value. In the simple case where the variable
|
||||
is bound to a concrete value we simply check whether this value is in
|
||||
the domain. Otherwise we take the intersection of the domains and either
|
||||
fail if the intersection is empty (first example), simply assign the
|
||||
value if there is only one value in the intersection (second example) or
|
||||
assign the intersection as the new domain of the variable (third
|
||||
example). The nonterminal `attribute_goals/3` is used to translate
|
||||
remaining attributes to user-readable goals that, when executed, reinstate
|
||||
these attributes.
|
||||
|
||||
@}
|
||||
|
||||
|
||||
@{
|
||||
@defgroup CohYroutining Co-routining
|
||||
|
||||
Prolog uses a simple left-to-right flow of control. It is sometimes
|
||||
convenient to change this control so that goals will only execute when
|
||||
sufficiently instantiated. This may result in a more "data-driven"
|
||||
execution, or may be necessary to correctly implement extensions such
|
||||
as negation by failure.
|
||||
|
||||
Initially, YAP used a separate mechanism for co-routining. Nowadays, YAP uses
|
||||
attributed variables to implement co-routining.
|
||||
|
||||
Two declarations are supported:
|
||||
|
||||
+ block/1
|
||||
The argument to `block/1` is a condition on a goal or a conjunction
|
||||
of conditions, with each element separated by commas. Each condition is
|
||||
of the form `predname( _C1_,..., _CN_)`, where _N_ is the
|
||||
arity of the goal, and each _CI_ is of the form `-`, if the
|
||||
argument must suspend until the first such variable is bound, or
|
||||
`?`, otherwise.
|
||||
|
||||
+ wait/1
|
||||
The argument to `wait/1` is a predicate descriptor or a conjunction
|
||||
of these predicates. These predicates will suspend until their first
|
||||
argument is bound.
|
||||
|
||||
|
||||
The following primitives can be used:
|
||||
|
||||
- freeze/2
|
||||
|
||||
- dif/2
|
||||
|
||||
- when/2
|
||||
|
||||
- frozen/2
|
||||
|
||||
|
||||
@}
|
||||
|
||||
@}
|
14
docs/md/download.md
Normal file
14
docs/md/download.md
Normal file
@@ -0,0 +1,14 @@
|
||||
|
||||
Downloading YAP {#download}
|
||||
==============
|
||||
|
||||
The latest development version of Yap-6 is yap-6.3.5 and can be
|
||||
obtained from the repositories
|
||||
|
||||
+ [https://github.com/vscosta/yap-6.3]{github}
|
||||
|
||||
and an older version at:
|
||||
|
||||
+ [http://sourceforge.net/p/yap/yap-6.3]{sourceforge}
|
||||
|
||||
YAP-6.3.5 does not use git submodules. Please just use `git clone` to obtain the distribution.
|
337
docs/md/modules.md
Normal file
337
docs/md/modules.md
Normal file
@@ -0,0 +1,337 @@
|
||||
The YAP Module system {#YAPModules}
|
||||
=====================
|
||||
|
||||
The YAP module system is based on the Quintus/SISCtus module
|
||||
system ˜\cite quintus . In this design, modules are named collections of predicates,
|
||||
and all predicates belong to a single module. By default, predicates are only
|
||||
visible within a module, or _private_ to that module. The module
|
||||
may also define a list of predicates that are
|
||||
_exported_, that is, visible to other modules.
|
||||
|
||||
The main predicates in the module system are:
|
||||
|
||||
* module/2 associates a source file to a module. It has two arguments: the name of the new module, and a list of predicates exported by the module.
|
||||
|
||||
* use_module/1 and use_module/2 can be used to load a module. They take as first argument the source file for the module. Whereas use_module/1 loads all exported predicates, use_module/2 only takes the ones given by the second argument.
|
||||
|
||||
YAP pre-defines a number of modules. Most system predicates belong to
|
||||
the module `prolog`. Predicates from the module `prolog` are
|
||||
automatically visible to every module. The `system` module was
|
||||
introduced for SWI-Prolog compatibility, and in YAP mostly acts as an
|
||||
alias to `prolog`. The `user` module is also visible to all other modules.
|
||||
|
||||
The YAP engine is always associated to a module, the current <em>source
|
||||
module</em> or <em>type-in module</em>. By default, all predicates
|
||||
read-in and all calls to a goal will be made to predicates visible to
|
||||
the current source module, Initially, the source module for YAP is the
|
||||
module `user`. Thus Prolog programs that do not define modules will
|
||||
operate within the `user` module. In this case, all predicates will be
|
||||
visible to all source files.
|
||||
|
||||
YAP includes a number of libraries and packages, most of them
|
||||
defining their own modules. Note that there is no system mechanism to
|
||||
avoid clashes between module names, so it is up to the programmer to
|
||||
carefully choose the names for her own program modules.
|
||||
|
||||
The main mechanism to change the current type-in module is by using
|
||||
the module/2 declaration.This declaration sets the source module when
|
||||
it starts consulting a file, and resets it at the end. One can set
|
||||
the type-in module permanently by using the built-in `module/1`.
|
||||
|
||||
#### Explicit Naming {#ExplicitNaming}
|
||||
|
||||
The module system allows one to _explicitly_ specify the source mode for
|
||||
a clause by prefixing a clause with its module, say:
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.prolog}
|
||||
user:(a :- b).
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
it is also possible to type
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.prolog}
|
||||
|
||||
user:a :- user:b.
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
both formulations describe the same clause, independently of the
|
||||
current type-in module.
|
||||
|
||||
In fact, it is sufficient to specify the source mode for the clause's
|
||||
head:
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.prolog}
|
||||
user:a :- b.
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
if the current type-in module is `m`, the clause could also be written as:
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.prolog}
|
||||
user:a :- m:b.
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
The compiler rewrites the source clauses to ensure that explicit calls
|
||||
are respected, and that implicit calls are made to the current source
|
||||
module.
|
||||
|
||||
A goal should refer to a predicate visible within the current type-in
|
||||
module. Thus, if a goal appears in a text file with a module
|
||||
declaration, the goal refers to that module's context (but see the
|
||||
initialization/1 directive for more details).
|
||||
|
||||
Again, one can override this rule by prefixing a goal with a module to
|
||||
be consulted. The following query:
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.prolog}
|
||||
?- nasa:launch(apollo,13).
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
invokes the goal `launch(apollo,13)` as if the current source
|
||||
module was `nasa`.
|
||||
|
||||
YAP and other Prolog systems allow the module prefix to see all
|
||||
predicates visible in the module, including predicates private to the
|
||||
module. This rule allows maximum flexibility, but it also breaks
|
||||
encapsulation and should be used with care. The ciao language proposes
|
||||
a different approach to this problem, see \cite DBLP:conf/cl/GrasH00 .
|
||||
|
||||
Modules are not always associated with a source-file. They
|
||||
may range over several files, by using the
|
||||
`include`directive. Moreover, they may not be associated to any source
|
||||
file. As an example,
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.prolog}
|
||||
?- assert( nasa:launch(apollo,13) ).
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
will create a module `nasa`, if does not already exist. In fact it is
|
||||
sufficient to call a predicate from a module to implicitly create the
|
||||
module. Hence after this call:
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.prolog}
|
||||
?- nasa:launch(apollo,13).
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
there will be a `nasa`module in the system, even if nasa:launch/2 is
|
||||
not at all defined.
|
||||
|
||||
\pred use_module( +Files ) is directive
|
||||
loads a module file
|
||||
|
||||
This predicate loads the file specified by _Files_, importing all
|
||||
their public predicates into the current type-in module. It is
|
||||
implemented as if by:
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.prolog}
|
||||
use_module(F) :-
|
||||
load_files(F, [if(not_loaded),must_be_module(true)]).
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Notice that _Files_ may be a single file, or a list with a number
|
||||
files. The _Files_ are loaded in YAP only once, even if they have been
|
||||
updated meanwhile. YAP should also verify whether the files actually
|
||||
define modules. Please consult load_files/3 for other options when
|
||||
loading a file.
|
||||
|
||||
Predicate name clashes between two different modules may arise, either
|
||||
when trying to import predicates that are also defined in the current
|
||||
type-in module, or by trying to import the same predicate from two
|
||||
different modules.
|
||||
|
||||
In the first case, the local predicate is considered to have priority
|
||||
and use_module/1 simply gives a warning. As an example, if the file
|
||||
`a.pl` contains:
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.prolog}
|
||||
:- module( a, [a/1] ).
|
||||
|
||||
:- use_module(b).
|
||||
|
||||
a(1).
|
||||
a(X) :- b(X).
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
and the file `b.pl` contains:
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.prolog}
|
||||
:- module( b, [a/1,b/1] ).
|
||||
|
||||
a(2).
|
||||
|
||||
b(1).
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
YAP will execute as follows:
|
||||
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.prolog}
|
||||
?- [a].
|
||||
% consulting .../a.pl...
|
||||
% consulting .../b.pl...
|
||||
% consulted .../b.pl in module b, 0 msec 0 bytes
|
||||
% consulted .../a.pl in module a, 1 msec 0 bytes
|
||||
true.
|
||||
?- a(X).
|
||||
X = 1 ? ;
|
||||
X = 1.
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
The example shows that the query `a(X)`has a single answer, the one
|
||||
defined in `a.pl`. Calls to `a(X)`succeed in the top-level, because
|
||||
the module `a` was loaded into `user`. On the other hand, `b(X)`is not
|
||||
exported by `a.pl`, and is not available to calls, although it can be
|
||||
accessed as a predicate in the module 'a' by using the `:` operator.
|
||||
|
||||
Next, consider the three files `c.pl`, `d1.pl`, and `d2.pl`:
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.prolog}
|
||||
% c.pl
|
||||
:- module( c, [a/1] ).
|
||||
|
||||
:- use_module([d1, d2]).
|
||||
|
||||
a(X) :-
|
||||
b(X).
|
||||
a(X) :-
|
||||
c(X).
|
||||
a(X) :-
|
||||
d(X).
|
||||
|
||||
% d1.pl
|
||||
:- module( d1, [b/1,c/1] ).
|
||||
|
||||
b(2).
|
||||
c(3).
|
||||
|
||||
|
||||
% d2.pl
|
||||
:- module( d2, [b/1,d/1] ).
|
||||
|
||||
b(1).
|
||||
d(4).
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
The result is as follows:
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.prolog}
|
||||
./yap -l c
|
||||
YAP 6.3.4 (x86_64-darwin13.3.0): Tue Jul 15 10:42:11 CDT 2014
|
||||
|
||||
ERROR!!
|
||||
at line 3 in o/d2.pl,
|
||||
PERMISSION ERROR- loading .../c.pl: modules d1 and d2 both define b/1
|
||||
?- a(X).
|
||||
X = 2 ? ;
|
||||
ERROR!!
|
||||
EXISTENCE ERROR- procedure c/1 is undefined, called from context prolog:$user_call/2
|
||||
Goal was c:c(_131290)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
The state of the module system after this error is undefined.
|
||||
|
||||
### BuiltIn predicates {#ModuleBuiltins)
|
||||
|
||||
@\pred module(+ M:atom,+ L:list ) is directive
|
||||
the current file defines module _M_ with exports _L_. The list may include
|
||||
|
||||
+ predicate indicators
|
||||
|
||||
+ operator definitions that look like calls to op/3.
|
||||
|
||||
The list _L_ may include predicates imported from other modules. If
|
||||
you want to fully reexport a module, or a sub-set, also consider reexport/1.
|
||||
|
||||
Similar to module/2, this directive defines the file where it
|
||||
appears in as a module file; it must be the first declaration in the file.
|
||||
_M_ must be an atom specifying the module name; _L_ must be a
|
||||
list containing the module's public predicates specification, in the
|
||||
form `[predicate_name/arity,...]`.
|
||||
|
||||
The last argument _Options_ must be a list of options, which can be:
|
||||
+ <b>filename</b>
|
||||
the filename for a module to import into the current module.
|
||||
|
||||
+ <b>library( +File )</b>
|
||||
a library file to import into the current module.
|
||||
|
||||
+ <b>hide( +Opt)</b>
|
||||
if _Opt_ is `false`, keep source code for current module, if `true`, disable.
|
||||
|
||||
+ <b>export(+PredicateIndicator )</b>
|
||||
Add predicates to the public list of the context module. This implies
|
||||
the predicate will be imported into another module if this module
|
||||
is imported with use_module/1 and use_module/2.
|
||||
|
||||
+ <b>export_list(? _Mod_,? _ListOfPredicateIndicator_)</b>
|
||||
The list _ListOfPredicateIndicator_ contains all predicates
|
||||
exported by module _Mod_
|
||||
|
||||
Note that predicates are normally exported using the directive
|
||||
`module/2`. The `export/1` argumwnt is meant to allow export from
|
||||
dynamically created modules. The directive argument may also be a list
|
||||
of predicates.
|
||||
|
||||
@pred use_module(+Files, +Imports)
|
||||
loads a module file but only imports the named predicates
|
||||
|
||||
|
||||
This predicate loads the file specified by _Files_, importing their
|
||||
public predicates specified by _Imports_ into the current type-in
|
||||
module. It is implemented as if by:
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.prolog}
|
||||
use_module(Files, Imports) :-
|
||||
load_files(Files, [if(not_loaded),must_be_module(true),imports(Imports)]).
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
The _Imports_ argument may be use to specify which predicates one
|
||||
wants to load. It can also be used to give the predicates a different name. As an example,
|
||||
the graphs library is implemented on top of the red-black trees library, and some predicates are just aliases:
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.prolog}
|
||||
:- use_module(library(rbtrees), [
|
||||
rb_min/3 as min_assoc,
|
||||
rb_max/3 as max_assoc,
|
||||
|
||||
...]).
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Unfortunately it is still not possible to change argument order.
|
||||
|
||||
|
||||
\pred module(+ M:atom,+ L:list ) is directive
|
||||
the current file defines module _M_ with exports _L_. The list may include
|
||||
|
||||
+ predicate indicators
|
||||
|
||||
+ operator definitions that look like calls to op/3.
|
||||
|
||||
The list _L_ may include predicates imported from other modules. If
|
||||
you want to fully reexport a module, or a sub-set, also consider reexport/1.
|
||||
|
||||
Similar to module/2, this directive defines the file where it
|
||||
appears in as a module file; it must be the first declaration in the file.
|
||||
_M_ must be an atom specifying the module name; _L_ must be a
|
||||
list containing the module's public predicates specification, in the
|
||||
form `[predicate_name/arity,...]`.
|
||||
|
||||
The last argument _Options_ must be a list of options, which can be:
|
||||
+<b>filename</b>
|
||||
the filename for a module to import into the current module.
|
||||
|
||||
+ <b>library( +File )</b>
|
||||
a library file to import into the current module.
|
||||
|
||||
+ <b>hide( +Opt)</b>
|
||||
if _Opt_ is `false`, keep source code for current module, if `true`, disable.
|
||||
|
||||
+ <b>export(+PredicateIndicator )</b>
|
||||
Add predicates to the public list of the context module. This implies
|
||||
the predicate will be imported into another module if this module
|
||||
is imported with use_module/1 and use_module/2.
|
||||
|
||||
+ <b>export_list(? _Mod_,? _ListOfPredicateIndicator_)</b>
|
||||
The list _ListOfPredicateIndicator_ contains all predicates
|
||||
exported by module _Mod_
|
||||
|
||||
Note that predicates are normally exported using the directive
|
||||
`module/2`. The `export/1` argument is meant to allow export from
|
||||
dynamically created modules. The directive argument may also be a list
|
||||
of predicates.
|
565
docs/md/syntax.md
Normal file
565
docs/md/syntax.md
Normal file
@@ -0,0 +1,565 @@
|
||||
YAP Syntax {#YAPSyntax}
|
||||
============
|
||||
|
||||
@ingroup YAPProgrammming
|
||||
|
||||
We will describe the syntax of YAP at two levels. We first will
|
||||
describe the syntax for Prolog terms. In a second level we describe
|
||||
the tokens from which Prolog terms are
|
||||
built.
|
||||
|
||||
@defgroup Formal_Syntax Syntax of Terms
|
||||
@ingroup YAPSyntax
|
||||
|
||||
Below, we describe the syntax of YAP terms from the different
|
||||
classes of tokens defined above. The formalism used will be <em>BNF</em>,
|
||||
extended where necessary with attributes denoting integer precedence or
|
||||
operator type.
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
term ----> subterm(1200) end_of_term_marker
|
||||
|
||||
subterm(N) ----> term(M) [M <= N]
|
||||
|
||||
term(N) ----> op(N, fx) subterm(N-1)
|
||||
| op(N, fy) subterm(N)
|
||||
| subterm(N-1) op(N, xfx) subterm(N-1)
|
||||
| subterm(N-1) op(N, xfy) subterm(N)
|
||||
| subterm(N) op(N, yfx) subterm(N-1)
|
||||
| subterm(N-1) op(N, xf)
|
||||
| subterm(N) op(N, yf)
|
||||
|
||||
term(0) ----> atom '(' arguments ')'
|
||||
| '(' subterm(1200) ')'
|
||||
| '{' subterm(1200) '}'
|
||||
| list
|
||||
| string
|
||||
| number
|
||||
| atom
|
||||
| variable
|
||||
|
||||
arguments ----> subterm(999)
|
||||
| subterm(999) ',' arguments
|
||||
|
||||
list ----> '[]'
|
||||
| '[' list_expr ']'
|
||||
|
||||
list_expr ----> subterm(999)
|
||||
| subterm(999) list_tail
|
||||
|
||||
list_tail ----> ',' list_expr
|
||||
| ',..' subterm(999)
|
||||
| '|' subterm(999)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Notes:
|
||||
|
||||
+ \a op(N,T) denotes an atom which has been previously declared with type
|
||||
\a T and base precedence \a N.
|
||||
|
||||
+ Since ',' is itself a pre-declared operator with type \a xfy and
|
||||
precedence 1000, is \a subterm starts with a '(', \a op must be
|
||||
followed by a space to avoid ambiguity with the case of a functor
|
||||
followed by arguments, e.g.:
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
+ (a,b) [the same as '+'(','(a,b)) of arity one]
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
versus
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
+(a,b) [the same as '+'(a,b) of arity two]
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
+
|
||||
In the first rule for term(0) no blank space should exist between
|
||||
\a atom and '('.
|
||||
|
||||
+
|
||||
Each term to be read by the YAP parser must end with a single
|
||||
dot, followed by a blank (in the sense mentioned in the previous
|
||||
paragraph). When a name consisting of a single dot could be taken for
|
||||
the end of term marker, the ambiguity should be avoided by surrounding the
|
||||
dot with single quotes.
|
||||
|
||||
|
||||
|
||||
# @defgroup Tokens Prolog Tokens
|
||||
@ingroup YAPSyntax
|
||||
|
||||
Prolog tokens are grouped into the following categories:
|
||||
|
||||
## @defgroup Numbers Numbers
|
||||
@ingroup Tokens
|
||||
|
||||
Numbers can be further subdivided into integer and floating-point numbers.
|
||||
|
||||
### @defgroup Integers Integers
|
||||
@ingroup Numbers
|
||||
|
||||
Integer numbers
|
||||
are described by the following regular expression:
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
<integer> := {<digit>+<single-quote>|0{xXo}}<alpha_numeric_char>+
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
where {...} stands for optionality, \a + optional repetition (one or
|
||||
more times), \a \\\<digit\\\> denotes one of the characters 0 ... 9, \a |
|
||||
denotes or, and \a \\\<single-quote\\\> denotes the character "'". The digits
|
||||
before the \a \\\<single-quote\\\> character, when present, form the number
|
||||
basis, that can go from 0, 1 and up to 36. Letters from `A` to
|
||||
`Z` are used when the basis is larger than 10.
|
||||
|
||||
Note that if no basis is specified then base 10 is assumed. Note also
|
||||
that the last digit of an integer token can not be immediately followed
|
||||
by one of the characters 'e', 'E', or '.'.
|
||||
|
||||
Following the ISO standard, YAP also accepts directives of the
|
||||
form `0x` to represent numbers in hexadecimal base and of the form
|
||||
`0o` to represent numbers in octal base. For usefulness,
|
||||
YAP also accepts directives of the form `0X` to represent
|
||||
numbers in hexadecimal base.
|
||||
|
||||
Example:
|
||||
the following tokens all denote the same integer
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
10 2'1010 3'101 8'12 16'a 36'a 0xa 0o12
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Numbers of the form `0'a` are used to represent character
|
||||
constants. So, the following tokens denote the same integer:
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
0'd 100
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
YAP (version 6.3.4) supports integers that can fit
|
||||
the word size of the machine. This is 32 bits in most current machines,
|
||||
but 64 in some others, such as the Alpha running Linux or Digital
|
||||
Unix. The scanner will read larger or smaller integers erroneously.
|
||||
|
||||
### @defgroup Floats Floats
|
||||
@ingroup Numbers
|
||||
|
||||
Floating-point numbers are described by:
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
<float> := <digit>+{<dot><digit>+}
|
||||
<exponent-marker>{<sign>}<digit>+
|
||||
|<digit>+<dot><digit>+
|
||||
{<exponent-marker>{<sign>}<digit>+}
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
where \a \\\<dot\\\> denotes the decimal-point character '.',
|
||||
\a \\\<exponent-marker\\\> denotes one of 'e' or 'E', and \a \\\<sign\\\> denotes
|
||||
one of '+' or '-'.
|
||||
|
||||
Examples:
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
10.0 10e3 10e-3 3.1415e+3
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Floating-point numbers are represented as a double in the target
|
||||
machine. This is usually a 64-bit number.
|
||||
|
||||
## Strings @defgroup Strings Character Strings
|
||||
|
||||
Strings are described by the following rules:
|
||||
|
||||
~~~~
|
||||
string --> " string_quoted_characters "
|
||||
string --> ` string_quoted_characters `
|
||||
|
||||
string_quoted_characters --> '"' '"' string_quoted_characters
|
||||
string_quoted_characters --> '\'
|
||||
escape_sequence string_quoted_characters
|
||||
string_quoted_characters -->
|
||||
string_character string_quoted_characters
|
||||
|
||||
escape_sequence --> 'a' | 'b' | 'r' | 'f' | 't' | 'n' | 'v'
|
||||
escape_sequence --> '\' | '"' | ''' | '`'
|
||||
escape_sequence --> at_most_3_octal_digit_seq_char '\'
|
||||
escape_sequence --> 'x' at_most_2_hexa_digit_seq_char '\'
|
||||
~~~~
|
||||
|
||||
where `string_character` is any character except the double quote (back quote)
|
||||
and escape characters.
|
||||
|
||||
YAP supports four different textual elements:
|
||||
|
||||
+ Atoms, mentioned above, are textual representations of symbols, that are interned in the
|
||||
data-base. They are stored either in ISO-LATIN-1 (first 256 code points), or as UTF-32.
|
||||
|
||||
+ Strings are atomic representations of text. The back-quote character is used to identify these objects in the program. Strings exist as stack objects, in the same way as other Prolog terms. As Prolog unification cannot be used to manipulate strings, YAP includes built-ins such as string_arg/3, sub_string/5, or string_concat to manipulate them efficiently. Strings are stored as opaque objects containing a
|
||||
|
||||
+ Lists of codes represent text as a list of numbers, where each number is a character code. A string of _N_ bytes requires _N_ pairs, that is _2N_ cells, leading to a total of 16 bytes per character on 64 byte machines. Thus, they are a very expensive, but very flexible representation, as one can use unification to construct and access string elements.
|
||||
|
||||
+ Lists of atoms represent text as a list of atoms, where each number has a single character code. A string of _N_ bytes also requires _2N_ pairs. They have similar properties to lists of codes.
|
||||
|
||||
The flags `double_quotes` and `backquoted_string` change the interpretation of text strings, they can take the
|
||||
values `atom`, `string`, `codes`, and `chars`.
|
||||
|
||||
Examples:
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
"" "a string" "a double-quote:"""
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
The first string is an empty string, the last string shows the use of
|
||||
double-quoting.
|
||||
|
||||
Escape sequences can be used to include the non-printable characters
|
||||
`a` (alert), `b` (backspace), `r` (carriage return),
|
||||
`f` (form feed), `t` (horizontal tabulation), `n` (new
|
||||
line), and `v` (vertical tabulation). Escape sequences also be
|
||||
include the meta-characters `\\`, `"`, `'`, and
|
||||
```. Last, one can use escape sequences to include the characters
|
||||
either as an octal or hexadecimal number.
|
||||
|
||||
The next examples demonstrates the use of escape sequences in YAP:
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
"\x0c\" "\01\" "\f" "\\"
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
The first three examples return a list including only character 12 (form
|
||||
feed). The last example escapes the escape character.
|
||||
|
||||
Escape sequences were not available in C-Prolog and in original
|
||||
versions of YAP up to 4.2.0. Escape sequences can be disabled by using:
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
:- yap_flag(character_escapes,false).
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
## @addgroup Atoms Atoms
|
||||
@ingroup Tokens
|
||||
|
||||
Atoms are defined by one of the following rules:
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
atom --> solo-character
|
||||
atom --> lower-case-letter name-character*
|
||||
atom --> symbol-character+
|
||||
atom --> single-quote single-quote
|
||||
atom --> ''' atom_quoted_characters '''
|
||||
|
||||
atom_quoted_characters --> ''' ''' atom_quoted_characters
|
||||
atom_quoted_characters --> '\' atom_sequence string_quoted_characters
|
||||
atom_quoted_characters --> character string_quoted_characters
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
where:
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
<solo-character> denotes one of: ! ;
|
||||
<symbol-character> denotes one of: # & * + - . / : <
|
||||
= > ? @ \ ^ ~ `
|
||||
<lower-case-letter> denotes one of: a...z
|
||||
<name-character> denotes one of: _ a...z A...Z 0....9
|
||||
<single-quote> denotes: '
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
and `string_character` denotes any character except the double quote
|
||||
and escape characters. Note that escape sequences in strings and atoms
|
||||
follow the same rules.
|
||||
|
||||
Examples:
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
a a12x '$a' ! => '1 2'
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Version `4.2.0` of YAP removed the previous limit of 256
|
||||
characters on an atom. Size of an atom is now only limited by the space
|
||||
available in the system.
|
||||
|
||||
## @addgroup Variables Variables
|
||||
@ingroup Tokens
|
||||
|
||||
Variables are described by:
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
<variable-starter><variable-character>+
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
where
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
<variable-starter> denotes one of: _ A...Z
|
||||
<variable-character> denotes one of: _ a...z A...Z
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
If a variable is referred only once in a term, it needs not to be named
|
||||
and one can use the character `_` to represent the variable. These
|
||||
variables are known as anonymous variables. Note that different
|
||||
occurrences of `_` on the same term represent <em>different</em>
|
||||
anonymous variables.
|
||||
|
||||
## @addgroup Punctuation_Tokens Punctuation Tokens
|
||||
@ingroup Tokens
|
||||
Punctuation tokens consist of one of the following characters:
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
( ) , [ ] { } |
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
These characters are used to group terms.
|
||||
|
||||
@subsection Layout Layout
|
||||
Any characters with ASCII code less than or equal to 32 appearing before
|
||||
a token are ignored.
|
||||
|
||||
All the text appearing in a line after the character \a % is taken to
|
||||
be a comment and ignored (including \a %). Comments can also be
|
||||
inserted by using the sequence `/\*` to start the comment and
|
||||
`\*` followed by `/` to finish it. In the presence of any sequence of comments or
|
||||
layout characters, the YAP parser behaves as if it had found a
|
||||
single blank character. The end of a file also counts as a blank
|
||||
character for this purpose.
|
||||
|
||||
## @addgroup WideChars Encoding Wide Character Support
|
||||
@ingroup YAPSyntax
|
||||
|
||||
|
||||
YAP now implements a SWI-Prolog compatible interface to wide
|
||||
characters and the Universal Character Set (UCS). The following text
|
||||
was adapted from the SWI-Prolog manual.
|
||||
|
||||
YAP now supports wide characters, characters with character
|
||||
codes above 255 that cannot be represented in a single byte.
|
||||
<em>Universal Character Set</em> (UCS) is the ISO/IEC 10646 standard
|
||||
that specifies a unique 31-bits unsigned integer for any character in
|
||||
any language. It is a superset of 16-bit Unicode, which in turn is
|
||||
a superset of ISO 8859-1 (ISO Latin-1), a superset of US-ASCII. UCS
|
||||
can handle strings holding characters from multiple languages and
|
||||
character classification (uppercase, lowercase, digit, etc.) and
|
||||
operations such as case-conversion are unambiguously defined.
|
||||
|
||||
For this reason YAP, following SWI-Prolog, has two representations for
|
||||
atoms. If the text fits in ISO Latin-1, it is represented as an array
|
||||
of 8-bit characters. Otherwise the text is represented as an array of
|
||||
wide chars, which may take 16 or 32 bits. This representational issue
|
||||
is completely transparent to the Prolog user. Users of the foreign
|
||||
language interface sometimes need to be aware of these issues though. Notice that this will likely
|
||||
change in the future, we probably will use an UTF-8 based representation.
|
||||
|
||||
Character coding comes into view when characters of strings need to be
|
||||
read from or written to file or when they have to be communicated to
|
||||
other software components using the foreign language interface. In this
|
||||
section we only deal with I/O through streams, which includes file I/O
|
||||
as well as I/O through network sockets.
|
||||
|
||||
== @addgroup Stream_Encoding Wide character encodings on streams
|
||||
@ingroup WideChars
|
||||
|
||||
The UCS standard describes all possible characters (or code points, as they include
|
||||
ideograms, ligatures, and other symbols). The current version, Unicode 8.0, allows
|
||||
code points up to 0x10FFFF, and thus allows for 1,114,112 code points. See [Unicode Charts](http://unicode.org/charts/) for the supported languages.
|
||||
|
||||
Notice that most symbols are rarely used. Encodings represent the Unicode characters in a way
|
||||
that is more suited for communication. The most popular encoding, especially in the context of the web and in the Unix/Linux/BSD/Mac communities, is
|
||||
UTF-8. UTF-8 is compact and as it uses bytes, does not have different endianesses.
|
||||
Bytes 0...127 represent simply the corresponding US-ASCII
|
||||
character, while bytes 128...255 are used for multi-byte
|
||||
encoding of characters placed higher in the UCS space.
|
||||
|
||||
Especially on
|
||||
MS-Windows and Java the 16-bit Unicode standard, represented by pairs of bytes is
|
||||
also popular. Originally, Microsoft supported a UCS-2 with 16 bits that
|
||||
could represent only up to 64k characters. This was later extended to support the full
|
||||
Unicode, we will call the latter version UTF-16. The extension uses a hole in the first 64K code points. Characters above 0xFFFF are divided into two 2-byte words, each one in that hole. There are two versions of UTF-16: big and low
|
||||
endian. By default, UTF-16 is big endian, in practice most often it is used on Intel
|
||||
hardware that is naturally little endian.
|
||||
|
||||
UTF-32, often called UCS-4, provides a natural interface where a code point is coded as
|
||||
four octets. Unfortunately, it is also more expensive, so it is not as widely used.
|
||||
|
||||
Last, other encodings are also commonly used. One such legacy encoding is ISO-LATIN-1, that
|
||||
supported latin based languages in western europe. YAP currently uses either ISO-LATIN-1 or UTF-32
|
||||
internally.
|
||||
|
||||
Prolog supports the default encoding used by the Operating System,
|
||||
Namely, YAP checks the variables LANG, LC_ALL and LC_TYPE. Say, if at boot YAP detects that the
|
||||
environment variable `LANG` ends in "UTF-8", this encoding is
|
||||
assumed. Otherwise, the default is `text` and the translation is
|
||||
left to the wide-character functions of the C-library (note that the
|
||||
Prolog native UTF-8 mode is considerably faster than the generic
|
||||
`mbrtowc()` one).
|
||||
|
||||
Prolog allows the encoding to be specified explicitly in
|
||||
load_files/2 for loading Prolog source with an alternative
|
||||
encoding, `open/4` when opening files or using `set_stream/2` on
|
||||
any open stream (not yet implemented). For Prolog source files we also
|
||||
provide the `encoding/1` directive that can be used to switch
|
||||
between encodings that are compatible to US-ASCII (`ascii`,
|
||||
`iso_latin_1`, `utf8` and many locales).
|
||||
|
||||
For
|
||||
additional information and Unicode resources, please visit the
|
||||
[unicode](http://www.unicode.org/) organization web page.
|
||||
|
||||
YAP currently defines and supports the following encodings:
|
||||
|
||||
+ `octet`
|
||||
Default encoding for <em>binary</em> streams. This causes
|
||||
the stream to be read and written fully untranslated.
|
||||
|
||||
+ `ascii` or `US_ASCII`
|
||||
7-bit encoding in 8-bit bytes. Equivalent to `iso_latin_1`,
|
||||
but generates errors and warnings on encountering values above
|
||||
127.
|
||||
|
||||
+ `iso_latin_1` or `ISO-8859-1`
|
||||
8-bit encoding supporting many western languages. This causes
|
||||
the stream to be read and written fully untranslated.
|
||||
|
||||
+ `text`
|
||||
C-library default locale encoding for text files. Files are read and
|
||||
written using the C-library functions `mbrtowc()` and
|
||||
`wcrtomb()`. This may be the same as one of the other locales,
|
||||
notably it may be the same as `iso_latin_1` for western
|
||||
languages and `utf8` in a UTF-8 context.
|
||||
|
||||
+ `utf8`, `iso_utf8`, or `UTF-8``
|
||||
Multi-byte encoding of the full Unicode 8, compatible to `ascii` .
|
||||
See above.
|
||||
|
||||
+ `unicode_be` or `UCS-2BE`
|
||||
Unicode Big Endian. Reads input in pairs of bytes, most
|
||||
significant byte first. Can only represent 16-bit characters.
|
||||
|
||||
+ `unicode_le` or `UCS-2LE`
|
||||
Unicode Little Endian. Reads input in pairs of bytes, least
|
||||
significant byte first. Can only represent 16-bit characters.
|
||||
|
||||
+ `utf16_le` or `UTF-16LE` (experimental)
|
||||
UTF-16 Little Endian. Reads input in pairs of bytes, least
|
||||
significant byte first. Can represent the full Unicode.
|
||||
|
||||
+ `utf16_le` or `UTF-16BE` (experimental)
|
||||
Unicode Big Endian. Reads input in pairs of bytes, least
|
||||
significant byte first. Can represent the full Unicode.
|
||||
|
||||
+ `utf32_le` or `UTF-32LE` (experimental)
|
||||
UTF-16 Little Endian. Reads input in pairs of bytes, least
|
||||
significant byte first. Can represent the full Unicode.
|
||||
|
||||
+ `utf32_le` or `UTF-32BE` (experimental)
|
||||
Unicode Big Endian. Reads input in pairs of bytes, least
|
||||
significant byte first. Can only represent 16-bit characters.
|
||||
|
||||
|
||||
Note that not all encodings can represent all characters. This implies
|
||||
that writing text to a stream may cause errors because the stream
|
||||
cannot represent these characters. The behaviour of a stream on these
|
||||
errors can be controlled using `open/4` or `set_stream/2` (not
|
||||
implemented). Initially the terminal stream write the characters using
|
||||
Prolog escape sequences while other streams generate an I/O exception.
|
||||
|
||||
|
||||
|
||||
=== @addgroup BOM BOM: Byte Order Mark
|
||||
@ingroup WideChars
|
||||
|
||||
From Stream Encoding, you may have got the impression that
|
||||
text-files are complicated. This section deals with a related topic,
|
||||
making live often easier for the user, but providing another worry to
|
||||
the programmer. *BOM* or <em>Byte Order Marker</em> is a technique
|
||||
for identifying Unicode text-files as well as the encoding they
|
||||
use. Please read the [W3C](https://www.w3.org/International/questions/qa-byte-order-mark.en.php]
|
||||
page for a detailed explanation of byte-order marks.
|
||||
|
||||
BOMa are necessary on multi-byte encodings, such as UTF-16 and UTF-32. There is a BOM for UTF-8, but it is rarely used.
|
||||
The BOM is handled by the open/4 predicate. By default, text-files are
|
||||
probed for the BOM when opened for reading. If a BOM is found, the
|
||||
encoding is set accordingly and the property `bom(true)` is
|
||||
available through stream_property/2. When opening a file for
|
||||
writing, writing a BOM can be requested using the option
|
||||
`bom(true)` with `open/4`. YAP will parse an UTF-8 file for a BOM only if explicitly required to do so. Do notice that YAP will write a BOM by default on UTF-16 (including UCS-2) and
|
||||
UTF-32; otherwise the default is not to write a BOM. BOMs are not avaliable for ASCII and
|
||||
ISO-LATIN-1.
|
||||
|
||||
= @addgroup Operators Summary of YAP Predefined Operators
|
||||
@ingroup YapSyntax
|
||||
|
||||
The Prolog syntax caters for operators of three main kinds:
|
||||
|
||||
+ prefix;
|
||||
+ infix;
|
||||
+ postfix.
|
||||
|
||||
|
||||
Each operator has precedence in the range 1 to 1200, and this
|
||||
precedence is used to disambiguate expressions where the structure of the
|
||||
term denoted is not made explicit using brackets. The operator of higher
|
||||
precedence is the main functor.
|
||||
|
||||
If there are two operators with the highest precedence, the ambiguity
|
||||
is solved analyzing the types of the operators. The possible infix types are:
|
||||
_xfx_, _xfy_, and _yfx_.
|
||||
|
||||
With an operator of type _xfx_ both sub-expressions must have lower
|
||||
precedence than the operator itself, unless they are bracketed (which
|
||||
assigns to them zero precedence). With an operator type _xfy_ only the
|
||||
left-hand sub-expression must have lower precedence. The opposite happens
|
||||
for _yfx_ type.
|
||||
|
||||
A prefix operator can be of type _fx_ or _fy_.
|
||||
A postfix operator can be of type _xf_ or _yf_.
|
||||
The meaning of the notation is analogous to the above.
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
a + b * c
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
means
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
a + (b * c)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
as + and \* have the following types and precedences:
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
:-op(500,yfx,'+').
|
||||
:-op(400,yfx,'*').
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Now defining
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
:-op(700,xfy,'++').
|
||||
:-op(700,xfx,'=:=').
|
||||
a ++ b =:= c
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
means
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
a ++ (b =:= c)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
The following is the list of the declarations of the predefined operators:
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
:-op(1200,fx,['?-', ':-']).
|
||||
:-op(1200,xfx,[':-','-->']).
|
||||
:-op(1150,fx,[block,dynamic,mode,public,multifile,meta_predicate,
|
||||
sequential,table,initialization]).
|
||||
:-op(1100,xfy,[';','|']).
|
||||
:-op(1050,xfy,->).
|
||||
:-op(1000,xfy,',').
|
||||
:-op(999,xfy,'.').
|
||||
:-op(900,fy,['\+', not]).
|
||||
:-op(900,fx,[nospy, spy]).
|
||||
:-op(700,xfx,[@>=,@=<,@<,@>,<,=,>,=:=,=\=,\==,>=,=<,==,\=,=..,is]).
|
||||
:-op(500,yfx,['\/','/\','+','-']).
|
||||
:-op(500,fx,['+','-']).
|
||||
:-op(400,yfx,['<<','>>','//','*','/']).
|
||||
:-op(300,xfx,mod).
|
||||
:-op(200,xfy,['^','**']).
|
||||
:-op(50,xfx,same).
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
@}
|
59
docs/offcanvas.css
Normal file
59
docs/offcanvas.css
Normal file
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
* Style tweaks
|
||||
* --------------------------------------------------
|
||||
*/
|
||||
html,
|
||||
body {
|
||||
overflow-x: hidden; /* Prevent scroll on narrow devices */
|
||||
}
|
||||
body {
|
||||
padding-top: 70px;
|
||||
}
|
||||
footer {
|
||||
padding: 30px 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Off Canvas
|
||||
* --------------------------------------------------
|
||||
*/
|
||||
@media screen and (max-width: 767px) {
|
||||
.row-offcanvas {
|
||||
position: relative;
|
||||
-webkit-transition: all .25s ease-out;
|
||||
-o-transition: all .25s ease-out;
|
||||
transition: all .25s ease-out;
|
||||
}
|
||||
|
||||
.row-offcanvas-right {
|
||||
right: 0;
|
||||
}
|
||||
|
||||
.row-offcanvas-left {
|
||||
left: 0;
|
||||
}
|
||||
|
||||
.row-offcanvas-right
|
||||
.sidebar-offcanvas {
|
||||
right: -50%; /* 6 columns */
|
||||
}
|
||||
|
||||
.row-offcanvas-left
|
||||
.sidebar-offcanvas {
|
||||
left: -50%; /* 6 columns */
|
||||
}
|
||||
|
||||
.row-offcanvas-right.active {
|
||||
right: 50%; /* 6 columns */
|
||||
}
|
||||
|
||||
.row-offcanvas-left.active {
|
||||
left: 50%; /* 6 columns */
|
||||
}
|
||||
|
||||
.sidebar-offcanvas {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
width: 50%; /* 6 columns */
|
||||
}
|
||||
}
|
5
docs/offcanvas.js
Normal file
5
docs/offcanvas.js
Normal file
@@ -0,0 +1,5 @@
|
||||
$(document).ready(function () {
|
||||
$('[data-toggle="offcanvas"]').click(function () {
|
||||
$('.row-offcanvas').toggleClass('active')
|
||||
});
|
||||
});
|
62
docs/pygments.css
Normal file
62
docs/pygments.css
Normal file
@@ -0,0 +1,62 @@
|
||||
.hll { background-color: #ffffcc }
|
||||
.c { color: #0099FF; font-style: italic } /* Comment */
|
||||
.err { color: #AA0000; background-color: #FFAAAA } /* Error */
|
||||
.k { color: #006699; font-weight: bold } /* Keyword */
|
||||
.o { color: #555555 } /* Operator */
|
||||
.cm { color: #0099FF; font-style: italic } /* Comment.Multiline */
|
||||
.cp { color: #009999 } /* Comment.Preproc */
|
||||
.c1 { color: #0099FF; font-style: italic } /* Comment.Single */
|
||||
.cs { color: #0099FF; font-weight: bold; font-style: italic } /* Comment.Special */
|
||||
.gd { background-color: #FFCCCC; border: 1px solid #CC0000 } /* Generic.Deleted */
|
||||
.ge { font-style: italic } /* Generic.Emph */
|
||||
.gr { color: #FF0000 } /* Generic.Error */
|
||||
.gh { color: #003300; font-weight: bold } /* Generic.Heading */
|
||||
.gi { background-color: #CCFFCC; border: 1px solid #00CC00 } /* Generic.Inserted */
|
||||
.go { color: #AAAAAA } /* Generic.Output */
|
||||
.gp { color: #000099; font-weight: bold } /* Generic.Prompt */
|
||||
.gs { font-weight: bold } /* Generic.Strong */
|
||||
.gu { color: #003300; font-weight: bold } /* Generic.Subheading */
|
||||
.gt { color: #99CC66 } /* Generic.Traceback */
|
||||
.kc { color: #006699; font-weight: bold } /* Keyword.Constant */
|
||||
.kd { color: #006699; font-weight: bold } /* Keyword.Declaration */
|
||||
.kn { color: #006699; font-weight: bold } /* Keyword.Namespace */
|
||||
.kp { color: #006699 } /* Keyword.Pseudo */
|
||||
.kr { color: #006699; font-weight: bold } /* Keyword.Reserved */
|
||||
.kt { color: #007788; font-weight: bold } /* Keyword.Type */
|
||||
.m { color: #FF6600 } /* Literal.Number */
|
||||
.s { color: #CC3300 } /* Literal.String */
|
||||
.na { color: #330099 } /* Name.Attribute */
|
||||
.nb { color: #336666 } /* Name.Builtin */
|
||||
.nc { color: #00AA88; font-weight: bold } /* Name.Class */
|
||||
.no { color: #336600 } /* Name.Constant */
|
||||
.nd { color: #9999FF } /* Name.Decorator */
|
||||
.ni { color: #999999; font-weight: bold } /* Name.Entity */
|
||||
.ne { color: #CC0000; font-weight: bold } /* Name.Exception */
|
||||
.nf { color: #CC00FF } /* Name.Function */
|
||||
.nl { color: #9999FF } /* Name.Label */
|
||||
.nn { color: #00CCFF; font-weight: bold } /* Name.Namespace */
|
||||
.nt { color: #330099; font-weight: bold } /* Name.Tag */
|
||||
.nv { color: #003333 } /* Name.Variable */
|
||||
.ow { color: #000000; font-weight: bold } /* Operator.Word */
|
||||
.w { color: #bbbbbb } /* Text.Whitespace */
|
||||
.mb { color: #FF6600 } /* Literal.Number.Bin */
|
||||
.mf { color: #FF6600 } /* Literal.Number.Float */
|
||||
.mh { color: #FF6600 } /* Literal.Number.Hex */
|
||||
.mi { color: #FF6600 } /* Literal.Number.Integer */
|
||||
.mo { color: #FF6600 } /* Literal.Number.Oct */
|
||||
.sb { color: #CC3300 } /* Literal.String.Backtick */
|
||||
.sc { color: #CC3300 } /* Literal.String.Char */
|
||||
.sd { color: #CC3300; font-style: italic } /* Literal.String.Doc */
|
||||
.s2 { color: #CC3300 } /* Literal.String.Double */
|
||||
.se { color: #CC3300; font-weight: bold } /* Literal.String.Escape */
|
||||
.sh { color: #CC3300 } /* Literal.String.Heredoc */
|
||||
.si { color: #AA0000 } /* Literal.String.Interpol */
|
||||
.sx { color: #CC3300 } /* Literal.String.Other */
|
||||
.sr { color: #33AAAA } /* Literal.String.Regex */
|
||||
.s1 { color: #CC3300 } /* Literal.String.Single */
|
||||
.ss { color: #FFCC33 } /* Literal.String.Symbol */
|
||||
.bp { color: #336666 } /* Name.Builtin.Pseudo */
|
||||
.vc { color: #003333 } /* Name.Variable.Class */
|
||||
.vg { color: #003333 } /* Name.Variable.Global */
|
||||
.vi { color: #003333 } /* Name.Variable.Instance */
|
||||
.il { color: #FF6600 } /* Literal.Number.Integer.Long */
|
@@ -33,18 +33,18 @@ from recommonmark.parser import CommonMarkParser
|
||||
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
|
||||
# ones.
|
||||
extensions = ['sphinx.ext.autodoc',
|
||||
'sphinx.ext.doctest',
|
||||
'sphinx.ext.intersphinx',
|
||||
'sphinx.ext.todo',
|
||||
'sphinx.ext.coverage',
|
||||
'sphinx.ext.mathjax',
|
||||
'sphinx.ext.ifconfig',
|
||||
'sphinx.ext.viewcode',
|
||||
'sphinx.ext.doctest',
|
||||
'sphinx.ext.intersphinx',
|
||||
'sphinx.ext.todo',
|
||||
'sphinx.ext.coverage',
|
||||
'sphinx.ext.mathjax',
|
||||
'sphinx.ext.ifconfig',
|
||||
'sphinx.ext.viewcode',
|
||||
'sphinx.ext.githubpages',
|
||||
'breathe'
|
||||
]
|
||||
|
||||
breathe_projects = { "yap": "../../build/docs/xml" }
|
||||
breathe_projects = { "yap": "/home/vsc/github/yap-6.3/docs/xml" }
|
||||
breathe_default_project = "yap"
|
||||
|
||||
# Add any paths that contain templates here, relative to this directory.
|
||||
@@ -92,7 +92,7 @@ pygments_style = 'sphinx'
|
||||
todo_include_todos = True
|
||||
|
||||
source_parsers = {
|
||||
'.md': 'recommonmark.parser.CommonMarkParser',
|
||||
'.md': 'recommonmark.parser.CommonMarkParser',
|
||||
}
|
||||
# -- Options for HTML output ----------------------------------------------
|
||||
|
||||
|
18
docs/theme.css
Normal file
18
docs/theme.css
Normal file
@@ -0,0 +1,18 @@
|
||||
body {
|
||||
padding-top: 70px;
|
||||
padding-bottom: 30px;
|
||||
}
|
||||
|
||||
.theme-dropdown .dropdown-menu {
|
||||
position: static;
|
||||
display: block;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.theme-showcase > p > .btn {
|
||||
margin: 5px 0;
|
||||
}
|
||||
|
||||
.theme-showcase .navbar .container {
|
||||
width: auto;
|
||||
}
|
9
docs/yap.css
Normal file
9
docs/yap.css
Normal file
@@ -0,0 +1,9 @@
|
||||
body { padding-top: 100px; }
|
||||
|
||||
/* set a max-width for horizontal fluid layout and make it centered */
|
||||
.container-fluid {
|
||||
margin-right: auto;
|
||||
margin-left: auto;
|
||||
max-width: 1600px; /* or 950px */
|
||||
}
|
||||
|
Reference in New Issue
Block a user