-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsetOperationsTest.js
36 lines (30 loc) · 954 Bytes
/
setOperationsTest.js
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
if (typeof(module) !== 'undefined') {
var rhs = require('./rhs.js').rhs;
var automata = require('./automata.js').automata;
}
console.log("A u B");
a = new rhs("(abc)")
b = new rhs("(def)")
console.log(rhs.union(a, b).toString());
console.log("------------\n");
console.log("A u B u A");
console.log(rhs.union(a, b, a).toString());
console.log("------------\n");
console.log("A n B");
a = new rhs("[a-e]*fg");
b = new rhs("bfg");
//c = rhs.intersect(a, b);
//c.automata.printDigraph()
console.log(rhs.intersect(a, b).toString());
console.log("------------\n");
console.log("A n B\'");
a = new rhs("ab")
b = new rhs("[d-f]*")
console.log(rhs.intersect(a, rhs.complement(b)).toString());
console.log("------------\n");
console.log("B\'\'")
b = new rhs("[b-d]")
c = rhs.complement(rhs.complement("abc"))
console.log(c.toString())
//console.log(automata.complement(automata.complement(automata.fromRE("[b-z]"))).toRE());
console.log("------------\n");