-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprolog.html
More file actions
48 lines (40 loc) · 1.36 KB
/
prolog.html
File metadata and controls
48 lines (40 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Prolog Interpreter</title>
<link rel="stylesheet"
href="//cdn.rawgit.com/milligram/milligram/master/dist/milligram.min.css">
<style>
textarea { width: 100%; height: 200px; }
input[type=text] { width: 90% }
#rules, #query, #answers { font-family: monospace; }
.error { color: red; }
</style>
</head>
<body>
<h1>Prolog Interpreter</h1>
<h2>Rules</h2>
<textarea id="rules">
father_child(massimo, ridge).
father_child(eric, thorne).
father_child(thorne, alexandria).
mother_child(stephanie, thorne).
mother_child(stephanie, kristen).
mother_child(stephanie, felicia).
parent_child(X, Y) :- father_child(X, Y).
parent_child(X, Y) :- mother_child(X, Y).
sibling(X, Y) :- parent_child(Z, X), parent_child(Z, Y).
ancestor(X, Y) :- parent_child(X, Y).
ancestor(X, Y) :- parent_child(X, Z), ancestor(Z, Y).
</textarea>
<h2>Query</h2>
<input type="text" id="query" value="sibling(X, felicia)">
<input type="submit" id="ask" value="Ask">
<h2>Answers</h2>
<ul id="answers"></ul>
<script src="prolog.dart.js"></script>
<script async src="https://www.googletagmanager.com/gtag/js?id=G-QK0KCHXW3F"></script>
<script>window.dataLayer = window.dataLayer || [];function gtag(){dataLayer.push(arguments);}gtag('js', new Date());gtag('config', 'G-QK0KCHXW3F');</script>
</body>
</html>