Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Frank McCabe
committed
Dec 3, 2015
0 parents
commit ee02ac0
Showing
1,053 changed files
with
327,556 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
Makefile | ||
Makefile.in | ||
go.spec | ||
config.cache | ||
config.h | ||
config.log | ||
config.status | ||
configure | ||
libtool | ||
stamp-h | ||
stamp-h1 | ||
go.Make | ||
config.h.in | ||
aclocal.m4 | ||
go*.rpm | ||
go*.tgz | ||
config.guess | ||
config.sub | ||
.DS_Store | ||
.gdb_history | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
This is build by F.G.McCabe. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
/agent.gh/1.1.1.1/Sat Aug 2 22:16:13 2003// | ||
/agent.go/1.1.1.1/Sat Aug 2 22:16:13 2003// | ||
/contract.gh/1.1.1.1/Sat Aug 2 22:16:13 2003// | ||
/interpret.gh/1.1.1.1/Sat Aug 2 22:16:13 2003// | ||
/interpret.go/1.1.1.1/Sat Aug 2 22:16:13 2003// | ||
D |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
go/Agent |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
:ext:fmccabe@cvs.sourceforge.net:/cvsroot/networkagent |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/* | ||
Header files for agent | ||
(c) 1994-2001 Imperial College and F.G. McCabe | ||
|
||
This program is free software; you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation; either version 2 of the License, or | ||
(at your option) any later version. | ||
|
||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
|
||
You should have received a copy of the GNU General Public License | ||
along with this program; if not, write to the Free Software | ||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
|
||
Contact: Francis McCabe <fgm@fla.fujitsu.com> | ||
*/ | ||
|
||
|
||
callterm::= male(symbol) | female(symbol) | | ||
parent(symbol,symbol) | age(symbol,number) | | ||
ancestor(symbol,symbol) | likes(symbol,symbol). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,133 @@ | ||
/* | ||
A contract driven agent | ||
(c) 1994-2001 Imperial College and F.G. McCabe | ||
This program is free software; you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation; either version 2 of the License, or | ||
(at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with this program; if not, write to the Free Software | ||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
Contact: Francis McCabe <fgm@fla.fujitsu.com> | ||
*/ | ||
|
||
|
||
main .. { | ||
|
||
query(CT) ::= askone(T1,Goal(CT)) | askall(T1,Goal(CT)) . | ||
|
||
updateReq(T) ::= addcl(clause(T)) | | ||
delcl(clause(T)) | addfact(T) | delfact(T) . | ||
|
||
|
||
callterm::= male(symbol) | female(symbol) | | ||
parent(symbol,symbol) | age(symbol,number) | | ||
ancestor(symbol,symbol) | likes(symbol,symbol). | ||
|
||
|
||
Male = dynamic_facts([male('k'),male('t'),male('f'),male('st')]). | ||
|
||
Female =dynamic_facts([female('s'),female('m'),female('a')]). | ||
|
||
Parent = dynamic_facts([ | ||
parent('am','k'),parent('l','k'),parent('k','t'),parent('s','t'), | ||
parent('k','a'),parent('s','a'), | ||
parent('f','st'),parent('m','st')]). | ||
|
||
Ancestor= dynamic_clauses([cl(ancestor(A,D),?+(parent(A,D))), | ||
cl(ancestor(A,D), &(?+(parent(P,D)),?+(ancestor(A,P))))], | ||
eval). | ||
|
||
|
||
|
||
Age = dynamic_facts([ | ||
age('am',85),age('l',88),age('k',50),age('s',48),age('f',43), | ||
age('m',40),age('a',4),age('t',6),age('st',1)]). | ||
|
||
Likes= dynamic_clauses( | ||
[cl(likes('k',P),?+(parent('k',P))), | ||
cl(likes(P,'a'),TRUE)], | ||
eval). | ||
|
||
evalc(male(P)):-call(Male,male(P)). | ||
evalc(female(P)):-call(Female,female(P)). | ||
evalc(parent(P,C)):-call(Parent,parent(P,C)). | ||
evalc(age(P,Ag)):-call(Age,age(P,Ag)). | ||
evalc(ancestor(A,D)):-call(Ancestor,ancestor(A,D)). | ||
evalc(likes(P1,P2)):- call(Likes,likes(P1,P2)). | ||
|
||
eval=evalgen(evalc). | ||
|
||
|
||
|
||
|
||
addFact(male(X)) -> add(Male,male(X)); | ||
displayVal("After adding\n",X); | ||
displayVal("Male list is:\n",{P||evalc(male(P))}). | ||
|
||
|
||
addFact(female(X)) -> add(Female,female(X)). | ||
addFact(parent(X,Y)) -> add(Parent,parent(X,Y)). | ||
|
||
addClause(cl(likes(P,T),Bdy)) -> add(Likes,cl(likes(P,T),Bdy)). | ||
|
||
delFact(male(X)) -> del(Male,male(X)); | ||
displayVal("After deleting\n",X); | ||
displayVal("Male list is:\n",{P||evalc(male(P))}). | ||
delFact(female(X)) -> del(Female,female(X)). | ||
delFact(parent(X,Y)) -> del(Parent,parent(X,Y)). | ||
|
||
delClause(cl(likes(X,Y),Bdy)) -> del(Likes,cl(likes(X,Y),Bdy)). | ||
|
||
|
||
askQuery(S,Q) -> displayVal("Query is:\n",Q); | ||
Q>>S; Ans << S; displayVal("Answer is:\n",Ans). | ||
|
||
displayVal(Mess,Val) -> Mess <> Val^0 <> "\n\n" >> stdout. | ||
|
||
queryserver() -> | ||
( | ||
addfact(ft) << _ -> addFact(ft) | ||
| delfact(ft) << _ -> delFact(ft) | ||
| addcl(Cl) << _ -> addClause(Cl) | ||
| delcl(Cl) << _ -> delClause(Cl) | ||
| askone(A,Q) << C -> (eval(Q)? A >> C | fail >> C) | ||
| askall(A,Q) << C -> | ||
displayVal("Received1:\n",(A,Q)); | ||
{A || eval(Q)} >> C | ||
| M << S -> ("Rejected message",M) >> S | ||
); | ||
queryserver(). | ||
|
||
test()-> | ||
addFact(male('bill'));delFact(male('k')); | ||
spawn { "Entered spawned client\n" >> stdout; | ||
delfact(male('st')) >> creator; | ||
addcl(cl(likes(P,'apples'),?+(likes(P,'pears'))))>>creator; | ||
addcl(cl(likes('k','pears'),TRUE))>>creator; | ||
|
||
askQuery(creator,askall(P,or(?+(male(P)),?+(female(P))))); | ||
|
||
askQuery(creator,'hello'); | ||
askQuery(creator,askall((M,A), | ||
& (?+(male(M)), &( ?+(age(M,A)), ?\+(parent(M,_)))))); | ||
|
||
askQuery(creator,askall((D,A2),& (?+(ancestor('am',D)), | ||
?+(age(D,A2))))); | ||
|
||
askQuery(creator,askall((P1,P2),?+(likes(P1,P2)))); | ||
delcl(cl(likes(P,'a'),TRUE))>> creator; | ||
askQuery(creator,askone((P1,P2),?+(likes(P1,P2)))); | ||
askQuery(creator,askall((P1,P2),?+(likes(P1,P2)))); | ||
}; | ||
queryserver(); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* | ||
Header files for contract module | ||
(c) 1994-2001 Imperial College and F.G. McCabe | ||
|
||
This program is free software; you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation; either version 2 of the License, or | ||
(at your option) any later version. | ||
|
||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
|
||
You should have received a copy of the GNU General Public License | ||
along with this program; if not, write to the Free Software | ||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
|
||
Contact: Francis McCabe <fgm@fla.fujitsu.com> | ||
*/ | ||
|
||
condition(OT) ::= pred(Goal(OT)) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/* | ||
The Go agent content language (GACL) definition | ||
(c) 1994-2001 Imperial College and F.G. McCabe | ||
|
||
This program is free software; you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation; either version 2 of the License, or | ||
(at your option) any later version. | ||
|
||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
|
||
You should have received a copy of the GNU General Public License | ||
along with this program; if not, write to the Free Software | ||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
|
||
Contact: Francis McCabe <fgm@fla.fujitsu.com> | ||
*/ | ||
|
||
/* This gives us the logical framework for expressible contracts */ | ||
|
||
-- An agent's name has no structure | ||
|
||
agent ::= aId(symbol). | ||
|
||
-- Content expressions | ||
|
||
propForm(CT,AT,ST) ::= or(propForm(CT,AT,ST),propForm(CT,AT,ST)) | | ||
&(propForm(CT,AT,ST),propForm(CT,AT,ST)) | | ||
not(propForm(CT,AT,ST)) | | ||
?+(CT) | ?\+(CT) | ?=(T,T) | ?\=(T,T) | | ||
gt(T,T) | lt(T,T) | TRUE | | ||
md(modal(CT,AT,ST)). | ||
|
||
-- A rule is either a logical rule or a modal rule | ||
|
||
rule(CT,AT,ST) ::= rl(CT,propForm(CT,AT,ST)) | cl(modal(CT,AT,ST),propForm(CT,AT,ST)). | ||
|
||
-- modal conditions are somewhat different from regular predicates | ||
|
||
modal(CT,AT,ST) ::= -- CT is a content ontology, AT an action ontology and ST a social ontology | ||
allowed(ST,agent,AT) | obliged(ST,agent,AT) | -- deontic operators | ||
feasable(agent,AT) | done(agent,time,AT) | -- action operators | ||
authorized(ST,agent,propForm(CT,AT,ST)) | entitled(ST,agent,propForm(CT,AT,ST)) -- societal operators. | ||
|
||
-- Communicative Acts | ||
|
||
caForm(CT,AT,ST) ::= inform(propForm(CT,AT,ST)) | pronounce(ST,propForm(CT,AT,ST)) | | ||
request(propForm(CT,AT,ST) | commit(agent,rule(CT,AT,ST)[]). | ||
|
||
-- Contracts are sets of rules | ||
|
||
cTract(CT,AT,ST) ::= contract(rule(CT,AT,ST)[]). | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
/* | ||
Interpret & manage logic expressions | ||
(c) 1994-2001 Imperial College and F.G. McCabe | ||
This program is free software; you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation; either version 2 of the License, or | ||
(at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with this program; if not, write to the Free Software | ||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
Contact: Francis McCabe <fgm@fla.fujitsu.com> | ||
*/ | ||
|
||
(dynamic_facts,dynamic_clauses,call,cls,add,addz,del,evalgen)..{ | ||
include "sys:go/stdlib.gof". | ||
include "interpret.gh". | ||
|
||
call((Call,_,_,_,_),C):-Call(C). | ||
cls((_,Cls,_,_,_),Hd,Cl):-Cls(Hd,Cl). | ||
add((_,_,Add,_,_),Cl)->Add(Cl). | ||
addz((_,_,_,Addz,_),Cl)->Addz(Cl). | ||
del((_,_,_,_,Del),Cl)->Del(Cl). | ||
|
||
dynamic_facts(Init) => | ||
(call,cls,add,addz,del)..{ | ||
|
||
FsList:=Init. | ||
|
||
add(F) -> FsList := [F,..FsList]. | ||
addz(F) -> FsList := FsList <> [F]. | ||
|
||
del(F):: remove(F,FsList,NewFsList) -> FsList := NewFsList. | ||
del(_) -> {}. | ||
|
||
call(F) :- F in FsList. | ||
|
||
cls(Hd,TRUE):- Hd in FsList | ||
}. | ||
|
||
dynamic_clauses(Init,eval) => | ||
(call,cls,add,addz,del)..{ | ||
|
||
ClsList:=Init. | ||
|
||
add(Cl) -> ClsList := [Cl,..ClsList]. | ||
|
||
addz(Cl) -> ClsList := ClsList <> [Cl]. | ||
|
||
del(Cl)::remove(Cl,ClsList,NewClsList) -> ClsList := NewClsList. | ||
del(_) -> {}. | ||
|
||
call(C) :- cls(C,Bdy),eval(Bdy). | ||
|
||
cls(Hd,Bdy):- cl(FrHd,FrBdy) in ClsList, | ||
thaw((FrHd,FrBdy))=(Hd,Bdy) | ||
}. | ||
|
||
evalgen(evalc)=>eval..{ | ||
eval(TRUE). | ||
eval(?=(X,Y)):-X=Y. | ||
eval(?\=(X,Y)):- \+X=Y. | ||
eval(?+(Call)):- evalc(Call). | ||
eval(?\+(Call)):- \+ evalc(Call). | ||
eval(not(Q)) :- \+ eval(Q). | ||
eval(&(Q1,Q2)):-eval(Q1),eval(Q2). | ||
eval(or(Q1,Q2)):-eval(Q1). | ||
eval(or(Q1,Q2)):-eval(Q2). | ||
|
||
evalall([]). | ||
evalall([Call,..Calls]) :- evalc(Call),evalall(Calls) | ||
}. | ||
|
||
remove(X,[X,..L],L). | ||
remove(X,[U,..L],[U,..RL]):-remove(X,L,RL). | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
Makefile | ||
Makefile.in | ||
*.aam | ||
*.af | ||
*.goc | ||
*.gf | ||
*.gof | ||
esc.ap | ||
mnem.ap | ||
ecode.ap | ||
ops.ap | ||
instr.ah | ||
trace | ||
*~ | ||
*.o | ||
instr | ||
mnem | ||
esccode | ||
esc | ||
ops | ||
ntrace | ||
.deps | ||
.libs | ||
.gdb_history | ||
goc | ||
go.Make |
Oops, something went wrong.