diff --git a/lib/c3/0.1/c3.facts b/lib/c3/0.1/c3.facts
index 442dce4..3027711 100644
--- a/lib/c3/0.1/c3.facts
+++ b/lib/c3/0.1/c3.facts
@@ -1,33 +1,72 @@
%{module: C3.Facts.Dump,
- version: 1,
- count: 27}
-{C3, :is_a, :module}
-{C3, :name, "C3"}
-{C3, :path, "c3.facts"}
-{C3, :symbol, C3.+}
-{C3, :symbol, C3.-}
-{C3, :symbol, C3.*}
-{C3, :symbol, C3./}
-{C3, :symbol, C3.break}
-{C3, :symbol, C3.first}
-{C3.+, :cfn, cfn :tag "tag_add" (:tag, :tag, :&result)}
-{C3.+, :is_a, :operator}
-{C3.+, :operator_precedence, 1}
-{C3.+, :operator_associativity, :left}
-{C3.-, :cfn, cfn :tag "tag_sub" (:tag, :tag, :&result)}
-{C3.-, :is_a, :operator}
-{C3.-, :operator_precedence, 1}
-{C3.-, :operator_associativity, :left}
-{C3.*, :cfn, cfn :tag "tag_mul" (:tag, :tag, :&result)}
-{C3.*, :is_a, :operator}
-{C3.*, :operator_precedence, 2}
-{C3.*, :operator_associativity, :left}
-{C3./, :cfn, cfn :tag "tag_div" (:tag, :tag, :&result)}
-{C3./, :is_a, :operator}
-{C3./, :operator_precedence, 2}
-{C3./, :operator_associativity, :left}
-{C3.break, :cfn, cfn :void "c3_break" ()}
-{C3.first, :fn, fn {
+ version: 1}
+add {C3, :is_a, :module}
+add {C3, :name, "C3"}
+add {C3, :path, "c3.facts"}
+add {C3, :symbol, C3.!}
+add {C3, :symbol, C3.&&}
+add {C3, :symbol, C3.*}
+add {C3, :symbol, C3.+}
+add {C3, :symbol, C3.-}
+add {C3, :symbol, C3./}
+add {C3, :symbol, C3.<=}
+add {C3, :symbol, C3.<}
+add {C3, :symbol, C3.==}
+add {C3, :symbol, C3.>=}
+add {C3, :symbol, C3.>}
+add {C3, :symbol, C3.break}
+add {C3, :symbol, C3.first}
+add {C3, :symbol, C3.||}
+add {C3.+, :cfn, cfn :tag "tag_add" (:tag, :tag, :&result)}
+add {C3.+, :is_a, :operator}
+add {C3.+, :operator_precedence, 1}
+add {C3.+, :operator_associativity, :left}
+add {C3.-, :cfn, cfn :tag "tag_sub" (:tag, :tag, :&result)}
+add {C3.-, :is_a, :operator}
+add {C3.-, :operator_precedence, 1}
+add {C3.-, :operator_associativity, :left}
+add {C3.*, :cfn, cfn :tag "tag_mul" (:tag, :tag, :&result)}
+add {C3.*, :is_a, :operator}
+add {C3.*, :operator_precedence, 2}
+add {C3.*, :operator_associativity, :left}
+add {C3./, :cfn, cfn :tag "tag_div" (:tag, :tag, :&result)}
+add {C3./, :is_a, :operator}
+add {C3./, :operator_precedence, 2}
+add {C3./, :operator_associativity, :left}
+add {C3.<, :cfn, cfn :bool "tag_lt" (:tag, :tag)}
+add {C3.<, :is_a, :operator}
+add {C3.<, :operator_precedence, 3}
+add {C3.<, :operator_associativity, :left}
+add {C3.<=, :cfn, cfn :bool "tag_lte" (:tag, :tag)}
+add {C3.<=, :is_a, :operator}
+add {C3.<=, :operator_precedence, 3}
+add {C3.<=, :operator_associativity, :left}
+add {C3.==, :cfn, cfn :bool "tag_eq" (:tag, :tag)}
+add {C3.==, :is_a, :operator}
+add {C3.==, :operator_precedence, 3}
+add {C3.==, :operator_associativity, :left}
+add {C3.>=, :cfn, cfn :bool "tag_gte" (:tag, :tag)}
+add {C3.>=, :is_a, :operator}
+add {C3.>=, :operator_precedence, 3}
+add {C3.>=, :operator_associativity, :left}
+add {C3.>, :cfn, cfn :bool "tag_gt" (:tag, :tag)}
+add {C3.>, :is_a, :operator}
+add {C3.>, :operator_precedence, 3}
+add {C3.>, :operator_associativity, :left}
+add {C3.!, :cfn, cfn :bool "tag_not" (:tag)}
+add {C3.!, :is_a, :operator}
+add {C3.!, :operator_precedence, 4}
+add {C3.!, :operator_associativity, :left}
+add {C3.&&, :cfn, cfn :bool "tag_and" (:tag, :tag)}
+add {C3.&&, :is_a, :operator}
+add {C3.&&, :operator_precedence, 4}
+add {C3.&&, :operator_associativity, :left}
+add {C3.||, :cfn, cfn :bool "tag_or" (:tag, :tag)}
+add {C3.||, :is_a, :operator}
+add {C3.||, :operator_precedence, 4}
+add {C3.||, :operator_associativity, :left}
+add {C3.break, :cfn, cfn :void "c3_break" ()}
+add {C3.first, :fn, fn {
((a | _b)) { a }
({a, _b}) { a }
({a, _b, _c}) { a }
diff --git a/libc3/buf_parse.c b/libc3/buf_parse.c
index 89494ea..521ac2f 100644
--- a/libc3/buf_parse.c
+++ b/libc3/buf_parse.c
@@ -535,6 +535,8 @@ sw buf_parse_call_op (s_buf *buf, s_call *dest)
s_buf_save save;
assert(buf);
assert(dest);
+ if ((r = buf_parse_call_op_unary(buf, dest)) > 0)
+ return r;
buf_save_init(buf, &save);
call_init_op(&tmp);
if ((r = buf_parse_tag_primary(buf, &tmp.arguments->tag)) <= 0)
@@ -651,6 +653,38 @@ sw buf_parse_call_op_rec (s_buf *buf, s_call *dest, u8 min_precedence)
return r;
}
+sw buf_parse_call_op_unary (s_buf *buf, s_call *dest)
+{
+ sw r;
+ sw result = 0;
+ s_buf_save save;
+ s_call tmp;
+ assert(buf);
+ assert(dest);
+ call_init_op_unary(&tmp);
+ buf_save_init(buf, &save);
+ if ((r = buf_parse_ident(buf, &tmp.ident)) <= 0)
+ goto restore;
+ result += r;
+ if (! operator_is_unary(&tmp.ident))
+ goto restore;
+ if ((r = buf_ignore_spaces(buf)) < 0)
+ goto restore;
+ result += r;
+ if ((r = buf_parse_tag_primary(buf, &tmp.arguments->tag)) <= 0)
+ goto restore;
+ result += r;
+ *dest = tmp;
+ r = result;
+ goto clean;
+ restore:
+ buf_save_restore_rpos(buf, &save);
+ call_clean(&tmp);
+ clean:
+ buf_save_clean(buf, &save);
+ return r;
+}
+
sw buf_parse_cfn (s_buf *buf, s_cfn *dest)
{
s_list *arg_types = NULL;
diff --git a/libc3/buf_parse.h b/libc3/buf_parse.h
index 2090264..64a01a1 100644
--- a/libc3/buf_parse.h
+++ b/libc3/buf_parse.h
@@ -49,6 +49,7 @@ sw buf_parse_call (s_buf *buf, s_call *dest);
sw buf_parse_call_args_paren (s_buf *buf, s_call *dest);
sw buf_parse_call_op (s_buf *buf, s_call *dest);
sw buf_parse_call_op_rec (s_buf *buf, s_call *dest, u8 min_precedence);
+sw buf_parse_call_op_unary (s_buf *buf, s_call *dest);
sw buf_parse_cfn (s_buf *buf, s_cfn *dest);
sw buf_parse_character (s_buf *buf, character *dest);
sw buf_parse_comments (s_buf *buf);
diff --git a/libc3/call.c b/libc3/call.c
index 6dc03ec..d304f9c 100644
--- a/libc3/call.c
+++ b/libc3/call.c
@@ -61,6 +61,14 @@ s_call * call_init_op (s_call *call)
return call;
}
+s_call * call_init_op_unary (s_call *call)
+{
+ assert(call);
+ bzero(call, sizeof(s_call));
+ call->arguments = list_new(NULL, NULL);
+ return call;
+}
+
s_str * call_inspect (const s_call *call, s_str *dest)
{
sw size;
diff --git a/libc3/call.h b/libc3/call.h
index 1da05c5..aefa9e4 100644
--- a/libc3/call.h
+++ b/libc3/call.h
@@ -19,6 +19,7 @@ void call_clean (s_call *call);
s_call * call_init (s_call *call);
s_call * call_init_1 (s_call *call, const s8 *p);
s_call * call_init_op (s_call *call);
+s_call * call_init_op_unary (s_call *call);
s_call * call_copy (const s_call *src, s_call *dest);
s_str * call_inspect (const s_call *call, s_str *dest);
diff --git a/libc3/env.c b/libc3/env.c
index a89d95e..322dda7 100644
--- a/libc3/env.c
+++ b/libc3/env.c
@@ -558,6 +558,29 @@ bool env_operator_is_right_associative (s_env *env, const s_ident *op)
return r;
}
+bool env_operator_is_unary(s_env *env, const s_ident *op)
+{
+ s_facts_with_cursor cursor;
+ s8 r;
+ s_tag tag_ident;
+ s_tag tag_arity;
+ s_tag tag_one;
+ s_ident tmp;
+ assert(env);
+ assert(op);
+ tmp = *op;
+ ident_resolve_module(&tmp, env);
+ tag_init_ident(&tag_ident, &tmp);
+ tag_init_1( &tag_arity, ":arity");
+ tag_init_1( &tag_one, "1");
+ facts_with(&env->facts, &cursor, (t_facts_spec) {
+ &tag_ident, &tag_arity, &tag_one,
+ NULL, NULL });
+ r = facts_with_cursor_next(&cursor) ? true : false;
+ facts_with_cursor_clean(&cursor);
+ return r;
+}
+
s8 env_operator_precedence (s_env *env, const s_ident *op)
{
s_facts_with_cursor cursor;
diff --git a/libc3/env.h b/libc3/env.h
index 0e438ba..3d56159 100644
--- a/libc3/env.h
+++ b/libc3/env.h
@@ -46,6 +46,7 @@ s_module * env_module_load (s_env *env, s_module *module,
const s_sym *name, s_facts *facts);
bool env_operator_is_right_associative (s_env *env,
const s_ident *op);
+bool env_operator_is_unary(s_env *env, const s_ident *op);
s8 env_operator_precedence (s_env *env,
const s_ident *op);
diff --git a/libc3/facts.c b/libc3/facts.c
index 726fe1f..82bfb3e 100644
--- a/libc3/facts.c
+++ b/libc3/facts.c
@@ -109,7 +109,6 @@ sw facts_dump (s_facts *facts, s_buf *buf)
sw r;
sw result = 0;
s_tag subject;
- u64 u;
assert(facts);
assert(buf);
tag_init_var(&subject);
@@ -117,29 +116,24 @@ sw facts_dump (s_facts *facts, s_buf *buf)
tag_init_var(&object);
if ((r = buf_write_1(buf,
"%{module: C3.Facts.Dump,\n"
- " version: 1,\n"
- " count: ")) < 0)
+ " version: 1}\n")) < 0)
return r;
result += r;
facts_lock_r(facts);
- u = facts_count(facts);
- if ((r = buf_inspect_u64(buf, &u)) < 0)
- goto ko;
- result += r;
- if ((r = buf_write_1(buf, "}\n")) < 0)
- goto ko;
- result += r;
facts_with_0(facts, &cursor, &subject, &predicate, &object);
while ((fact = facts_cursor_next(&cursor))) {
+ if ((r = buf_write_1(buf, "add ")) < 0)
+ goto clean;
+ result += r;
if ((r = buf_inspect_fact(buf, fact)) < 0)
- goto ko;
+ goto clean;
result += r;
if ((r = buf_write_1(buf, "\n")) < 0)
- goto ko;
+ goto clean;
result += r;
}
r = result;
- ko:
+ clean:
facts_lock_unlock_r(facts);
return r;
}
@@ -217,28 +211,22 @@ s_facts * facts_init (s_facts *facts)
sw facts_load (s_facts *facts, s_buf *buf, const s_str *path)
{
- u64 count;
s_fact_w fact;
s_fact *factp;
- u64 i;
+ u64 line;
sw r;
sw result = 0;
assert(facts);
assert(buf);
if ((r = buf_read_1(buf,
"%{module: C3.Facts.Dump,\n"
- " version: 1,\n"
- " count: ")) <= 0)
- goto ko_header;
- result += r;
- if ((r = buf_parse_u64(buf, &count)) <= 0)
- goto ko_header;
- result += r;
- if ((r = buf_read_1(buf, "}\n")) <= 0)
+ " version: 1}\n")) <= 0)
goto ko_header;
result += r;
facts_lock_w(facts);
- for (i = 0; i < count; i++) {
+ line = 3;
+ while ((r = buf_read_1(buf, "add ")) > 0) {
+ result += r;
if ((r = buf_parse_fact(buf, &fact)) <= 0)
goto ko_fact;
result += r;
@@ -250,9 +238,9 @@ sw facts_load (s_facts *facts, s_buf *buf, const s_str *path)
goto ko_fact;
}
result += r;
+ line++;
}
facts_lock_unlock_w(facts);
- i++;
return result;
ko_header:
warnx("facts_load: %s: invalid or missing header",
@@ -263,7 +251,7 @@ sw facts_load (s_facts *facts, s_buf *buf, const s_str *path)
warnx("facts_load: %s: %s fact line %lu",
path->ptr.ps8,
r ? "invalid" : "missing",
- (unsigned long) i + 5);
+ (unsigned long) line);
return -1;
}
@@ -396,14 +384,6 @@ sw facts_open_buf (s_facts *facts, s_buf *buf, const s_str *path)
{
sw r;
sw result = 0;
- if ((r = buf_read_1(buf,
- "%{module: C3.Facts.Save,\n"
- " version: 1}\n")) <= 0) {
- warnx("facts_open_buf: %s: invalid or missing header",
- path->ptr.ps8);
- return -1;
- }
- result += r;
if ((r = facts_load(facts, buf, path)) <= 0)
return r;
result += r;
@@ -461,9 +441,6 @@ sw facts_open_file_create (s_facts *facts, const s_str *path)
}
out = buf_new_alloc(BUF_SIZE);
buf_file_open_w(out, fp);
- if ((r = facts_save_header(out)) < 0)
- return r;
- result += r;
if ((r = facts_dump(facts, out)) < 0)
return r;
result += r;
@@ -563,9 +540,6 @@ sw facts_save_file (s_facts *facts, const s8 *path)
return -1;
}
buf_file_open_w(&buf, fp);
- if ((r = facts_save_header(&buf)) < 0)
- goto ko;
- result += r;
if ((r = facts_dump(facts, &buf)) < 0)
goto ko;
result += r;
@@ -582,18 +556,6 @@ sw facts_save_file (s_facts *facts, const s8 *path)
return r;
}
-sw facts_save_header (s_buf *buf)
-{
- sw r;
- sw result = 0;
- if ((r = buf_write_1(buf,
- "%{module: C3.Facts.Save,\n"
- " version: 1}\n")) < 0)
- return r;
- result += r;
- return result;
-}
-
e_bool facts_unref_tag (s_facts *facts, const s_tag *tag)
{
s_set_item__tag *item;
diff --git a/libc3/facts.h b/libc3/facts.h
index ed2bb76..8186081 100644
--- a/libc3/facts.h
+++ b/libc3/facts.h
@@ -56,6 +56,5 @@ s_fact * facts_find_fact (s_facts *facts, const s_fact *fact);
s_tag * facts_find_tag (s_facts *facts, const s_tag *tag);
sw facts_log_add (s_log *log, const s_fact *fact);
sw facts_log_remove (s_log *log, const s_fact *fact);
-sw facts_save_header (s_buf *buf);
#endif /* FACTS_H */
diff --git a/libc3/hash.c b/libc3/hash.c
index 816464e..dc51eb5 100644
--- a/libc3/hash.c
+++ b/libc3/hash.c
@@ -161,6 +161,7 @@ void hash_update_ident (t_hash *hash, const s_ident *ident)
assert(hash);
assert(ident);
hash_update_u8(hash, '_');
+ hash_update_sym(hash, ident->module_name);
hash_update_sym(hash, ident->sym);
}
diff --git a/libc3/ident.c b/libc3/ident.c
index e2aceeb..e2d655b 100644
--- a/libc3/ident.c
+++ b/libc3/ident.c
@@ -28,7 +28,6 @@ e_bool ident_character_is_reserved (character c)
c == ';' ||
c == '[' ||
c == ']' ||
- c == '|' ||
c == '{' ||
c == '}');
}
diff --git a/libc3/operator.c b/libc3/operator.c
index a59c3ac..7fcbf28 100644
--- a/libc3/operator.c
+++ b/libc3/operator.c
@@ -18,6 +18,11 @@ bool operator_is_right_associative (const s_ident *op)
return env_operator_is_right_associative(&g_c3_env, op);
}
+bool operator_is_unary (const s_ident *op)
+{
+ return env_operator_is_unary(&g_c3_env, op);
+}
+
s8 operator_precedence (const s_ident *op)
{
return env_operator_precedence(&g_c3_env, op);
diff --git a/libc3/operator.h b/libc3/operator.h
index 8ffb2e3..fee1fa2 100644
--- a/libc3/operator.h
+++ b/libc3/operator.h
@@ -17,6 +17,7 @@
/* Observers */
bool operator_is_right_associative (const s_ident *op);
+bool operator_is_unary (const s_ident *op);
s8 operator_precedence (const s_ident *op);
#endif /* OPERATOR_H */
diff --git a/libc3/sym.c b/libc3/sym.c
index cbfa817..9fb1bc2 100644
--- a/libc3/sym.c
+++ b/libc3/sym.c
@@ -162,7 +162,8 @@ ffi_type * sym_to_ffi_type (const s_sym *sym, ffi_type *result_type)
return &ffi_type_sint;
if (sym == sym_1("tag"))
return &ffi_type_pointer;
- if (sym == sym_1("u8"))
+ if (sym == sym_1("u8") ||
+ sym == sym_1("bool"))
return &ffi_type_uint8;
if (sym == sym_1("u16"))
return &ffi_type_uint16;
diff --git a/libc3/tag.c b/libc3/tag.c
index 33ff5ac..c182a47 100644
--- a/libc3/tag.c
+++ b/libc3/tag.c
@@ -291,6 +291,13 @@ s_tag * tag_add (const s_tag *a, const s_tag *b, s_tag *dest)
tag_type_to_string(b->type));
}
+bool tag_and (const s_tag *a, const s_tag *b)
+{
+ s_tag f;
+ tag_init_1(&f, "false");
+ return compare_tag(a, &f) != 0 && compare_tag(b, &f) != 0;
+}
+
s_tag * tag_array (s_tag *tag, const s_array *a)
{
assert(tag);
@@ -753,6 +760,11 @@ s_tag * tag_div (const s_tag *a, const s_tag *b, s_tag *dest)
tag_type_to_string(b->type));
}
+bool tag_eq (const s_tag *a, const s_tag *b)
+{
+ return compare_tag(a, b) == 0;
+}
+
s_tag * tag_f32 (s_tag *tag, f32 x)
{
assert(tag);
@@ -767,6 +779,16 @@ s_tag * tag_f64 (s_tag *tag, f64 x)
return tag_init_f64(tag, x);
}
+bool tag_gt (const s_tag *a, const s_tag *b)
+{
+ return compare_tag(a, b) > 0;
+}
+
+bool tag_gte (const s_tag *a, const s_tag *b)
+{
+ return compare_tag(a, b) >= 0;
+}
+
u64 tag_hash_u64 (const s_tag *tag)
{
t_hash hash;
@@ -1194,6 +1216,16 @@ s_tag * tag_list_1 (s_tag *tag, const s8 *p)
return tag_init_list_1(tag, p);
}
+bool tag_lt (const s_tag *a, const s_tag *b)
+{
+ return compare_tag(a, b) < 0;
+}
+
+bool tag_lte (const s_tag *a, const s_tag *b)
+{
+ return compare_tag(a, b) <= 0;
+}
+
s_tag * tag_mul (const s_tag *a, const s_tag *b, s_tag *dest)
{
assert(a);
@@ -1490,6 +1522,20 @@ s_tag * tag_new_copy (const s_tag *src)
return tag_copy(src, dest);
}
+bool tag_not (const s_tag *a)
+{
+ s_tag f;
+ tag_init_1(&f, "false");
+ return compare_tag(a, &f) == 0;
+}
+
+bool tag_or (const s_tag *a, const s_tag *b)
+{
+ s_tag f;
+ tag_init_1(&f, "false");
+ return compare_tag(a, &f) != 0 || compare_tag(b, &f) != 0;
+}
+
s_tag * tag_s8 (s_tag *tag, s8 x)
{
assert(tag);
diff --git a/test/facts_test.c b/test/facts_test.c
index 3af999b..c1ecef8 100644
--- a/test/facts_test.c
+++ b/test/facts_test.c
@@ -258,7 +258,7 @@ TEST_CASE(facts_load)
s_str path;
facts_init(&facts);
str_init_1(&path, NULL, "facts_test_load_file.facts");
- TEST_EQ(facts_load_file(&facts, &path), 681);
+ TEST_EQ(facts_load_file(&facts, &path), 760);
TEST_EQ(facts_count(&facts), 23);
while (p[i]) {
fact_test_init_1(&fact, p[i]);
@@ -467,7 +467,7 @@ TEST_CASE(facts_open_file)
errx(1, "%s:%i: cp", __FILE__, __LINE__);
facts_init(&facts);
str_init_1(&path, NULL, "facts_test_open_file.1.facts");
- TEST_EQ(facts_open_file(&facts, &path), 720);
+ TEST_EQ(facts_open_file(&facts, &path), 760);
TEST_EQ(facts_count(&facts), 23);
i = 0;
while (p[i]) {
@@ -497,7 +497,7 @@ TEST_CASE(facts_open_file)
if (r > 0)
errx(1, "%s:%i: cp", __FILE__, __LINE__);
str_init_1(&path, NULL, "facts_test_open_file.2.facts");
- TEST_EQ(facts_open_file(&facts, &path), 1453);
+ TEST_EQ(facts_open_file(&facts, &path), 1493);
TEST_EQ(facts_count(&facts), 46);
i = 0;
while (p[i]) {
@@ -525,7 +525,7 @@ TEST_CASE(facts_open_file)
if (r > 0)
errx(1, "%s:%i: cp", __FILE__, __LINE__);
str_init_1(&path, NULL, "facts_test_open_file.3.facts");
- TEST_EQ(facts_open_file(&facts, &path), 1510);
+ TEST_EQ(facts_open_file(&facts, &path), 1550);
TEST_EQ(facts_count(&facts), 0);
i = 0;
while (p[i]) {
diff --git a/test/facts_test_dump_file.expected.facts b/test/facts_test_dump_file.expected.facts
index c9313c8..cd38dd2 100644
--- a/test/facts_test_dump_file.expected.facts
+++ b/test/facts_test_dump_file.expected.facts
@@ -1,26 +1,25 @@
%{module: C3.Facts.Dump,
- version: 1,
- count: 23}
-{a, a, a}
-{-18446744073709551616, -18446744073709551616, -18446744073709551616}
-{18446744073709551616, 18446744073709551616, 18446744073709551616}
-{-4294967296, -4294967296, -4294967296}
-{-65536, -65536, -65536}
-{-256, -256, -256}
-{-10, -10, -10}
-{-1, -1, -1}
-{0, 0, 0}
-{1, 1, 1}
-{10, 10, 10}
-{256, 256, 256}
-{65536, 65536, 65536}
-{4294967296, 4294967296, 4294967296}
-{(), (), ()}
-{((), ()), ((), ()), ((), ())}
-{"a", "a", "a"}
-{A, A, A}
-{:a, :a, :a}
-{{a, b}, {a, b}, {a, b}}
-{{:a, :b}, {:a, :b}, {:a, :b}}
-{{{a, b}, {c, d}}, {{a, b}, {c, d}}, {{a, b}, {c, d}}}
-{{{:a, :b}, {:c, :d}}, {{:a, :b}, {:c, :d}}, {{:a, :b}, {:c, :d}}}
+ version: 1}
+add {a, a, a}
+add {-18446744073709551616, -18446744073709551616, -18446744073709551616}
+add {18446744073709551616, 18446744073709551616, 18446744073709551616}
+add {-4294967296, -4294967296, -4294967296}
+add {-65536, -65536, -65536}
+add {-256, -256, -256}
+add {-10, -10, -10}
+add {-1, -1, -1}
+add {0, 0, 0}
+add {1, 1, 1}
+add {10, 10, 10}
+add {256, 256, 256}
+add {65536, 65536, 65536}
+add {4294967296, 4294967296, 4294967296}
+add {(), (), ()}
+add {((), ()), ((), ()), ((), ())}
+add {"a", "a", "a"}
+add {A, A, A}
+add {:a, :a, :a}
+add {{a, b}, {a, b}, {a, b}}
+add {{:a, :b}, {:a, :b}, {:a, :b}}
+add {{{a, b}, {c, d}}, {{a, b}, {c, d}}, {{a, b}, {c, d}}}
+add {{{:a, :b}, {:c, :d}}, {{:a, :b}, {:c, :d}}, {{:a, :b}, {:c, :d}}}
diff --git a/test/facts_test_load_file.facts b/test/facts_test_load_file.facts
index c9313c8..cd38dd2 100644
--- a/test/facts_test_load_file.facts
+++ b/test/facts_test_load_file.facts
@@ -1,26 +1,25 @@
%{module: C3.Facts.Dump,
- version: 1,
- count: 23}
-{a, a, a}
-{-18446744073709551616, -18446744073709551616, -18446744073709551616}
-{18446744073709551616, 18446744073709551616, 18446744073709551616}
-{-4294967296, -4294967296, -4294967296}
-{-65536, -65536, -65536}
-{-256, -256, -256}
-{-10, -10, -10}
-{-1, -1, -1}
-{0, 0, 0}
-{1, 1, 1}
-{10, 10, 10}
-{256, 256, 256}
-{65536, 65536, 65536}
-{4294967296, 4294967296, 4294967296}
-{(), (), ()}
-{((), ()), ((), ()), ((), ())}
-{"a", "a", "a"}
-{A, A, A}
-{:a, :a, :a}
-{{a, b}, {a, b}, {a, b}}
-{{:a, :b}, {:a, :b}, {:a, :b}}
-{{{a, b}, {c, d}}, {{a, b}, {c, d}}, {{a, b}, {c, d}}}
-{{{:a, :b}, {:c, :d}}, {{:a, :b}, {:c, :d}}, {{:a, :b}, {:c, :d}}}
+ version: 1}
+add {a, a, a}
+add {-18446744073709551616, -18446744073709551616, -18446744073709551616}
+add {18446744073709551616, 18446744073709551616, 18446744073709551616}
+add {-4294967296, -4294967296, -4294967296}
+add {-65536, -65536, -65536}
+add {-256, -256, -256}
+add {-10, -10, -10}
+add {-1, -1, -1}
+add {0, 0, 0}
+add {1, 1, 1}
+add {10, 10, 10}
+add {256, 256, 256}
+add {65536, 65536, 65536}
+add {4294967296, 4294967296, 4294967296}
+add {(), (), ()}
+add {((), ()), ((), ()), ((), ())}
+add {"a", "a", "a"}
+add {A, A, A}
+add {:a, :a, :a}
+add {{a, b}, {a, b}, {a, b}}
+add {{:a, :b}, {:a, :b}, {:a, :b}}
+add {{{a, b}, {c, d}}, {{a, b}, {c, d}}, {{a, b}, {c, d}}}
+add {{{:a, :b}, {:c, :d}}, {{:a, :b}, {:c, :d}}, {{:a, :b}, {:c, :d}}}
diff --git a/test/facts_test_open_file.1.expected.facts b/test/facts_test_open_file.1.expected.facts
index 26b031d..ad96522 100644
--- a/test/facts_test_open_file.1.expected.facts
+++ b/test/facts_test_open_file.1.expected.facts
@@ -1,31 +1,28 @@
-%{module: C3.Facts.Save,
- version: 1}
%{module: C3.Facts.Dump,
- version: 1,
- count: 23}
-{a, a, a}
-{-18446744073709551616, -18446744073709551616, -18446744073709551616}
-{18446744073709551616, 18446744073709551616, 18446744073709551616}
-{-4294967296, -4294967296, -4294967296}
-{-65536, -65536, -65536}
-{-256, -256, -256}
-{-10, -10, -10}
-{-1, -1, -1}
-{0, 0, 0}
-{1, 1, 1}
-{10, 10, 10}
-{256, 256, 256}
-{65536, 65536, 65536}
-{4294967296, 4294967296, 4294967296}
-{(), (), ()}
-{((), ()), ((), ()), ((), ())}
-{"a", "a", "a"}
-{A, A, A}
-{:a, :a, :a}
-{{a, b}, {a, b}, {a, b}}
-{{:a, :b}, {:a, :b}, {:a, :b}}
-{{{a, b}, {c, d}}, {{a, b}, {c, d}}, {{a, b}, {c, d}}}
-{{{:a, :b}, {:c, :d}}, {{:a, :b}, {:c, :d}}, {{:a, :b}, {:c, :d}}}
+ version: 1}
+add {a, a, a}
+add {-18446744073709551616, -18446744073709551616, -18446744073709551616}
+add {18446744073709551616, 18446744073709551616, 18446744073709551616}
+add {-4294967296, -4294967296, -4294967296}
+add {-65536, -65536, -65536}
+add {-256, -256, -256}
+add {-10, -10, -10}
+add {-1, -1, -1}
+add {0, 0, 0}
+add {1, 1, 1}
+add {10, 10, 10}
+add {256, 256, 256}
+add {65536, 65536, 65536}
+add {4294967296, 4294967296, 4294967296}
+add {(), (), ()}
+add {((), ()), ((), ()), ((), ())}
+add {"a", "a", "a"}
+add {A, A, A}
+add {:a, :a, :a}
+add {{a, b}, {a, b}, {a, b}}
+add {{:a, :b}, {:a, :b}, {:a, :b}}
+add {{{a, b}, {c, d}}, {{a, b}, {c, d}}, {{a, b}, {c, d}}}
+add {{{:a, :b}, {:c, :d}}, {{:a, :b}, {:c, :d}}, {{:a, :b}, {:c, :d}}}
remove {"a", "a", "a"}
remove {:a, :a, :a}
remove {A, A, A}
diff --git a/test/facts_test_open_file.1.in.facts b/test/facts_test_open_file.1.in.facts
index fd5bd92..cd38dd2 100644
--- a/test/facts_test_open_file.1.in.facts
+++ b/test/facts_test_open_file.1.in.facts
@@ -1,28 +1,25 @@
-%{module: C3.Facts.Save,
- version: 1}
%{module: C3.Facts.Dump,
- version: 1,
- count: 23}
-{a, a, a}
-{-18446744073709551616, -18446744073709551616, -18446744073709551616}
-{18446744073709551616, 18446744073709551616, 18446744073709551616}
-{-4294967296, -4294967296, -4294967296}
-{-65536, -65536, -65536}
-{-256, -256, -256}
-{-10, -10, -10}
-{-1, -1, -1}
-{0, 0, 0}
-{1, 1, 1}
-{10, 10, 10}
-{256, 256, 256}
-{65536, 65536, 65536}
-{4294967296, 4294967296, 4294967296}
-{(), (), ()}
-{((), ()), ((), ()), ((), ())}
-{"a", "a", "a"}
-{A, A, A}
-{:a, :a, :a}
-{{a, b}, {a, b}, {a, b}}
-{{:a, :b}, {:a, :b}, {:a, :b}}
-{{{a, b}, {c, d}}, {{a, b}, {c, d}}, {{a, b}, {c, d}}}
-{{{:a, :b}, {:c, :d}}, {{:a, :b}, {:c, :d}}, {{:a, :b}, {:c, :d}}}
+ version: 1}
+add {a, a, a}
+add {-18446744073709551616, -18446744073709551616, -18446744073709551616}
+add {18446744073709551616, 18446744073709551616, 18446744073709551616}
+add {-4294967296, -4294967296, -4294967296}
+add {-65536, -65536, -65536}
+add {-256, -256, -256}
+add {-10, -10, -10}
+add {-1, -1, -1}
+add {0, 0, 0}
+add {1, 1, 1}
+add {10, 10, 10}
+add {256, 256, 256}
+add {65536, 65536, 65536}
+add {4294967296, 4294967296, 4294967296}
+add {(), (), ()}
+add {((), ()), ((), ()), ((), ())}
+add {"a", "a", "a"}
+add {A, A, A}
+add {:a, :a, :a}
+add {{a, b}, {a, b}, {a, b}}
+add {{:a, :b}, {:a, :b}, {:a, :b}}
+add {{{a, b}, {c, d}}, {{a, b}, {c, d}}, {{a, b}, {c, d}}}
+add {{{:a, :b}, {:c, :d}}, {{:a, :b}, {:c, :d}}, {{:a, :b}, {:c, :d}}}
diff --git a/test/facts_test_open_file.2.expected.facts b/test/facts_test_open_file.2.expected.facts
index bd9dd81..f1449ea 100644
--- a/test/facts_test_open_file.2.expected.facts
+++ b/test/facts_test_open_file.2.expected.facts
@@ -1,31 +1,28 @@
-%{module: C3.Facts.Save,
- version: 1}
%{module: C3.Facts.Dump,
- version: 1,
- count: 23}
-{a, a, a}
-{-18446744073709551616, -18446744073709551616, -18446744073709551616}
-{18446744073709551616, 18446744073709551616, 18446744073709551616}
-{-4294967296, -4294967296, -4294967296}
-{-65536, -65536, -65536}
-{-256, -256, -256}
-{-10, -10, -10}
-{-1, -1, -1}
-{0, 0, 0}
-{1, 1, 1}
-{10, 10, 10}
-{256, 256, 256}
-{65536, 65536, 65536}
-{4294967296, 4294967296, 4294967296}
-{(), (), ()}
-{((), ()), ((), ()), ((), ())}
-{"a", "a", "a"}
-{A, A, A}
-{:a, :a, :a}
-{{a, b}, {a, b}, {a, b}}
-{{:a, :b}, {:a, :b}, {:a, :b}}
-{{{a, b}, {c, d}}, {{a, b}, {c, d}}, {{a, b}, {c, d}}}
-{{{:a, :b}, {:c, :d}}, {{:a, :b}, {:c, :d}}, {{:a, :b}, {:c, :d}}}
+ version: 1}
+add {a, a, a}
+add {-18446744073709551616, -18446744073709551616, -18446744073709551616}
+add {18446744073709551616, 18446744073709551616, 18446744073709551616}
+add {-4294967296, -4294967296, -4294967296}
+add {-65536, -65536, -65536}
+add {-256, -256, -256}
+add {-10, -10, -10}
+add {-1, -1, -1}
+add {0, 0, 0}
+add {1, 1, 1}
+add {10, 10, 10}
+add {256, 256, 256}
+add {65536, 65536, 65536}
+add {4294967296, 4294967296, 4294967296}
+add {(), (), ()}
+add {((), ()), ((), ()), ((), ())}
+add {"a", "a", "a"}
+add {A, A, A}
+add {:a, :a, :a}
+add {{a, b}, {a, b}, {a, b}}
+add {{:a, :b}, {:a, :b}, {:a, :b}}
+add {{{a, b}, {c, d}}, {{a, b}, {c, d}}, {{a, b}, {c, d}}}
+add {{{:a, :b}, {:c, :d}}, {{:a, :b}, {:c, :d}}, {{:a, :b}, {:c, :d}}}
add {b, b, b}
add {-18446744073709551617, -18446744073709551617, -18446744073709551617}
add {18446744073709551617, 18446744073709551617, 18446744073709551617}
diff --git a/test/facts_test_open_file.2.in.facts b/test/facts_test_open_file.2.in.facts
index bd9dd81..f1449ea 100644
--- a/test/facts_test_open_file.2.in.facts
+++ b/test/facts_test_open_file.2.in.facts
@@ -1,31 +1,28 @@
-%{module: C3.Facts.Save,
- version: 1}
%{module: C3.Facts.Dump,
- version: 1,
- count: 23}
-{a, a, a}
-{-18446744073709551616, -18446744073709551616, -18446744073709551616}
-{18446744073709551616, 18446744073709551616, 18446744073709551616}
-{-4294967296, -4294967296, -4294967296}
-{-65536, -65536, -65536}
-{-256, -256, -256}
-{-10, -10, -10}
-{-1, -1, -1}
-{0, 0, 0}
-{1, 1, 1}
-{10, 10, 10}
-{256, 256, 256}
-{65536, 65536, 65536}
-{4294967296, 4294967296, 4294967296}
-{(), (), ()}
-{((), ()), ((), ()), ((), ())}
-{"a", "a", "a"}
-{A, A, A}
-{:a, :a, :a}
-{{a, b}, {a, b}, {a, b}}
-{{:a, :b}, {:a, :b}, {:a, :b}}
-{{{a, b}, {c, d}}, {{a, b}, {c, d}}, {{a, b}, {c, d}}}
-{{{:a, :b}, {:c, :d}}, {{:a, :b}, {:c, :d}}, {{:a, :b}, {:c, :d}}}
+ version: 1}
+add {a, a, a}
+add {-18446744073709551616, -18446744073709551616, -18446744073709551616}
+add {18446744073709551616, 18446744073709551616, 18446744073709551616}
+add {-4294967296, -4294967296, -4294967296}
+add {-65536, -65536, -65536}
+add {-256, -256, -256}
+add {-10, -10, -10}
+add {-1, -1, -1}
+add {0, 0, 0}
+add {1, 1, 1}
+add {10, 10, 10}
+add {256, 256, 256}
+add {65536, 65536, 65536}
+add {4294967296, 4294967296, 4294967296}
+add {(), (), ()}
+add {((), ()), ((), ()), ((), ())}
+add {"a", "a", "a"}
+add {A, A, A}
+add {:a, :a, :a}
+add {{a, b}, {a, b}, {a, b}}
+add {{:a, :b}, {:a, :b}, {:a, :b}}
+add {{{a, b}, {c, d}}, {{a, b}, {c, d}}, {{a, b}, {c, d}}}
+add {{{:a, :b}, {:c, :d}}, {{:a, :b}, {:c, :d}}, {{:a, :b}, {:c, :d}}}
add {b, b, b}
add {-18446744073709551617, -18446744073709551617, -18446744073709551617}
add {18446744073709551617, 18446744073709551617, 18446744073709551617}
diff --git a/test/facts_test_open_file.3.expected.facts b/test/facts_test_open_file.3.expected.facts
index 609d6eb..903f90d 100644
--- a/test/facts_test_open_file.3.expected.facts
+++ b/test/facts_test_open_file.3.expected.facts
@@ -1,31 +1,28 @@
-%{module: C3.Facts.Save,
- version: 1}
%{module: C3.Facts.Dump,
- version: 1,
- count: 23}
-{a, a, a}
-{-18446744073709551616, -18446744073709551616, -18446744073709551616}
-{18446744073709551616, 18446744073709551616, 18446744073709551616}
-{-4294967296, -4294967296, -4294967296}
-{-65536, -65536, -65536}
-{-256, -256, -256}
-{-10, -10, -10}
-{-1, -1, -1}
-{0, 0, 0}
-{1, 1, 1}
-{10, 10, 10}
-{256, 256, 256}
-{65536, 65536, 65536}
-{4294967296, 4294967296, 4294967296}
-{(), (), ()}
-{((), ()), ((), ()), ((), ())}
-{"a", "a", "a"}
-{A, A, A}
-{:a, :a, :a}
-{{a, b}, {a, b}, {a, b}}
-{{:a, :b}, {:a, :b}, {:a, :b}}
-{{{a, b}, {c, d}}, {{a, b}, {c, d}}, {{a, b}, {c, d}}}
-{{{:a, :b}, {:c, :d}}, {{:a, :b}, {:c, :d}}, {{:a, :b}, {:c, :d}}}
+ version: 1}
+add {a, a, a}
+add {-18446744073709551616, -18446744073709551616, -18446744073709551616}
+add {18446744073709551616, 18446744073709551616, 18446744073709551616}
+add {-4294967296, -4294967296, -4294967296}
+add {-65536, -65536, -65536}
+add {-256, -256, -256}
+add {-10, -10, -10}
+add {-1, -1, -1}
+add {0, 0, 0}
+add {1, 1, 1}
+add {10, 10, 10}
+add {256, 256, 256}
+add {65536, 65536, 65536}
+add {4294967296, 4294967296, 4294967296}
+add {(), (), ()}
+add {((), ()), ((), ()), ((), ())}
+add {"a", "a", "a"}
+add {A, A, A}
+add {:a, :a, :a}
+add {{a, b}, {a, b}, {a, b}}
+add {{:a, :b}, {:a, :b}, {:a, :b}}
+add {{{a, b}, {c, d}}, {{a, b}, {c, d}}, {{a, b}, {c, d}}}
+add {{{:a, :b}, {:c, :d}}, {{:a, :b}, {:c, :d}}, {{:a, :b}, {:c, :d}}}
remove {a, a, a}
remove {-18446744073709551616, -18446744073709551616, -18446744073709551616}
remove {18446744073709551616, 18446744073709551616, 18446744073709551616}
diff --git a/test/facts_test_open_file.3.in.facts b/test/facts_test_open_file.3.in.facts
index 2b80171..6215c21 100644
--- a/test/facts_test_open_file.3.in.facts
+++ b/test/facts_test_open_file.3.in.facts
@@ -1,31 +1,28 @@
-%{module: C3.Facts.Save,
- version: 1}
%{module: C3.Facts.Dump,
- version: 1,
- count: 23}
-{a, a, a}
-{-18446744073709551616, -18446744073709551616, -18446744073709551616}
-{18446744073709551616, 18446744073709551616, 18446744073709551616}
-{-4294967296, -4294967296, -4294967296}
-{-65536, -65536, -65536}
-{-256, -256, -256}
-{-10, -10, -10}
-{-1, -1, -1}
-{0, 0, 0}
-{1, 1, 1}
-{10, 10, 10}
-{256, 256, 256}
-{65536, 65536, 65536}
-{4294967296, 4294967296, 4294967296}
-{(), (), ()}
-{((), ()), ((), ()), ((), ())}
-{"a", "a", "a"}
-{A, A, A}
-{:a, :a, :a}
-{{a, b}, {a, b}, {a, b}}
-{{:a, :b}, {:a, :b}, {:a, :b}}
-{{{a, b}, {c, d}}, {{a, b}, {c, d}}, {{a, b}, {c, d}}}
-{{{:a, :b}, {:c, :d}}, {{:a, :b}, {:c, :d}}, {{:a, :b}, {:c, :d}}}
+ version: 1}
+add {a, a, a}
+add {-18446744073709551616, -18446744073709551616, -18446744073709551616}
+add {18446744073709551616, 18446744073709551616, 18446744073709551616}
+add {-4294967296, -4294967296, -4294967296}
+add {-65536, -65536, -65536}
+add {-256, -256, -256}
+add {-10, -10, -10}
+add {-1, -1, -1}
+add {0, 0, 0}
+add {1, 1, 1}
+add {10, 10, 10}
+add {256, 256, 256}
+add {65536, 65536, 65536}
+add {4294967296, 4294967296, 4294967296}
+add {(), (), ()}
+add {((), ()), ((), ()), ((), ())}
+add {"a", "a", "a"}
+add {A, A, A}
+add {:a, :a, :a}
+add {{a, b}, {a, b}, {a, b}}
+add {{:a, :b}, {:a, :b}, {:a, :b}}
+add {{{a, b}, {c, d}}, {{a, b}, {c, d}}, {{a, b}, {c, d}}}
+add {{{:a, :b}, {:c, :d}}, {{:a, :b}, {:c, :d}}, {{:a, :b}, {:c, :d}}}
remove {a, a, a}
remove {-18446744073709551616, -18446744073709551616, -18446744073709551616}
remove {18446744073709551616, 18446744073709551616, 18446744073709551616}
diff --git a/test/facts_test_save.expected.facts b/test/facts_test_save.expected.facts
index fd5bd92..cd38dd2 100644
--- a/test/facts_test_save.expected.facts
+++ b/test/facts_test_save.expected.facts
@@ -1,28 +1,25 @@
-%{module: C3.Facts.Save,
- version: 1}
%{module: C3.Facts.Dump,
- version: 1,
- count: 23}
-{a, a, a}
-{-18446744073709551616, -18446744073709551616, -18446744073709551616}
-{18446744073709551616, 18446744073709551616, 18446744073709551616}
-{-4294967296, -4294967296, -4294967296}
-{-65536, -65536, -65536}
-{-256, -256, -256}
-{-10, -10, -10}
-{-1, -1, -1}
-{0, 0, 0}
-{1, 1, 1}
-{10, 10, 10}
-{256, 256, 256}
-{65536, 65536, 65536}
-{4294967296, 4294967296, 4294967296}
-{(), (), ()}
-{((), ()), ((), ()), ((), ())}
-{"a", "a", "a"}
-{A, A, A}
-{:a, :a, :a}
-{{a, b}, {a, b}, {a, b}}
-{{:a, :b}, {:a, :b}, {:a, :b}}
-{{{a, b}, {c, d}}, {{a, b}, {c, d}}, {{a, b}, {c, d}}}
-{{{:a, :b}, {:c, :d}}, {{:a, :b}, {:c, :d}}, {{:a, :b}, {:c, :d}}}
+ version: 1}
+add {a, a, a}
+add {-18446744073709551616, -18446744073709551616, -18446744073709551616}
+add {18446744073709551616, 18446744073709551616, 18446744073709551616}
+add {-4294967296, -4294967296, -4294967296}
+add {-65536, -65536, -65536}
+add {-256, -256, -256}
+add {-10, -10, -10}
+add {-1, -1, -1}
+add {0, 0, 0}
+add {1, 1, 1}
+add {10, 10, 10}
+add {256, 256, 256}
+add {65536, 65536, 65536}
+add {4294967296, 4294967296, 4294967296}
+add {(), (), ()}
+add {((), ()), ((), ()), ((), ())}
+add {"a", "a", "a"}
+add {A, A, A}
+add {:a, :a, :a}
+add {{a, b}, {a, b}, {a, b}}
+add {{:a, :b}, {:a, :b}, {:a, :b}}
+add {{{a, b}, {c, d}}, {{a, b}, {c, d}}, {{a, b}, {c, d}}}
+add {{{:a, :b}, {:c, :d}}, {{:a, :b}, {:c, :d}}, {{:a, :b}, {:c, :d}}}
diff --git a/test/ic3/bool.in b/test/ic3/bool.in
index 550244c..20e5c9e 100644
--- a/test/ic3/bool.in
+++ b/test/ic3/bool.in
@@ -1,10 +1,14 @@
true
false
-
-# true
-
-true # true
-
-# false
-
-false # false
+true
+false
+false && false
+false && true
+true && false
+true && true
+false || false
+false || true
+true || false
+true || true
+! false
+! true
diff --git a/test/ic3/bool.out.expected b/test/ic3/bool.out.expected
index 69fa4e6..73958e8 100644
--- a/test/ic3/bool.out.expected
+++ b/test/ic3/bool.out.expected
@@ -2,9 +2,17 @@ true
false
-
true
-
false
+false
+false
+false
+true
+false
+true
+true
+true
+true
+false