Did you know ... Search Documentation:
Pack logtalk -- logtalk-3.77.0/examples/dcgs/NOTES.md

This file is part of Logtalk https://logtalk.org/ SPDX-FileCopyrightText: 1998-2023 Paulo Moura <pmoura@logtalk.org> SPDX-License-Identifier: Apache-2.0

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

To load this example and for sample queries, please see the SCRIPT.txt file.

This folder contains the following examples of using DCGs in objects and categories:

[99, 97, 108, 99, 117, 108, 97, 116, 111, 114]
canonical DCG example of parsing arithmetic expressions
[101, 110, 105, 103, 109, 97]
solve a cellphone enigma against a dictionary of words
[98, 111, 109]
bill of materials DCG example (see below for original source)
[115, 101, 110, 116, 101, 110, 99, 101, 115]
simple parsing of natural language sentences
[112, 97, 114, 115, 101, 116, 114, 101, 101]
same as above but building and returning the parse tree
[120, 109, 108]
conversion between XML and Prolog terms
[117, 114, 108]
parsing of URLs, decomposing them in components
[115, 104, 101, 108, 108]
parsing of command-line shell commands
[102, 97, 97]
command language DCG example (see below for original source)
[119, 97, 108, 107, 101, 114]
parsing of walker movements and calculation of distance travelled
[98, 121, 112, 97, 115, 115]
using the {}/1 DCG construct together with the {}/1 Logtalk control construct
[116, 111, 107, 101, 110, 105, 122, 101, 114]
natural language tokenizer example
[109, 97, 99, 97, 100, 100, 114]
validator for MAC hardware addresses
[109, 111, 114, 115, 101]
decoder for Morse code messages; illustrate how to use scope directives to declare grammar rule non-terminals
[105, 98, 97, 110]
IBAN validation; this example can generate very large integers during validation and thus may not work with all backend Prolog compilers
[108, 97, 109, 98, 100, 97, 115]
example of using lambda expressions in grammar rules

This folder includes an example, tokenizer, adapted with permission from a Michael A. Covington example:

http://www.ai.uga.edu/~mc/

See the file tokenizer.lgt for more details.

This folder also includes two examples of DCGs, bom and faa, adapted with permission from the Amzi! Prolog documentation. The documentation is available on-line in HTML format at the URL:

http://www.amzi.com/

Please refer to the Amzi! Prolog documentation for more information on the original examples.