mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-10-29 17:50:22 +00:00
Update prolog samples
This commit is contained in:
@@ -319,6 +319,10 @@
|
|||||||
"Processing": [
|
"Processing": [
|
||||||
".pde"
|
".pde"
|
||||||
],
|
],
|
||||||
|
"Prolog": [
|
||||||
|
".pl",
|
||||||
|
".prolog"
|
||||||
|
],
|
||||||
"Protocol Buffer": [
|
"Protocol Buffer": [
|
||||||
".proto"
|
".proto"
|
||||||
],
|
],
|
||||||
@@ -519,8 +523,8 @@
|
|||||||
".gemrc"
|
".gemrc"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"tokens_total": 439417,
|
"tokens_total": 439684,
|
||||||
"languages_total": 511,
|
"languages_total": 513,
|
||||||
"tokens": {
|
"tokens": {
|
||||||
"ABAP": {
|
"ABAP": {
|
||||||
"*/**": 1,
|
"*/**": 1,
|
||||||
@@ -38586,6 +38590,56 @@
|
|||||||
"PI": 1,
|
"PI": 1,
|
||||||
"TWO_PI": 1
|
"TWO_PI": 1
|
||||||
},
|
},
|
||||||
|
"Prolog": {
|
||||||
|
"-": 38,
|
||||||
|
"male": 3,
|
||||||
|
"(": 29,
|
||||||
|
"john": 2,
|
||||||
|
")": 29,
|
||||||
|
".": 17,
|
||||||
|
"peter": 3,
|
||||||
|
"female": 2,
|
||||||
|
"vick": 2,
|
||||||
|
"christie": 3,
|
||||||
|
"parents": 4,
|
||||||
|
"brother": 1,
|
||||||
|
"X": 3,
|
||||||
|
"Y": 2,
|
||||||
|
"F": 2,
|
||||||
|
"M": 2,
|
||||||
|
"turing": 1,
|
||||||
|
"Tape0": 2,
|
||||||
|
"Tape": 2,
|
||||||
|
"perform": 4,
|
||||||
|
"q0": 1,
|
||||||
|
"[": 12,
|
||||||
|
"]": 12,
|
||||||
|
"Ls": 12,
|
||||||
|
"Rs": 16,
|
||||||
|
"reverse": 1,
|
||||||
|
"Ls1": 4,
|
||||||
|
"append": 1,
|
||||||
|
"qf": 1,
|
||||||
|
"Q0": 2,
|
||||||
|
"Ls0": 6,
|
||||||
|
"Rs0": 6,
|
||||||
|
"symbol": 3,
|
||||||
|
"Sym": 6,
|
||||||
|
"RsRest": 2,
|
||||||
|
"once": 1,
|
||||||
|
"rule": 1,
|
||||||
|
"Q1": 2,
|
||||||
|
"NewSym": 2,
|
||||||
|
"Action": 2,
|
||||||
|
"action": 4,
|
||||||
|
"|": 7,
|
||||||
|
"Rs1": 2,
|
||||||
|
"b": 2,
|
||||||
|
"left": 4,
|
||||||
|
"stay": 1,
|
||||||
|
"right": 1,
|
||||||
|
"L": 2
|
||||||
|
},
|
||||||
"Protocol Buffer": {
|
"Protocol Buffer": {
|
||||||
"package": 1,
|
"package": 1,
|
||||||
"tutorial": 1,
|
"tutorial": 1,
|
||||||
@@ -46930,6 +46984,7 @@
|
|||||||
"PostScript": 107,
|
"PostScript": 107,
|
||||||
"PowerShell": 12,
|
"PowerShell": 12,
|
||||||
"Processing": 74,
|
"Processing": 74,
|
||||||
|
"Prolog": 267,
|
||||||
"Protocol Buffer": 63,
|
"Protocol Buffer": 63,
|
||||||
"Python": 5715,
|
"Python": 5715,
|
||||||
"R": 175,
|
"R": 175,
|
||||||
@@ -47068,6 +47123,7 @@
|
|||||||
"PostScript": 1,
|
"PostScript": 1,
|
||||||
"PowerShell": 2,
|
"PowerShell": 2,
|
||||||
"Processing": 1,
|
"Processing": 1,
|
||||||
|
"Prolog": 2,
|
||||||
"Protocol Buffer": 1,
|
"Protocol Buffer": 1,
|
||||||
"Python": 7,
|
"Python": 7,
|
||||||
"R": 2,
|
"R": 2,
|
||||||
@@ -47111,5 +47167,5 @@
|
|||||||
"Xtend": 2,
|
"Xtend": 2,
|
||||||
"YAML": 1
|
"YAML": 1
|
||||||
},
|
},
|
||||||
"md5": "3969c4c97eb1dc3e7063e0478775dd9a"
|
"md5": "2418026a91f287eda7faac9b75d06236"
|
||||||
}
|
}
|
||||||
12
samples/Prolog/test-prolog.prolog
Normal file
12
samples/Prolog/test-prolog.prolog
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
-/* Prolog test file */
|
||||||
|
-male(john).
|
||||||
|
-male(peter).
|
||||||
|
-
|
||||||
|
-female(vick).
|
||||||
|
-female(christie).
|
||||||
|
-
|
||||||
|
-parents(john, peter, christie).
|
||||||
|
-parents(vick, peter, christie).
|
||||||
|
-
|
||||||
|
-/* X is a brother of Y */
|
||||||
|
-brother(X, Y) :- male(X), parents(X, F, M), parents(Y, F, M).
|
||||||
21
samples/Prolog/turing.pl
Normal file
21
samples/Prolog/turing.pl
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
-turing(Tape0, Tape) :-
|
||||||
|
- perform(q0, [], Ls, Tape0, Rs),
|
||||||
|
- reverse(Ls, Ls1),
|
||||||
|
- append(Ls1, Rs, Tape).
|
||||||
|
-
|
||||||
|
-perform(qf, Ls, Ls, Rs, Rs) :- !.
|
||||||
|
-perform(Q0, Ls0, Ls, Rs0, Rs) :-
|
||||||
|
- symbol(Rs0, Sym, RsRest),
|
||||||
|
- once(rule(Q0, Sym, Q1, NewSym, Action)),
|
||||||
|
- action(Action, Ls0, Ls1, [NewSym|RsRest], Rs1),
|
||||||
|
- perform(Q1, Ls1, Ls, Rs1, Rs).
|
||||||
|
-
|
||||||
|
-symbol([], b, []).
|
||||||
|
-symbol([Sym|Rs], Sym, Rs).
|
||||||
|
-
|
||||||
|
-action(left, Ls0, Ls, Rs0, Rs) :- left(Ls0, Ls, Rs0, Rs).
|
||||||
|
-action(stay, Ls, Ls, Rs, Rs).
|
||||||
|
-action(right, Ls0, [Sym|Ls0], [Sym|Rs], Rs).
|
||||||
|
-
|
||||||
|
-left([], [], Rs0, [b|Rs0]).
|
||||||
|
-left([L|Ls], Ls, Rs, [L|Rs]).
|
||||||
Reference in New Issue
Block a user