Logtalk 2.30.2 files.
git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@1908 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
================================================================
|
||||
Logtalk - Open source object-oriented logic programming language
|
||||
Release 2.30.1
|
||||
Release 2.30.2
|
||||
|
||||
Copyright (c) 1998-2007 Paulo Moura. All Rights Reserved.
|
||||
================================================================
|
||||
@@ -35,6 +35,17 @@ objects and categories:
|
||||
bypass
|
||||
using the {} DCG construct together with the {} Logtalk control
|
||||
construct
|
||||
tokenizer
|
||||
natural language tokenizer example
|
||||
macaddr
|
||||
validator for MAC addresses
|
||||
morse
|
||||
decoder for Morse code messages; illustrate how to use scope
|
||||
directives to declare grammar rule non-terminals
|
||||
|
||||
This folder contains an example ("tokenizer") adopted with permission from
|
||||
a Michael A. Covington example (http://www.ai.uga.edu/~mc/). See the file
|
||||
"tokenizer.lgt" for more details.
|
||||
|
||||
This folder contains two examples of DCGs ("bom" and "faa") adopted with
|
||||
permission from the Amzi! Prolog documentation. The documentation is
|
||||
|
@@ -1,6 +1,6 @@
|
||||
================================================================
|
||||
Logtalk - Open source object-oriented logic programming language
|
||||
Release 2.30.1
|
||||
Release 2.30.2
|
||||
|
||||
Copyright (c) 1998-2007 Paulo Moura. All Rights Reserved.
|
||||
================================================================
|
||||
@@ -20,13 +20,21 @@ Result = -9
|
||||
yes
|
||||
|
||||
|
||||
% Recognize MAC addresses:
|
||||
% recognize MAC addresses:
|
||||
|
||||
| ?- macaddr::valid("00:1e:4a:ef:72:8b").
|
||||
|
||||
yes
|
||||
|
||||
|
||||
% decode Morse code messages:
|
||||
|
||||
?- morse::phrase(morse(Message), "... --- ...").
|
||||
|
||||
Message = [sos]
|
||||
yes
|
||||
|
||||
|
||||
% solve a cellphone keypad encoded enigma:
|
||||
|
||||
| ?- enigma::solve("4 96853 5683 86 4283 346637 9484 968 8664448", Message).
|
||||
|
@@ -7,7 +7,6 @@
|
||||
date is 2006/01/22,
|
||||
comment is 'Example of using DCG rules to decrypt a enigma where words are made of numbers corresponding to the characters on a cellphone keypad.']).
|
||||
|
||||
:- public(solve/2).
|
||||
:- public(solve/2).
|
||||
:- mode(solve(+string, -list(atom)), zero_or_one).
|
||||
:- info(solve/2, [
|
||||
|
@@ -7,6 +7,7 @@
|
||||
parsetree,
|
||||
sentences,
|
||||
tokenizer,
|
||||
morse,
|
||||
macaddr,
|
||||
url,
|
||||
xml,
|
||||
|
86
Logtalk/examples/dcgs/morse.lgt
Normal file
86
Logtalk/examples/dcgs/morse.lgt
Normal file
@@ -0,0 +1,86 @@
|
||||
|
||||
:- object(morse).
|
||||
|
||||
:- info([
|
||||
version is 1.0,
|
||||
author is 'Paulo Moura',
|
||||
date is 2007/06/14,
|
||||
comment is 'Morse code decoder.']).
|
||||
|
||||
:- public(morse//1).
|
||||
:- mode(morse(-list(atom)), zero_or_one).
|
||||
:- info(morse//1, [
|
||||
comment is 'Recognizes a message in Morse code, returning the corresponding list of words.',
|
||||
argnames is ['Words']]).
|
||||
|
||||
morse([Word| Words]) --> word(Characters), {atom_chars(Word, Characters)}, " ", morse(Words).
|
||||
morse([Word]) --> word(Characters), {atom_chars(Word, Characters)}.
|
||||
|
||||
word([Character| Characters]) --> character(LM), {code(Character, LM)}, " ", word(Characters).
|
||||
word([Character]) --> character(Symbols), {code(Character, Symbols)}.
|
||||
|
||||
character([Symbol| Symbols]) --> symbol([Symbol]), character(Symbols).
|
||||
character([Symbol]) --> symbol([Symbol]).
|
||||
|
||||
symbol(".") --> ".".
|
||||
symbol("-") --> "-".
|
||||
|
||||
code(a, ".-").
|
||||
code(b, "-...").
|
||||
code(c, "-.-.").
|
||||
code(d, "-..").
|
||||
code(e, ".").
|
||||
code(f, "..-.").
|
||||
code(g, "--.").
|
||||
code(h, "....").
|
||||
code(i, "..").
|
||||
code(j, ".---").
|
||||
code(k, "-.-").
|
||||
code(l, ".-..").
|
||||
code(m, "--").
|
||||
code(n, "-.").
|
||||
code(o, "---").
|
||||
code(p, ".--.").
|
||||
code(q, "--.-").
|
||||
code(r, ".-.").
|
||||
code(s, "...").
|
||||
code(t, "-").
|
||||
code(u, "..-").
|
||||
code(v, "...-").
|
||||
code(w, ".--").
|
||||
code(x, "-..-").
|
||||
code(y, "-.--").
|
||||
code(z, "--..").
|
||||
|
||||
code('1', ".----").
|
||||
code('2', "..---").
|
||||
code('3', "...--").
|
||||
code('4', "....-").
|
||||
code('5', ".....").
|
||||
code('6', "-....").
|
||||
code('7', "--...").
|
||||
code('8', "---..").
|
||||
code('9', "----.").
|
||||
code('0', "-----").
|
||||
|
||||
code('.', ".-.-.-").
|
||||
code(',', "--..--").
|
||||
code('?', "..--..").
|
||||
code('''', ".----.").
|
||||
code('!', "-.-.--").
|
||||
%code('!', "— — — ·").
|
||||
code('/', "-..-.").
|
||||
code('(', "-.--.").
|
||||
code(')', "-.--.-").
|
||||
code('&', ".-...").
|
||||
code(':', "---...").
|
||||
code(';', "-.-.-.").
|
||||
code('=', "-...-").
|
||||
code('+', ".-.-.").
|
||||
code('-', "-....-").
|
||||
code('_', "..--.-").
|
||||
code('"', ".-..-.").
|
||||
code('$', "...-..-").
|
||||
code('@', ".--.-").
|
||||
|
||||
:- end_object.
|
Reference in New Issue
Block a user