aboutsummaryrefslogtreecommitdiff
path: root/tests/conformance/1-source
diff options
context:
space:
mode:
authorGravatar zinc <zinc@downsta.ir> 2026-10-14 15:37:28 +0330
committerGravatar zinc <zinc@downsta.ir> 2026-10-14 15:39:03 +0330
commita275919ea9141a9d8c966ccef040666d9bda3b60 (patch)
tree5de0bf209aba110f3c80499bb1ceaa5068089b0a /tests/conformance/1-source
parenttodo: record each agent's state at the end of the session and the merge order (diff)
agent/spec-conformance: unmerged work from previous session
Diffstat (limited to 'tests/conformance/1-source')
-rw-r--r--tests/conformance/1-source/backtick_get_c_eof.zc4
-rw-r--r--tests/conformance/1-source/backtick_in_literals_and_comments.zc9
-rw-r--r--tests/conformance/1-source/backtick_stdin.zc4
-rw-r--r--tests/conformance/1-source/comment_block.zc8
-rw-r--r--tests/conformance/1-source/comment_block_in_middle_of_expr.zc5
-rw-r--r--tests/conformance/1-source/comment_block_no_nest.zc7
-rw-r--r--tests/conformance/1-source/comment_block_spans_lines_with_quote.zc10
-rw-r--r--tests/conformance/1-source/comment_block_unclosed.zc4
-rw-r--r--tests/conformance/1-source/comment_doc_does_not_change_code.zc6
-rw-r--r--tests/conformance/1-source/comment_line.zc8
-rw-r--r--tests/conformance/1-source/comment_line_ends_at_newline.zc9
-rw-r--r--tests/conformance/1-source/comment_line_in_string.zc4
-rw-r--r--tests/conformance/1-source/comment_slash_star_in_string.zc5
-rw-r--r--tests/conformance/1-source/ident_case_sensitive.zc6
-rw-r--r--tests/conformance/1-source/ident_digits_underscore_long.zc5
-rw-r--r--tests/conformance/1-source/ident_forms.zc8
-rw-r--r--tests/conformance/1-source/ident_keyword_as_local_if.zc4
-rw-r--r--tests/conformance/1-source/ident_keyword_as_local_len.zc4
-rw-r--r--tests/conformance/1-source/ident_keyword_as_param.zc5
-rw-r--r--tests/conformance/1-source/ident_non_letter_start.zc5
-rw-r--r--tests/conformance/1-source/ident_positional_words_as_names.zc8
-rw-r--r--tests/conformance/1-source/ident_positional_words_as_names_2.zc8
-rw-r--r--tests/conformance/1-source/ident_tags_as_variables.zc9
-rw-r--r--tests/conformance/1-source/ident_tags_as_variables_glued_star.zc8
-rw-r--r--tests/conformance/1-source/ident_type_name_shadow.zc4
-rw-r--r--tests/conformance/1-source/keyword_expr_keywords_ok.zc6
-rw-r--r--tests/conformance/1-source/keyword_in_expr_break.zc5
-rw-r--r--tests/conformance/1-source/keyword_in_expr_do.zc5
-rw-r--r--tests/conformance/1-source/keyword_in_expr_else.zc5
-rw-r--r--tests/conformance/1-source/keyword_in_expr_for.zc5
-rw-r--r--tests/conformance/1-source/keyword_in_expr_if.zc5
-rw-r--r--tests/conformance/1-source/keyword_in_expr_let.zc5
-rw-r--r--tests/conformance/1-source/keyword_in_expr_return.zc5
-rw-r--r--tests/conformance/1-source/keyword_in_expr_switch.zc5
-rw-r--r--tests/conformance/1-source/keyword_s_only_in_expression.zc2
-rw-r--r--tests/conformance/1-source/lit_bstr_basic.zc9
-rw-r--r--tests/conformance/1-source/lit_bstr_cast_to_int_pointer.zc10
-rw-r--r--tests/conformance/1-source/lit_bstr_empty.zc5
-rw-r--r--tests/conformance/1-source/lit_bstr_escape_and_len.zc5
-rw-r--r--tests/conformance/1-source/lit_bstr_layout.zc11
-rw-r--r--tests/conformance/1-source/lit_bstr_name_b_still_usable.zc4
-rw-r--r--tests/conformance/1-source/lit_bstr_nul_truncates.zc4
-rw-r--r--tests/conformance/1-source/lit_bstr_space_is_name.zc7
-rw-r--r--tests/conformance/1-source/lit_char_non_ascii.zc4
-rw-r--r--tests/conformance/1-source/lit_char_non_ascii_global.zc5
-rw-r--r--tests/conformance/1-source/lit_char_non_ascii_later.zc5
-rw-r--r--tests/conformance/1-source/lit_char_range_0_255.zc4
-rw-r--r--tests/conformance/1-source/lit_char_two_bytes.zc4
-rw-r--r--tests/conformance/1-source/lit_char_two_bytes_global.zc5
-rw-r--r--tests/conformance/1-source/lit_char_two_bytes_later.zc5
-rw-r--r--tests/conformance/1-source/lit_char_two_bytes_local_init.zc5
-rw-r--r--tests/conformance/1-source/lit_char_values.zc8
-rw-r--r--tests/conformance/1-source/lit_float_bad_exponent.zc4
-rw-r--r--tests/conformance/1-source/lit_float_bad_exponent_capital.zc5
-rw-r--r--tests/conformance/1-source/lit_float_bad_exponent_first_stmt_local.zc5
-rw-r--r--tests/conformance/1-source/lit_float_bad_exponent_first_stmt_paren.zc5
-rw-r--r--tests/conformance/1-source/lit_float_bad_exponent_global.zc5
-rw-r--r--tests/conformance/1-source/lit_float_bad_exponent_in_helper.zc5
-rw-r--r--tests/conformance/1-source/lit_float_bad_exponent_later.zc5
-rw-r--r--tests/conformance/1-source/lit_float_bad_exponent_sign.zc4
-rw-r--r--tests/conformance/1-source/lit_float_bad_exponent_sign_later.zc5
-rw-r--r--tests/conformance/1-source/lit_float_dot_forms.zc14
-rw-r--r--tests/conformance/1-source/lit_float_dot_letter_is_field.zc6
-rw-r--r--tests/conformance/1-source/lit_float_exponent_negative_digit.zc4
-rw-r--r--tests/conformance/1-source/lit_float_forms.zc7
-rw-r--r--tests/conformance/1-source/lit_float_is_float_type.zc10
-rw-r--r--tests/conformance/1-source/lit_hex.zc4
-rw-r--r--tests/conformance/1-source/lit_hex_letter_after_0x_new_token.zc5
-rw-r--r--tests/conformance/1-source/lit_hex_no_digits_is_zero.zc4
-rw-r--r--tests/conformance/1-source/lit_hex_wide.zc5
-rw-r--r--tests/conformance/1-source/lit_hex_wraps.zc4
-rw-r--r--tests/conformance/1-source/lit_int_max.zc5
-rw-r--r--tests/conformance/1-source/lit_int_octal_is_decimal.zc4
-rw-r--r--tests/conformance/1-source/lit_int_type_is_int_never_negative.zc5
-rw-r--r--tests/conformance/1-source/lit_int_wraps.zc4
-rw-r--r--tests/conformance/1-source/lit_int_zero_and_leading_zeros.zc5
-rw-r--r--tests/conformance/1-source/lit_minus_folded.zc4
-rw-r--r--tests/conformance/1-source/lit_no_binary.zc7
-rw-r--r--tests/conformance/1-source/lit_no_digit_separator.zc7
-rw-r--r--tests/conformance/1-source/lit_no_suffix.zc7
-rw-r--r--tests/conformance/1-source/lit_str_adjacent_not_joined.zc7
-rw-r--r--tests/conformance/1-source/lit_str_empty.zc5
-rw-r--r--tests/conformance/1-source/lit_str_escapes.zc8
-rw-r--r--tests/conformance/1-source/lit_str_hex_escape_is_plain_char.zc5
-rw-r--r--tests/conformance/1-source/lit_str_high_byte_one_word_each.zc5
-rw-r--r--tests/conformance/1-source/lit_str_nul_truncates.zc4
-rw-r--r--tests/conformance/1-source/lit_str_raw_newline.zc9
-rw-r--r--tests/conformance/1-source/lit_str_unterminated.zc4
-rw-r--r--tests/conformance/1-source/lit_str_utf8_bytes.zc4
-rw-r--r--tests/conformance/1-source/lit_str_word_per_cell.zc9
-rw-r--r--tests/conformance/1-source/lit_str_zero_terminated.zc5
-rw-r--r--tests/conformance/1-source/module_join_hidden_by_local.zc10
-rw-r--r--tests/conformance/1-source/module_join_known_name_not_module.zc7
-rw-r--r--tests/conformance/1-source/module_join_needs_include.zc2
-rw-r--r--tests/conformance/1-source/module_join_one_dot_only.zc5
-rw-r--r--tests/conformance/1-source/module_join_prints_A.zc3
-rw-r--r--tests/conformance/1-source/module_unqualified_rt_name.zc2
-rw-r--r--tests/conformance/1-source/op_compound_all.zc15
-rw-r--r--tests/conformance/1-source/op_compound_or.zc4
-rw-r--r--tests/conformance/1-source/op_greedy_compound_shift.zc4
-rw-r--r--tests/conformance/1-source/op_incr_decr_split.zc4
-rw-r--r--tests/conformance/1-source/op_lexing_a_minus_minus_b.zc5
-rw-r--r--tests/conformance/1-source/op_no_space_needed_lt_neg.zc4
-rw-r--r--tests/conformance/1-source/op_non_ascii_byte_error.zc7
-rw-r--r--tests/conformance/1-source/op_not_not.zc4
-rw-r--r--tests/conformance/1-source/op_star_neg_and_assign_neg.zc4
-rw-r--r--tests/conformance/1-source/op_ternary_colon_tokens.zc6
-rw-r--r--tests/conformance/1-source/op_unknown_char.zc5
-rw-r--r--tests/conformance/1-source/unit_ends_at_backtick.zc4
-rw-r--r--tests/conformance/1-source/unit_ends_at_backtick_first_line.zc6
-rw-r--r--tests/conformance/1-source/unit_eof_ends_unit.zc6
-rw-r--r--tests/conformance/1-source/ws_basic.zc11
-rw-r--r--tests/conformance/1-source/ws_carriage_return_tab_ff.zc5
-rw-r--r--tests/conformance/1-source/ws_no_space_needed_between_tokens.zc5
114 files changed, 652 insertions, 0 deletions
diff --git a/tests/conformance/1-source/backtick_get_c_eof.zc b/tests/conformance/1-source/backtick_get_c_eof.zc
new file mode 100644
index 0000000..71084b2
--- /dev/null
+++ b/tests/conformance/1-source/backtick_get_c_eof.zc
@@ -0,0 +1,4 @@
+// expect: 120/-1/
+include rt;
+fn main() { rt.put_n(rt.get_c()); rt.put_c(10); rt.get_c(); rt.put_n(rt.get_c()); rt.put_c(10); return 0; }
+`x
diff --git a/tests/conformance/1-source/backtick_in_literals_and_comments.zc b/tests/conformance/1-source/backtick_in_literals_and_comments.zc
new file mode 100644
index 0000000..bc21425
--- /dev/null
+++ b/tests/conformance/1-source/backtick_in_literals_and_comments.zc
@@ -0,0 +1,9 @@
+// expect: 96/96/1/
+include rt;
+void pn(int x) { rt.put_n(x); rt.put_c(10); }
+// a backtick in a line comment ` is ordinary
+/* and in a block comment ` too */
+fn main() {
+ pn('`'); pn("`"[0]); pn(1);
+ return 0;
+}
diff --git a/tests/conformance/1-source/backtick_stdin.zc b/tests/conformance/1-source/backtick_stdin.zc
new file mode 100644
index 0000000..21dff76
--- /dev/null
+++ b/tests/conformance/1-source/backtick_stdin.zc
@@ -0,0 +1,4 @@
+// expect: 120/121/10/
+include rt;
+fn main() { while (!rt.eof()) { rt.put_n(rt.get_c()); rt.put_c(10); } return 0; }
+`xy
diff --git a/tests/conformance/1-source/comment_block.zc b/tests/conformance/1-source/comment_block.zc
new file mode 100644
index 0000000..6115037
--- /dev/null
+++ b/tests/conformance/1-source/comment_block.zc
@@ -0,0 +1,8 @@
+// expect: 2/
+include rt;
+fn main() {
+ /* rt.put_n(9);
+ // still inside */ rt.put_n(2);
+ rt.put_c(10);
+ return 0;
+}
diff --git a/tests/conformance/1-source/comment_block_in_middle_of_expr.zc b/tests/conformance/1-source/comment_block_in_middle_of_expr.zc
new file mode 100644
index 0000000..7c1c465
--- /dev/null
+++ b/tests/conformance/1-source/comment_block_in_middle_of_expr.zc
@@ -0,0 +1,5 @@
+// expect: 9/
+// spec 1.2.2
+include rt;
+void pn(int x) { rt.put_n(x); rt.put_c(10); }
+fn main() { pn(4 /* five */ + /* nine */ 5); return 0; }
diff --git a/tests/conformance/1-source/comment_block_no_nest.zc b/tests/conformance/1-source/comment_block_no_nest.zc
new file mode 100644
index 0000000..026167a
--- /dev/null
+++ b/tests/conformance/1-source/comment_block_no_nest.zc
@@ -0,0 +1,7 @@
+// expect: 7/
+include rt;
+fn main() {
+ /* outer /* inner */ rt.put_n(7); /* tail */
+ rt.put_c(10);
+ return 0;
+}
diff --git a/tests/conformance/1-source/comment_block_spans_lines_with_quote.zc b/tests/conformance/1-source/comment_block_spans_lines_with_quote.zc
new file mode 100644
index 0000000..9ffb42d
--- /dev/null
+++ b/tests/conformance/1-source/comment_block_spans_lines_with_quote.zc
@@ -0,0 +1,10 @@
+// expect: 1/
+// spec 1.2.2: a quote inside a comment is not a literal
+include rt;
+void pn(int x) { rt.put_n(x); rt.put_c(10); }
+fn main() {
+ /* "unterminated
+ ' also */
+ pn(1);
+ return 0;
+}
diff --git a/tests/conformance/1-source/comment_block_unclosed.zc b/tests/conformance/1-source/comment_block_unclosed.zc
new file mode 100644
index 0000000..4ae34e7
--- /dev/null
+++ b/tests/conformance/1-source/comment_block_unclosed.zc
@@ -0,0 +1,4 @@
+// expect: 4/
+include rt;
+fn main() { rt.put_n(4); rt.put_c(10); return 0; }
+/* never closed: rt.put_n(9);
diff --git a/tests/conformance/1-source/comment_doc_does_not_change_code.zc b/tests/conformance/1-source/comment_doc_does_not_change_code.zc
new file mode 100644
index 0000000..2784c2b
--- /dev/null
+++ b/tests/conformance/1-source/comment_doc_does_not_change_code.zc
@@ -0,0 +1,6 @@
+// expect: 3/
+include rt;
+//: implementation note
+// documents f
+int f() { return 3; }
+fn main() { rt.put_n(/* intentional */ f()); rt.put_c(10); return 0; }
diff --git a/tests/conformance/1-source/comment_line.zc b/tests/conformance/1-source/comment_line.zc
new file mode 100644
index 0000000..7fd68f0
--- /dev/null
+++ b/tests/conformance/1-source/comment_line.zc
@@ -0,0 +1,8 @@
+// expect: 1/
+include rt;
+fn main() {
+ // rt.put_n(9); /* not a block start
+ rt.put_n(1); // trailing comment
+ rt.put_c(10);
+ return 0;
+}
diff --git a/tests/conformance/1-source/comment_line_ends_at_newline.zc b/tests/conformance/1-source/comment_line_ends_at_newline.zc
new file mode 100644
index 0000000..e3f5053
--- /dev/null
+++ b/tests/conformance/1-source/comment_line_ends_at_newline.zc
@@ -0,0 +1,9 @@
+// expect: 6/
+// spec 1.2.1: a // comment runs to the end of the line only
+include rt;
+void pn(int x) { rt.put_n(x); rt.put_c(10); }
+fn main() {
+ int a = 1; // pn(100);
+ int b = 5; pn(a + b);
+ return 0;
+}
diff --git a/tests/conformance/1-source/comment_line_in_string.zc b/tests/conformance/1-source/comment_line_in_string.zc
new file mode 100644
index 0000000..d8a16f5
--- /dev/null
+++ b/tests/conformance/1-source/comment_line_in_string.zc
@@ -0,0 +1,4 @@
+// expect: 4/
+include rt;
+void pn(int x) { rt.put_n(x); rt.put_c(10); }
+fn main() { pn(rt.len_w("a//b")); return 0; }
diff --git a/tests/conformance/1-source/comment_slash_star_in_string.zc b/tests/conformance/1-source/comment_slash_star_in_string.zc
new file mode 100644
index 0000000..f552cc4
--- /dev/null
+++ b/tests/conformance/1-source/comment_slash_star_in_string.zc
@@ -0,0 +1,5 @@
+// expect: 2/
+// spec 1.2: comment starts inside a string literal are ordinary characters
+include rt;
+void pn(int x) { rt.put_n(x); rt.put_c(10); }
+fn main() { pn(rt.len_w("/*")); /* real comment */ return 0; }
diff --git a/tests/conformance/1-source/ident_case_sensitive.zc b/tests/conformance/1-source/ident_case_sensitive.zc
new file mode 100644
index 0000000..eb53ddb
--- /dev/null
+++ b/tests/conformance/1-source/ident_case_sensitive.zc
@@ -0,0 +1,6 @@
+// expect: 10/20/
+include rt;
+void pn(int x) { rt.put_n(x); rt.put_c(10); }
+int Foo() { return 10; }
+int foo() { return 20; }
+fn main() { pn(Foo()); pn(foo()); return 0; }
diff --git a/tests/conformance/1-source/ident_digits_underscore_long.zc b/tests/conformance/1-source/ident_digits_underscore_long.zc
new file mode 100644
index 0000000..92a068f
--- /dev/null
+++ b/tests/conformance/1-source/ident_digits_underscore_long.zc
@@ -0,0 +1,5 @@
+// expect: 3/
+// spec 1.3.1
+include rt;
+void pn(int x) { rt.put_n(x); rt.put_c(10); }
+fn main() { int __x_9 = 1, _q = 2; pn(__x_9 + _q); return 0; }
diff --git a/tests/conformance/1-source/ident_forms.zc b/tests/conformance/1-source/ident_forms.zc
new file mode 100644
index 0000000..6735dec
--- /dev/null
+++ b/tests/conformance/1-source/ident_forms.zc
@@ -0,0 +1,8 @@
+// expect: 1/2/3/4/
+include rt;
+void pn(int x) { rt.put_n(x); rt.put_c(10); }
+fn main() {
+ int _a = 1, a1_b2 = 2, A = 3, a = 4;
+ pn(_a); pn(a1_b2); pn(A); pn(a);
+ return 0;
+}
diff --git a/tests/conformance/1-source/ident_keyword_as_local_if.zc b/tests/conformance/1-source/ident_keyword_as_local_if.zc
new file mode 100644
index 0000000..3d03b43
--- /dev/null
+++ b/tests/conformance/1-source/ident_keyword_as_local_if.zc
@@ -0,0 +1,4 @@
+// expect: 5/
+include rt;
+void pn(int x) { rt.put_n(x); rt.put_c(10); }
+fn main() { int if = 4; pn(if + 1); return 0; }
diff --git a/tests/conformance/1-source/ident_keyword_as_local_len.zc b/tests/conformance/1-source/ident_keyword_as_local_len.zc
new file mode 100644
index 0000000..f324f5c
--- /dev/null
+++ b/tests/conformance/1-source/ident_keyword_as_local_len.zc
@@ -0,0 +1,4 @@
+// expect: 5/
+include rt;
+void pn(int x) { rt.put_n(x); rt.put_c(10); }
+fn main() { int len = 5; pn(len); return 0; }
diff --git a/tests/conformance/1-source/ident_keyword_as_param.zc b/tests/conformance/1-source/ident_keyword_as_param.zc
new file mode 100644
index 0000000..1a66c5c
--- /dev/null
+++ b/tests/conformance/1-source/ident_keyword_as_param.zc
@@ -0,0 +1,5 @@
+// expect: 9/
+include rt;
+void pn(int x) { rt.put_n(x); rt.put_c(10); }
+int f(int push, int sizeof) { return push + sizeof; }
+fn main() { pn(f(4, 5)); return 0; }
diff --git a/tests/conformance/1-source/ident_non_letter_start.zc b/tests/conformance/1-source/ident_non_letter_start.zc
new file mode 100644
index 0000000..4de3ca2
--- /dev/null
+++ b/tests/conformance/1-source/ident_non_letter_start.zc
@@ -0,0 +1,5 @@
+// expect error: zc: line
+// spec 1.3.1: an identifier starts with a letter or underscore
+include rt;
+void pn(int x) { rt.put_n(x); rt.put_c(10); }
+fn main() { int 9a = 1; return 0; }
diff --git a/tests/conformance/1-source/ident_positional_words_as_names.zc b/tests/conformance/1-source/ident_positional_words_as_names.zc
new file mode 100644
index 0000000..c4ee296
--- /dev/null
+++ b/tests/conformance/1-source/ident_positional_words_as_names.zc
@@ -0,0 +1,8 @@
+// expect: 21/
+include rt;
+void pn(int x) { rt.put_n(x); rt.put_c(10); }
+fn main() {
+ int fn = 1, const = 2, fixed = 3, static = 4, case = 5, default = 6;
+ pn(fn + const + fixed + static + case + default);
+ return 0;
+}
diff --git a/tests/conformance/1-source/ident_positional_words_as_names_2.zc b/tests/conformance/1-source/ident_positional_words_as_names_2.zc
new file mode 100644
index 0000000..12e5883
--- /dev/null
+++ b/tests/conformance/1-source/ident_positional_words_as_names_2.zc
@@ -0,0 +1,8 @@
+// expect: 15/
+include rt;
+void pn(int x) { rt.put_n(x); rt.put_c(10); }
+fn main() {
+ int on = 1, off = 2, small = 3, micro = 4, vm = 5;
+ pn(on + off + small + micro + vm);
+ return 0;
+}
diff --git a/tests/conformance/1-source/ident_tags_as_variables.zc b/tests/conformance/1-source/ident_tags_as_variables.zc
new file mode 100644
index 0000000..f453d3b
--- /dev/null
+++ b/tests/conformance/1-source/ident_tags_as_variables.zc
@@ -0,0 +1,9 @@
+// expect: 12/7/
+include rt;
+void pn(int x) { rt.put_n(x); rt.put_c(10); }
+fn main() {
+ int u = 3, d = 4, m = 0;
+ pn(u * d);
+ pn(u+d+m);
+ return 0;
+}
diff --git a/tests/conformance/1-source/ident_tags_as_variables_glued_star.zc b/tests/conformance/1-source/ident_tags_as_variables_glued_star.zc
new file mode 100644
index 0000000..a8dc700
--- /dev/null
+++ b/tests/conformance/1-source/ident_tags_as_variables_glued_star.zc
@@ -0,0 +1,8 @@
+// expect: 12/
+include rt;
+void pn(int x) { rt.put_n(x); rt.put_c(10); }
+fn main() {
+ int u = 3, d = 4;
+ pn(u*d);
+ return 0;
+}
diff --git a/tests/conformance/1-source/ident_type_name_shadow.zc b/tests/conformance/1-source/ident_type_name_shadow.zc
new file mode 100644
index 0000000..6ed2018
--- /dev/null
+++ b/tests/conformance/1-source/ident_type_name_shadow.zc
@@ -0,0 +1,4 @@
+// expect: 8/
+include rt;
+void pn(int x) { rt.put_n(x); rt.put_c(10); }
+fn main() { int float = 7; pn(float + 1); return 0; }
diff --git a/tests/conformance/1-source/keyword_expr_keywords_ok.zc b/tests/conformance/1-source/keyword_expr_keywords_ok.zc
new file mode 100644
index 0000000..6300e16
--- /dev/null
+++ b/tests/conformance/1-source/keyword_expr_keywords_ok.zc
@@ -0,0 +1,6 @@
+// expect: 1/1/1/
+// spec 1.3.4: sizeof, typeof, len are expression keywords
+include rt;
+void pn(int x) { rt.put_n(x); rt.put_c(10); }
+fn main() { int[4] a; pn(sizeof(int)); pn(typeof(int) != 0); pn(len(a) == 4); return 0; }
+// zc0: skip
diff --git a/tests/conformance/1-source/keyword_in_expr_break.zc b/tests/conformance/1-source/keyword_in_expr_break.zc
new file mode 100644
index 0000000..2b8f3b9
--- /dev/null
+++ b/tests/conformance/1-source/keyword_in_expr_break.zc
@@ -0,0 +1,5 @@
+// expect error: break: can't be used inside an expression
+// spec 1.3.4
+include rt;
+void pn(int x) { rt.put_n(x); rt.put_c(10); }
+fn main() { while (1) { int x = break; } return 0; }
diff --git a/tests/conformance/1-source/keyword_in_expr_do.zc b/tests/conformance/1-source/keyword_in_expr_do.zc
new file mode 100644
index 0000000..2307d12
--- /dev/null
+++ b/tests/conformance/1-source/keyword_in_expr_do.zc
@@ -0,0 +1,5 @@
+// expect error: do: can't be used inside an expression
+// spec 1.3.4
+include rt;
+void pn(int x) { rt.put_n(x); rt.put_c(10); }
+fn main() { int x = do; return 0; }
diff --git a/tests/conformance/1-source/keyword_in_expr_else.zc b/tests/conformance/1-source/keyword_in_expr_else.zc
new file mode 100644
index 0000000..234d71e
--- /dev/null
+++ b/tests/conformance/1-source/keyword_in_expr_else.zc
@@ -0,0 +1,5 @@
+// expect error: zc: line
+// spec 1.3.4: else is consumed by if, so it can't stand alone
+include rt;
+void pn(int x) { rt.put_n(x); rt.put_c(10); }
+fn main() { else { } return 0; }
diff --git a/tests/conformance/1-source/keyword_in_expr_for.zc b/tests/conformance/1-source/keyword_in_expr_for.zc
new file mode 100644
index 0000000..a697992
--- /dev/null
+++ b/tests/conformance/1-source/keyword_in_expr_for.zc
@@ -0,0 +1,5 @@
+// expect error: for: can't be used inside an expression
+// spec 1.3.4
+include rt;
+void pn(int x) { rt.put_n(x); rt.put_c(10); }
+fn main() { int x = for; return 0; }
diff --git a/tests/conformance/1-source/keyword_in_expr_if.zc b/tests/conformance/1-source/keyword_in_expr_if.zc
new file mode 100644
index 0000000..eab2e45
--- /dev/null
+++ b/tests/conformance/1-source/keyword_in_expr_if.zc
@@ -0,0 +1,5 @@
+// expect error: if: can't be used inside an expression
+// spec 1.3.4
+include rt;
+void pn(int x) { rt.put_n(x); rt.put_c(10); }
+fn main() { int x = if + 1; return 0; }
diff --git a/tests/conformance/1-source/keyword_in_expr_let.zc b/tests/conformance/1-source/keyword_in_expr_let.zc
new file mode 100644
index 0000000..f16b0f6
--- /dev/null
+++ b/tests/conformance/1-source/keyword_in_expr_let.zc
@@ -0,0 +1,5 @@
+// expect error: let: can't be used inside an expression
+// spec 1.3.4
+include rt;
+void pn(int x) { rt.put_n(x); rt.put_c(10); }
+fn main() { int x = let; return 0; }
diff --git a/tests/conformance/1-source/keyword_in_expr_return.zc b/tests/conformance/1-source/keyword_in_expr_return.zc
new file mode 100644
index 0000000..c1bee83
--- /dev/null
+++ b/tests/conformance/1-source/keyword_in_expr_return.zc
@@ -0,0 +1,5 @@
+// expect error: return: can't be used inside an expression
+// spec 1.3.4
+include rt;
+void pn(int x) { rt.put_n(x); rt.put_c(10); }
+fn main() { int x = return; return 0; }
diff --git a/tests/conformance/1-source/keyword_in_expr_switch.zc b/tests/conformance/1-source/keyword_in_expr_switch.zc
new file mode 100644
index 0000000..626d897
--- /dev/null
+++ b/tests/conformance/1-source/keyword_in_expr_switch.zc
@@ -0,0 +1,5 @@
+// expect error: switch: can't be used inside an expression
+// spec 1.3.4
+include rt;
+void pn(int x) { rt.put_n(x); rt.put_c(10); }
+fn main() { int x = switch; return 0; }
diff --git a/tests/conformance/1-source/keyword_s_only_in_expression.zc b/tests/conformance/1-source/keyword_s_only_in_expression.zc
new file mode 100644
index 0000000..7e6c6cc
--- /dev/null
+++ b/tests/conformance/1-source/keyword_s_only_in_expression.zc
@@ -0,0 +1,2 @@
+// expect error: can't be used inside an expression
+fn main() { int x = while + 1; return 0; }
diff --git a/tests/conformance/1-source/lit_bstr_basic.zc b/tests/conformance/1-source/lit_bstr_basic.zc
new file mode 100644
index 0000000..3157bd1
--- /dev/null
+++ b/tests/conformance/1-source/lit_bstr_basic.zc
@@ -0,0 +1,9 @@
+// expect: 5/el/
+include rt;
+void pn(int x) { rt.put_n(x); rt.put_c(10); }
+fn main() {
+ let t = b"hello";
+ pn(len(t));
+ rt.put_s(t[1:3]); rt.put_c(10);
+ return 0;
+}
diff --git a/tests/conformance/1-source/lit_bstr_cast_to_int_pointer.zc b/tests/conformance/1-source/lit_bstr_cast_to_int_pointer.zc
new file mode 100644
index 0000000..8959ca3
--- /dev/null
+++ b/tests/conformance/1-source/lit_bstr_cast_to_int_pointer.zc
@@ -0,0 +1,10 @@
+// expect: 2/16961/
+include rt;
+void pn(int x) { rt.put_n(x); rt.put_c(10); }
+fn main() {
+ bstr t = b"AB";
+ int* w = (int*)t;
+ pn(w[0]); pn(w[1]);
+ return 0;
+}
+// zc0: skip
diff --git a/tests/conformance/1-source/lit_bstr_empty.zc b/tests/conformance/1-source/lit_bstr_empty.zc
new file mode 100644
index 0000000..9b2374b
--- /dev/null
+++ b/tests/conformance/1-source/lit_bstr_empty.zc
@@ -0,0 +1,5 @@
+// expect: 0/
+// spec 1.4.5
+include rt;
+void pn(int x) { rt.put_n(x); rt.put_c(10); }
+fn main() { bstr t = b""; pn(len(t)); return 0; }
diff --git a/tests/conformance/1-source/lit_bstr_escape_and_len.zc b/tests/conformance/1-source/lit_bstr_escape_and_len.zc
new file mode 100644
index 0000000..33b3c11
--- /dev/null
+++ b/tests/conformance/1-source/lit_bstr_escape_and_len.zc
@@ -0,0 +1,5 @@
+// expect: 4/10/9/
+// spec 1.4.5
+include rt;
+void pn(int x) { rt.put_n(x); rt.put_c(10); }
+fn main() { bstr t = b"a\n\tb"; pn(len(t)); pn(t[1]); pn(t[2]); return 0; }
diff --git a/tests/conformance/1-source/lit_bstr_layout.zc b/tests/conformance/1-source/lit_bstr_layout.zc
new file mode 100644
index 0000000..0104237
--- /dev/null
+++ b/tests/conformance/1-source/lit_bstr_layout.zc
@@ -0,0 +1,11 @@
+// expect: 2/16961/9/5208208757389214273/73/
+include rt;
+void pn(int x) { rt.put_n(x); rt.put_c(10); }
+fn rd(a, i) { return asm { a @ i @ + @ }; }
+fn main() {
+ bstr t = b"AB";
+ pn(rd(t, 0)); pn(rd(t, 1));
+ bstr u = b"ABCDEFGHI";
+ pn(rd(u, 0)); pn(rd(u, 1)); pn(rd(u, 2));
+ return 0;
+}
diff --git a/tests/conformance/1-source/lit_bstr_name_b_still_usable.zc b/tests/conformance/1-source/lit_bstr_name_b_still_usable.zc
new file mode 100644
index 0000000..06534a0
--- /dev/null
+++ b/tests/conformance/1-source/lit_bstr_name_b_still_usable.zc
@@ -0,0 +1,4 @@
+// expect: 7/2/
+include rt;
+void pn(int x) { rt.put_n(x); rt.put_c(10); }
+fn main() { let b = 7; let t = b"hi"; pn(b); pn(len(t)); return 0; }
diff --git a/tests/conformance/1-source/lit_bstr_nul_truncates.zc b/tests/conformance/1-source/lit_bstr_nul_truncates.zc
new file mode 100644
index 0000000..fbf1522
--- /dev/null
+++ b/tests/conformance/1-source/lit_bstr_nul_truncates.zc
@@ -0,0 +1,4 @@
+// expect: 3/
+include rt;
+void pn(int x) { rt.put_n(x); rt.put_c(10); }
+fn main() { bstr t = b"hi\n\0x"; pn(len(t)); return 0; }
diff --git a/tests/conformance/1-source/lit_bstr_space_is_name.zc b/tests/conformance/1-source/lit_bstr_space_is_name.zc
new file mode 100644
index 0000000..7f4e27a
--- /dev/null
+++ b/tests/conformance/1-source/lit_bstr_space_is_name.zc
@@ -0,0 +1,7 @@
+// expect error: zc: line 4:
+include rt;
+fn main() {
+ let b = 1; let t = b "hi";
+ return 0;
+}
+// zc0: error
diff --git a/tests/conformance/1-source/lit_char_non_ascii.zc b/tests/conformance/1-source/lit_char_non_ascii.zc
new file mode 100644
index 0000000..4eebaac
--- /dev/null
+++ b/tests/conformance/1-source/lit_char_non_ascii.zc
@@ -0,0 +1,4 @@
+// expect error: bad character literal
+include rt;
+fn main() { rt.put_n('é'); return 0; }
+// zc0: error
diff --git a/tests/conformance/1-source/lit_char_non_ascii_global.zc b/tests/conformance/1-source/lit_char_non_ascii_global.zc
new file mode 100644
index 0000000..d63db4f
--- /dev/null
+++ b/tests/conformance/1-source/lit_char_non_ascii_global.zc
@@ -0,0 +1,5 @@
+// expect error: bad character literal
+include rt;
+int g = 'é';
+fn main() { rt.put_n(g); return 0; }
+// zc0: error
diff --git a/tests/conformance/1-source/lit_char_non_ascii_later.zc b/tests/conformance/1-source/lit_char_non_ascii_later.zc
new file mode 100644
index 0000000..e447b2a
--- /dev/null
+++ b/tests/conformance/1-source/lit_char_non_ascii_later.zc
@@ -0,0 +1,5 @@
+// expect error: bad character literal
+// spec 1.4.2 (the literal is not in the first statement of the function)
+include rt;
+void pn(int x) { rt.put_n(x); rt.put_c(10); }
+fn main() { pn(1); rt.put_n('é'); return 0; }
diff --git a/tests/conformance/1-source/lit_char_range_0_255.zc b/tests/conformance/1-source/lit_char_range_0_255.zc
new file mode 100644
index 0000000..684a838
--- /dev/null
+++ b/tests/conformance/1-source/lit_char_range_0_255.zc
@@ -0,0 +1,4 @@
+// expect: 97/
+include rt;
+void pn(int x) { rt.put_n(x); rt.put_c(10); }
+fn main() { int c = 'a'; pn(c); return 0; }
diff --git a/tests/conformance/1-source/lit_char_two_bytes.zc b/tests/conformance/1-source/lit_char_two_bytes.zc
new file mode 100644
index 0000000..ad57dde
--- /dev/null
+++ b/tests/conformance/1-source/lit_char_two_bytes.zc
@@ -0,0 +1,4 @@
+// expect error: bad character literal
+include rt;
+fn main() { rt.put_n('ab'); return 0; }
+// zc0: error
diff --git a/tests/conformance/1-source/lit_char_two_bytes_global.zc b/tests/conformance/1-source/lit_char_two_bytes_global.zc
new file mode 100644
index 0000000..97ad88c
--- /dev/null
+++ b/tests/conformance/1-source/lit_char_two_bytes_global.zc
@@ -0,0 +1,5 @@
+// expect error: bad character literal
+include rt;
+int g = 'ab';
+fn main() { rt.put_n(g); return 0; }
+// zc0: error
diff --git a/tests/conformance/1-source/lit_char_two_bytes_later.zc b/tests/conformance/1-source/lit_char_two_bytes_later.zc
new file mode 100644
index 0000000..741d193
--- /dev/null
+++ b/tests/conformance/1-source/lit_char_two_bytes_later.zc
@@ -0,0 +1,5 @@
+// expect error: bad character literal
+// spec 1.4.2
+include rt;
+void pn(int x) { rt.put_n(x); rt.put_c(10); }
+fn main() { pn(1); rt.put_n('ab'); return 0; }
diff --git a/tests/conformance/1-source/lit_char_two_bytes_local_init.zc b/tests/conformance/1-source/lit_char_two_bytes_local_init.zc
new file mode 100644
index 0000000..e9df924
--- /dev/null
+++ b/tests/conformance/1-source/lit_char_two_bytes_local_init.zc
@@ -0,0 +1,5 @@
+// expect error: bad character literal
+// spec 1.4.2 (a local initializer as the first statement)
+include rt;
+void pn(int x) { rt.put_n(x); rt.put_c(10); }
+fn main() { int a = 'ab'; pn(5); return 0; }
diff --git a/tests/conformance/1-source/lit_char_values.zc b/tests/conformance/1-source/lit_char_values.zc
new file mode 100644
index 0000000..34b7f81
--- /dev/null
+++ b/tests/conformance/1-source/lit_char_values.zc
@@ -0,0 +1,8 @@
+// expect: 65/10/9/13/0/27/92/39/120/34/34/96/
+include rt;
+void pn(int x) { rt.put_n(x); rt.put_c(10); }
+fn main() {
+ pn('A'); pn('\n'); pn('\t'); pn('\r'); pn('\0'); pn('\e');
+ pn('\\'); pn('\''); pn('\x'); pn('"'); pn('\"'); pn('`');
+ return 0;
+}
diff --git a/tests/conformance/1-source/lit_float_bad_exponent.zc b/tests/conformance/1-source/lit_float_bad_exponent.zc
new file mode 100644
index 0000000..581985d
--- /dev/null
+++ b/tests/conformance/1-source/lit_float_bad_exponent.zc
@@ -0,0 +1,4 @@
+// expect error: bad float
+include rt;
+fn main() { rt.put_n(1e); return 0; }
+// zc0: error
diff --git a/tests/conformance/1-source/lit_float_bad_exponent_capital.zc b/tests/conformance/1-source/lit_float_bad_exponent_capital.zc
new file mode 100644
index 0000000..4e4c903
--- /dev/null
+++ b/tests/conformance/1-source/lit_float_bad_exponent_capital.zc
@@ -0,0 +1,5 @@
+// expect error: bad float
+// spec 1.4.3
+include rt;
+void pn(int x) { rt.put_n(x); rt.put_c(10); }
+fn main() { pn(1); float f = 2E; return 0; }
diff --git a/tests/conformance/1-source/lit_float_bad_exponent_first_stmt_local.zc b/tests/conformance/1-source/lit_float_bad_exponent_first_stmt_local.zc
new file mode 100644
index 0000000..b1cd771
--- /dev/null
+++ b/tests/conformance/1-source/lit_float_bad_exponent_first_stmt_local.zc
@@ -0,0 +1,5 @@
+// expect error: bad float
+// spec 1.4.3 (first statement of the function body)
+include rt;
+void pn(int x) { rt.put_n(x); rt.put_c(10); }
+fn main() { int x = 1e; return 0; }
diff --git a/tests/conformance/1-source/lit_float_bad_exponent_first_stmt_paren.zc b/tests/conformance/1-source/lit_float_bad_exponent_first_stmt_paren.zc
new file mode 100644
index 0000000..99fbdb9
--- /dev/null
+++ b/tests/conformance/1-source/lit_float_bad_exponent_first_stmt_paren.zc
@@ -0,0 +1,5 @@
+// expect error: bad float
+// spec 1.4.3 (first statement, inside parentheses)
+include rt;
+void pn(int x) { rt.put_n(x); rt.put_c(10); }
+fn main() { int a = (1e); pn(5); return 0; }
diff --git a/tests/conformance/1-source/lit_float_bad_exponent_global.zc b/tests/conformance/1-source/lit_float_bad_exponent_global.zc
new file mode 100644
index 0000000..e7870bd
--- /dev/null
+++ b/tests/conformance/1-source/lit_float_bad_exponent_global.zc
@@ -0,0 +1,5 @@
+// expect error: bad float
+include rt;
+int g = 1e;
+fn main() { rt.put_n(g); return 0; }
+// zc0: error
diff --git a/tests/conformance/1-source/lit_float_bad_exponent_in_helper.zc b/tests/conformance/1-source/lit_float_bad_exponent_in_helper.zc
new file mode 100644
index 0000000..e9e9d07
--- /dev/null
+++ b/tests/conformance/1-source/lit_float_bad_exponent_in_helper.zc
@@ -0,0 +1,5 @@
+// expect error: bad float
+include rt;
+int f() { int x = 1e; return x; }
+fn main() { rt.put_n(8); return 0; }
+// zc0: error
diff --git a/tests/conformance/1-source/lit_float_bad_exponent_later.zc b/tests/conformance/1-source/lit_float_bad_exponent_later.zc
new file mode 100644
index 0000000..9e4293c
--- /dev/null
+++ b/tests/conformance/1-source/lit_float_bad_exponent_later.zc
@@ -0,0 +1,5 @@
+// expect error: bad float
+// spec 1.4.3
+include rt;
+void pn(int x) { rt.put_n(x); rt.put_c(10); }
+fn main() { pn(1); rt.put_n(1e); return 0; }
diff --git a/tests/conformance/1-source/lit_float_bad_exponent_sign.zc b/tests/conformance/1-source/lit_float_bad_exponent_sign.zc
new file mode 100644
index 0000000..17d0f11
--- /dev/null
+++ b/tests/conformance/1-source/lit_float_bad_exponent_sign.zc
@@ -0,0 +1,4 @@
+// expect error: bad float
+include rt;
+fn main() { rt.put_n(1.5e+); return 0; }
+// zc0: error
diff --git a/tests/conformance/1-source/lit_float_bad_exponent_sign_later.zc b/tests/conformance/1-source/lit_float_bad_exponent_sign_later.zc
new file mode 100644
index 0000000..5e36728
--- /dev/null
+++ b/tests/conformance/1-source/lit_float_bad_exponent_sign_later.zc
@@ -0,0 +1,5 @@
+// expect error: bad float
+// spec 1.4.3
+include rt;
+void pn(int x) { rt.put_n(x); rt.put_c(10); }
+fn main() { pn(1); rt.put_n(1.5e+); return 0; }
diff --git a/tests/conformance/1-source/lit_float_dot_forms.zc b/tests/conformance/1-source/lit_float_dot_forms.zc
new file mode 100644
index 0000000..c5e3328
--- /dev/null
+++ b/tests/conformance/1-source/lit_float_dot_forms.zc
@@ -0,0 +1,14 @@
+// expect: 1/1/1/
+// spec 1.4.3: 1. ends the literal when no digit, e or E follows; 1.e3 and 1.5e-3 are fractions
+include rt;
+void pn(int x) { rt.put_n(x); rt.put_c(10); }
+fn pf(x) { asm { x @ #1220 } rt.put_c(10); return 0; }
+fn main() {
+ float a = 1.;
+ pn(a == 1.0);
+ float b = 1.e0;
+ pn(b == 1.0);
+ float c = 5e-1;
+ pn(c == 0.5);
+ return 0;
+}
diff --git a/tests/conformance/1-source/lit_float_dot_letter_is_field.zc b/tests/conformance/1-source/lit_float_dot_letter_is_field.zc
new file mode 100644
index 0000000..469ce80
--- /dev/null
+++ b/tests/conformance/1-source/lit_float_dot_letter_is_field.zc
@@ -0,0 +1,6 @@
+// expect: 0/
+include rt;
+struct zbox { int zfld; }
+void pn(int x) { rt.put_n(x); rt.put_c(10); }
+fn main() { pn(2.zfld * 0); return 0; }
+// zc0: skip
diff --git a/tests/conformance/1-source/lit_float_exponent_negative_digit.zc b/tests/conformance/1-source/lit_float_exponent_negative_digit.zc
new file mode 100644
index 0000000..0ae3b64
--- /dev/null
+++ b/tests/conformance/1-source/lit_float_exponent_negative_digit.zc
@@ -0,0 +1,4 @@
+// expect: 0.250000/
+include rt;
+fn pf(x) { asm { x @ #1220 } rt.put_c(10); return 0; }
+fn main() { pf(25e-2); return 0; }
diff --git a/tests/conformance/1-source/lit_float_forms.zc b/tests/conformance/1-source/lit_float_forms.zc
new file mode 100644
index 0000000..80af566
--- /dev/null
+++ b/tests/conformance/1-source/lit_float_forms.zc
@@ -0,0 +1,7 @@
+// expect: 1.500000/1.000000/0.500000/1000.000000/0.001500/1000.000000/1000.000000/1000.000000/
+include rt;
+fn pf(x) { asm { x @ #1220 } rt.put_c(10); return 0; }
+fn main() {
+ pf(1.5); pf(1.); pf(.5); pf(1e3); pf(1.5e-3); pf(1E+3); pf(1.e3); pf(1e+3);
+ return 0;
+}
diff --git a/tests/conformance/1-source/lit_float_is_float_type.zc b/tests/conformance/1-source/lit_float_is_float_type.zc
new file mode 100644
index 0000000..0474747
--- /dev/null
+++ b/tests/conformance/1-source/lit_float_is_float_type.zc
@@ -0,0 +1,10 @@
+// expect: 2.500000/7.000000/
+// spec 1.4.3: the type of a float literal is float; spec 3.5.1 an int operand converts by value
+include rt;
+void pn(int x) { rt.put_n(x); rt.put_c(10); }
+fn pf(x) { asm { x @ #1220 } rt.put_c(10); return 0; }
+fn main() {
+ pf(1.25 * 2);
+ pf(3 + 4.0);
+ return 0;
+}
diff --git a/tests/conformance/1-source/lit_hex.zc b/tests/conformance/1-source/lit_hex.zc
new file mode 100644
index 0000000..e326b9a
--- /dev/null
+++ b/tests/conformance/1-source/lit_hex.zc
@@ -0,0 +1,4 @@
+// expect: 171/171/255/9223372036854775807/-1/
+include rt;
+void pn(int x) { rt.put_n(x); rt.put_c(10); }
+fn main() { pn(0xAB); pn(0Xab); pn(0xfF); pn(0x7fffffffffffffff); pn(0xFFFFFFFFFFFFFFFF); return 0; }
diff --git a/tests/conformance/1-source/lit_hex_letter_after_0x_new_token.zc b/tests/conformance/1-source/lit_hex_letter_after_0x_new_token.zc
new file mode 100644
index 0000000..684195e
--- /dev/null
+++ b/tests/conformance/1-source/lit_hex_letter_after_0x_new_token.zc
@@ -0,0 +1,5 @@
+// expect error: zc: line
+// spec 1.4.1: 0x with no digits is 0 and a letter after it starts a new token (0xg is 0 then the name g)
+include rt;
+void pn(int x) { rt.put_n(x); rt.put_c(10); }
+fn main() { pn(0xg); return 0; }
diff --git a/tests/conformance/1-source/lit_hex_no_digits_is_zero.zc b/tests/conformance/1-source/lit_hex_no_digits_is_zero.zc
new file mode 100644
index 0000000..6cae9b4
--- /dev/null
+++ b/tests/conformance/1-source/lit_hex_no_digits_is_zero.zc
@@ -0,0 +1,4 @@
+// expect: 0/
+include rt;
+void pn(int x) { rt.put_n(x); rt.put_c(10); }
+fn main() { pn(0x); return 0; }
diff --git a/tests/conformance/1-source/lit_hex_wide.zc b/tests/conformance/1-source/lit_hex_wide.zc
new file mode 100644
index 0000000..7b841da
--- /dev/null
+++ b/tests/conformance/1-source/lit_hex_wide.zc
@@ -0,0 +1,5 @@
+// expect: 4096/48879/-1/
+// spec 1.4.1
+include rt;
+void pn(int x) { rt.put_n(x); rt.put_c(10); }
+fn main() { pn(0x1000); pn(0XBeEf); pn(0xffffffffffffffff); return 0; }
diff --git a/tests/conformance/1-source/lit_hex_wraps.zc b/tests/conformance/1-source/lit_hex_wraps.zc
new file mode 100644
index 0000000..cb71526
--- /dev/null
+++ b/tests/conformance/1-source/lit_hex_wraps.zc
@@ -0,0 +1,4 @@
+// expect: 1/
+include rt;
+void pn(int x) { rt.put_n(x); rt.put_c(10); }
+fn main() { pn(0x10000000000000001); return 0; }
diff --git a/tests/conformance/1-source/lit_int_max.zc b/tests/conformance/1-source/lit_int_max.zc
new file mode 100644
index 0000000..439d6aa
--- /dev/null
+++ b/tests/conformance/1-source/lit_int_max.zc
@@ -0,0 +1,5 @@
+// expect: 9223372036854775807/-9223372036854775808/-1/
+// spec 1.4.1: wraps modulo 2^64
+include rt;
+void pn(int x) { rt.put_n(x); rt.put_c(10); }
+fn main() { pn(9223372036854775807); pn(9223372036854775808); pn(18446744073709551615); return 0; }
diff --git a/tests/conformance/1-source/lit_int_octal_is_decimal.zc b/tests/conformance/1-source/lit_int_octal_is_decimal.zc
new file mode 100644
index 0000000..1099694
--- /dev/null
+++ b/tests/conformance/1-source/lit_int_octal_is_decimal.zc
@@ -0,0 +1,4 @@
+// expect: 10/18/
+include rt;
+void pn(int x) { rt.put_n(x); rt.put_c(10); }
+fn main() { pn(010); pn(018); return 0; }
diff --git a/tests/conformance/1-source/lit_int_type_is_int_never_negative.zc b/tests/conformance/1-source/lit_int_type_is_int_never_negative.zc
new file mode 100644
index 0000000..57b483e
--- /dev/null
+++ b/tests/conformance/1-source/lit_int_type_is_int_never_negative.zc
@@ -0,0 +1,5 @@
+// expect: 1/-5/
+// spec 1.4.1: a literal is never negative, -5 is unary minus on 5
+include rt;
+void pn(int x) { rt.put_n(x); rt.put_c(10); }
+fn main() { pn(-5 < 0 && 5 > 0); pn(-5); return 0; }
diff --git a/tests/conformance/1-source/lit_int_wraps.zc b/tests/conformance/1-source/lit_int_wraps.zc
new file mode 100644
index 0000000..6520f26
--- /dev/null
+++ b/tests/conformance/1-source/lit_int_wraps.zc
@@ -0,0 +1,4 @@
+// expect: 7766279631452241919/
+include rt;
+void pn(int x) { rt.put_n(x); rt.put_c(10); }
+fn main() { pn(99999999999999999999); return 0; }
diff --git a/tests/conformance/1-source/lit_int_zero_and_leading_zeros.zc b/tests/conformance/1-source/lit_int_zero_and_leading_zeros.zc
new file mode 100644
index 0000000..e47f989
--- /dev/null
+++ b/tests/conformance/1-source/lit_int_zero_and_leading_zeros.zc
@@ -0,0 +1,5 @@
+// expect: 0/7/100/
+// spec 1.4.1: decimal, no octal
+include rt;
+void pn(int x) { rt.put_n(x); rt.put_c(10); }
+fn main() { pn(0); pn(007); pn(0100); return 0; }
diff --git a/tests/conformance/1-source/lit_minus_folded.zc b/tests/conformance/1-source/lit_minus_folded.zc
new file mode 100644
index 0000000..82e5601
--- /dev/null
+++ b/tests/conformance/1-source/lit_minus_folded.zc
@@ -0,0 +1,4 @@
+// expect: -5/-9223372036854775808/
+include rt;
+void pn(int x) { rt.put_n(x); rt.put_c(10); }
+fn main() { pn(-5); pn(-9223372036854775808); return 0; }
diff --git a/tests/conformance/1-source/lit_no_binary.zc b/tests/conformance/1-source/lit_no_binary.zc
new file mode 100644
index 0000000..33f5555
--- /dev/null
+++ b/tests/conformance/1-source/lit_no_binary.zc
@@ -0,0 +1,7 @@
+// expect error: zc: line 4:
+include rt;
+fn main() {
+ rt.put_n(0b101);
+ return 0;
+}
+// zc0: error
diff --git a/tests/conformance/1-source/lit_no_digit_separator.zc b/tests/conformance/1-source/lit_no_digit_separator.zc
new file mode 100644
index 0000000..eeab051
--- /dev/null
+++ b/tests/conformance/1-source/lit_no_digit_separator.zc
@@ -0,0 +1,7 @@
+// expect error: zc: line 4:
+include rt;
+fn main() {
+ rt.put_n(1_000);
+ return 0;
+}
+// zc0: error
diff --git a/tests/conformance/1-source/lit_no_suffix.zc b/tests/conformance/1-source/lit_no_suffix.zc
new file mode 100644
index 0000000..7c3d1dd
--- /dev/null
+++ b/tests/conformance/1-source/lit_no_suffix.zc
@@ -0,0 +1,7 @@
+// expect error: zc: line 4:
+include rt;
+fn main() {
+ rt.put_n(10u);
+ return 0;
+}
+// zc0: error
diff --git a/tests/conformance/1-source/lit_str_adjacent_not_joined.zc b/tests/conformance/1-source/lit_str_adjacent_not_joined.zc
new file mode 100644
index 0000000..1d1bfc5
--- /dev/null
+++ b/tests/conformance/1-source/lit_str_adjacent_not_joined.zc
@@ -0,0 +1,7 @@
+// expect error: zc: line 4:
+include rt;
+fn main() {
+ rt.put_s("a" "b");
+ return 0;
+}
+// zc0: error
diff --git a/tests/conformance/1-source/lit_str_empty.zc b/tests/conformance/1-source/lit_str_empty.zc
new file mode 100644
index 0000000..ef388be
--- /dev/null
+++ b/tests/conformance/1-source/lit_str_empty.zc
@@ -0,0 +1,5 @@
+// expect: 0/0/
+// spec 1.4.4
+include rt;
+void pn(int x) { rt.put_n(x); rt.put_c(10); }
+fn main() { char* s = ""; pn(rt.len_w(s)); pn(s[0]); return 0; }
diff --git a/tests/conformance/1-source/lit_str_escapes.zc b/tests/conformance/1-source/lit_str_escapes.zc
new file mode 100644
index 0000000..c7077f6
--- /dev/null
+++ b/tests/conformance/1-source/lit_str_escapes.zc
@@ -0,0 +1,8 @@
+// expect: 9/10/34/92/101/
+include rt;
+void pn(int x) { rt.put_n(x); rt.put_c(10); }
+fn main() {
+ char* s = "\t\n\"\\e";
+ pn(s[0]); pn(s[1]); pn(s[2]); pn(s[3]); pn(s[4]);
+ return 0;
+}
diff --git a/tests/conformance/1-source/lit_str_hex_escape_is_plain_char.zc b/tests/conformance/1-source/lit_str_hex_escape_is_plain_char.zc
new file mode 100644
index 0000000..2cf8e17
--- /dev/null
+++ b/tests/conformance/1-source/lit_str_hex_escape_is_plain_char.zc
@@ -0,0 +1,5 @@
+// expect: 120/
+// spec 1.4.2: a backslash before any other character is that character
+include rt;
+void pn(int x) { rt.put_n(x); rt.put_c(10); }
+fn main() { pn("\x"[0]); return 0; }
diff --git a/tests/conformance/1-source/lit_str_high_byte_one_word_each.zc b/tests/conformance/1-source/lit_str_high_byte_one_word_each.zc
new file mode 100644
index 0000000..4827ada
--- /dev/null
+++ b/tests/conformance/1-source/lit_str_high_byte_one_word_each.zc
@@ -0,0 +1,5 @@
+// expect: 195/169/
+// spec 1.1.1: a byte of 128 or more in a string literal is one word of the string
+include rt;
+void pn(int x) { rt.put_n(x); rt.put_c(10); }
+fn main() { char* s = "é"; pn(s[0]); pn(s[1]); return 0; }
diff --git a/tests/conformance/1-source/lit_str_nul_truncates.zc b/tests/conformance/1-source/lit_str_nul_truncates.zc
new file mode 100644
index 0000000..9144cc1
--- /dev/null
+++ b/tests/conformance/1-source/lit_str_nul_truncates.zc
@@ -0,0 +1,4 @@
+// expect: 2/ab/
+include rt;
+void pn(int x) { rt.put_n(x); rt.put_c(10); }
+fn main() { pn(rt.len_w("ab\0cd")); rt.put_s("ab\0cd"); rt.put_c(10); return 0; }
diff --git a/tests/conformance/1-source/lit_str_raw_newline.zc b/tests/conformance/1-source/lit_str_raw_newline.zc
new file mode 100644
index 0000000..de02e45
--- /dev/null
+++ b/tests/conformance/1-source/lit_str_raw_newline.zc
@@ -0,0 +1,9 @@
+// expect: 3/10/
+include rt;
+void pn(int x) { rt.put_n(x); rt.put_c(10); }
+fn main() {
+ char* s = "a
+b";
+ pn(rt.len_w(s)); pn(s[1]);
+ return 0;
+}
diff --git a/tests/conformance/1-source/lit_str_unterminated.zc b/tests/conformance/1-source/lit_str_unterminated.zc
new file mode 100644
index 0000000..6639741
--- /dev/null
+++ b/tests/conformance/1-source/lit_str_unterminated.zc
@@ -0,0 +1,4 @@
+// expect error: zc: line
+include rt;
+fn main() { rt.put_s("abc); return 0; }
+// zc0: error
diff --git a/tests/conformance/1-source/lit_str_utf8_bytes.zc b/tests/conformance/1-source/lit_str_utf8_bytes.zc
new file mode 100644
index 0000000..3c1d07a
--- /dev/null
+++ b/tests/conformance/1-source/lit_str_utf8_bytes.zc
@@ -0,0 +1,4 @@
+// expect: 6/
+include rt;
+void pn(int x) { rt.put_n(x); rt.put_c(10); }
+fn main() { pn(rt.len_w("héllo")); return 0; }
diff --git a/tests/conformance/1-source/lit_str_word_per_cell.zc b/tests/conformance/1-source/lit_str_word_per_cell.zc
new file mode 100644
index 0000000..ab214c0
--- /dev/null
+++ b/tests/conformance/1-source/lit_str_word_per_cell.zc
@@ -0,0 +1,9 @@
+// expect: 65/66/0/3/
+include rt;
+void pn(int x) { rt.put_n(x); rt.put_c(10); }
+fn main() {
+ char* s = "AB";
+ pn(s[0]); pn(s[1]); pn(s[2]);
+ pn(rt.len_w("xyz"));
+ return 0;
+}
diff --git a/tests/conformance/1-source/lit_str_zero_terminated.zc b/tests/conformance/1-source/lit_str_zero_terminated.zc
new file mode 100644
index 0000000..846294a
--- /dev/null
+++ b/tests/conformance/1-source/lit_str_zero_terminated.zc
@@ -0,0 +1,5 @@
+// expect: 3/0/
+// spec 1.4.4: stored one per word, followed by a 0 word
+include rt;
+void pn(int x) { rt.put_n(x); rt.put_c(10); }
+fn main() { char* s = "abc"; pn(rt.len_w(s)); pn(s[3]); return 0; }
diff --git a/tests/conformance/1-source/module_join_hidden_by_local.zc b/tests/conformance/1-source/module_join_hidden_by_local.zc
new file mode 100644
index 0000000..294f9ec
--- /dev/null
+++ b/tests/conformance/1-source/module_join_hidden_by_local.zc
@@ -0,0 +1,10 @@
+// expect: 4/
+include rt;
+struct pt { int x; int y; }
+fn main() {
+ pt* std = rt.new(pt);
+ std.x = 4;
+ rt.put_n(std.x); rt.put_c(10);
+ return 0;
+}
+// zc0: skip
diff --git a/tests/conformance/1-source/module_join_known_name_not_module.zc b/tests/conformance/1-source/module_join_known_name_not_module.zc
new file mode 100644
index 0000000..3c98fb5
--- /dev/null
+++ b/tests/conformance/1-source/module_join_known_name_not_module.zc
@@ -0,0 +1,7 @@
+// expect: 7/
+// spec 1.3.3: x.y with x not a known module is field access
+include rt;
+void pn(int x) { rt.put_n(x); rt.put_c(10); }
+struct pt { int x; int y; }
+fn main() { pt* q = rt.new(pt); q.y = 7; pn(q.y); rt.free(q); return 0; }
+// zc0: skip
diff --git a/tests/conformance/1-source/module_join_needs_include.zc b/tests/conformance/1-source/module_join_needs_include.zc
new file mode 100644
index 0000000..671fd38
--- /dev/null
+++ b/tests/conformance/1-source/module_join_needs_include.zc
@@ -0,0 +1,2 @@
+// expect error: module access requires `include rt;`
+fn main() { rt.put_c(65); return 0; }
diff --git a/tests/conformance/1-source/module_join_one_dot_only.zc b/tests/conformance/1-source/module_join_one_dot_only.zc
new file mode 100644
index 0000000..c63db40
--- /dev/null
+++ b/tests/conformance/1-source/module_join_one_dot_only.zc
@@ -0,0 +1,5 @@
+// expect error: zc: line
+// spec 1.3.3: rt.x.y is the token rt.x then . then y
+include rt;
+void pn(int x) { rt.put_n(x); rt.put_c(10); }
+fn main() { rt.put_c.zz(1); return 0; }
diff --git a/tests/conformance/1-source/module_join_prints_A.zc b/tests/conformance/1-source/module_join_prints_A.zc
new file mode 100644
index 0000000..f255fc4
--- /dev/null
+++ b/tests/conformance/1-source/module_join_prints_A.zc
@@ -0,0 +1,3 @@
+// expect: A/
+include rt;
+fn main() { rt.put_c(65); rt.put_c(10); return 0; }
diff --git a/tests/conformance/1-source/module_unqualified_rt_name.zc b/tests/conformance/1-source/module_unqualified_rt_name.zc
new file mode 100644
index 0000000..6acc581
--- /dev/null
+++ b/tests/conformance/1-source/module_unqualified_rt_name.zc
@@ -0,0 +1,2 @@
+// expect error: put_c is used but never defined
+fn main() { put_c(65); return 0; }
diff --git a/tests/conformance/1-source/op_compound_all.zc b/tests/conformance/1-source/op_compound_all.zc
new file mode 100644
index 0000000..ab7a1ef
--- /dev/null
+++ b/tests/conformance/1-source/op_compound_all.zc
@@ -0,0 +1,15 @@
+// expect: 14/7/21/5/1/12/4/2/
+include rt;
+void pn(int x) { rt.put_n(x); rt.put_c(10); }
+fn main() {
+ int a = 7;
+ a += 7; pn(a);
+ a -= 7; pn(a);
+ a *= 3; pn(a);
+ a /= 4; pn(a);
+ a %= 2; pn(a);
+ a = 12; pn(a);
+ a &= 6; pn(a);
+ a ^= 6; pn(a);
+ return 0;
+}
diff --git a/tests/conformance/1-source/op_compound_or.zc b/tests/conformance/1-source/op_compound_or.zc
new file mode 100644
index 0000000..f76339a
--- /dev/null
+++ b/tests/conformance/1-source/op_compound_or.zc
@@ -0,0 +1,4 @@
+// expect: 7/
+include rt;
+void pn(int x) { rt.put_n(x); rt.put_c(10); }
+fn main() { int a = 5; a |= 2; pn(a); return 0; }
diff --git a/tests/conformance/1-source/op_greedy_compound_shift.zc b/tests/conformance/1-source/op_greedy_compound_shift.zc
new file mode 100644
index 0000000..697aad5
--- /dev/null
+++ b/tests/conformance/1-source/op_greedy_compound_shift.zc
@@ -0,0 +1,4 @@
+// expect: 12/3/
+include rt;
+void pn(int x) { rt.put_n(x); rt.put_c(10); }
+fn main() { int a = 3; a<<=2; pn(a); a>>=2; pn(a); return 0; }
diff --git a/tests/conformance/1-source/op_incr_decr_split.zc b/tests/conformance/1-source/op_incr_decr_split.zc
new file mode 100644
index 0000000..48dba51
--- /dev/null
+++ b/tests/conformance/1-source/op_incr_decr_split.zc
@@ -0,0 +1,4 @@
+// expect: 1/4/
+include rt;
+void pn(int x) { rt.put_n(x); rt.put_c(10); }
+fn main() { int a = 3, b = 2; int c = a---b; int e = a+++b; pn(c); pn(e); return 0; }
diff --git a/tests/conformance/1-source/op_lexing_a_minus_minus_b.zc b/tests/conformance/1-source/op_lexing_a_minus_minus_b.zc
new file mode 100644
index 0000000..360f132
--- /dev/null
+++ b/tests/conformance/1-source/op_lexing_a_minus_minus_b.zc
@@ -0,0 +1,5 @@
+// expect: 5/
+// spec 1.6.2: greedy: a---b is a-- - b
+include rt;
+void pn(int x) { rt.put_n(x); rt.put_c(10); }
+fn main() { int a = 6, b = 1; pn(a---b); return 0; }
diff --git a/tests/conformance/1-source/op_no_space_needed_lt_neg.zc b/tests/conformance/1-source/op_no_space_needed_lt_neg.zc
new file mode 100644
index 0000000..57d7ad4
--- /dev/null
+++ b/tests/conformance/1-source/op_no_space_needed_lt_neg.zc
@@ -0,0 +1,4 @@
+// expect: 0/1/
+include rt;
+void pn(int x) { rt.put_n(x); rt.put_c(10); }
+fn main() { int a = 1, b = 2; pn(a<-b); pn(a>-b); return 0; }
diff --git a/tests/conformance/1-source/op_non_ascii_byte_error.zc b/tests/conformance/1-source/op_non_ascii_byte_error.zc
new file mode 100644
index 0000000..94e293c
--- /dev/null
+++ b/tests/conformance/1-source/op_non_ascii_byte_error.zc
@@ -0,0 +1,7 @@
+// expect error: zc: line 4:
+include rt;
+fn main() {
+ int x = ¢;
+ return 0;
+}
+// zc0: error
diff --git a/tests/conformance/1-source/op_not_not.zc b/tests/conformance/1-source/op_not_not.zc
new file mode 100644
index 0000000..657a106
--- /dev/null
+++ b/tests/conformance/1-source/op_not_not.zc
@@ -0,0 +1,4 @@
+// expect: 1/0/1/0/
+include rt;
+void pn(int x) { rt.put_n(x); rt.put_c(10); }
+fn main() { pn(!!7); pn(!!0); pn(!0); pn(!!!7); return 0; }
diff --git a/tests/conformance/1-source/op_star_neg_and_assign_neg.zc b/tests/conformance/1-source/op_star_neg_and_assign_neg.zc
new file mode 100644
index 0000000..14993a4
--- /dev/null
+++ b/tests/conformance/1-source/op_star_neg_and_assign_neg.zc
@@ -0,0 +1,4 @@
+// expect: -2/-2/
+include rt;
+void pn(int x) { rt.put_n(x); rt.put_c(10); }
+fn main() { int a = 1, b = 2; int c = a*-b; int d; d=-b; pn(c); pn(d); return 0; }
diff --git a/tests/conformance/1-source/op_ternary_colon_tokens.zc b/tests/conformance/1-source/op_ternary_colon_tokens.zc
new file mode 100644
index 0000000..8d154f9
--- /dev/null
+++ b/tests/conformance/1-source/op_ternary_colon_tokens.zc
@@ -0,0 +1,6 @@
+// expect: 2/
+// spec 1.6.1
+include rt;
+void pn(int x) { rt.put_n(x); rt.put_c(10); }
+fn main() { int a = 1; pn(a ? 2 : 3); return 0; }
+// zc0: skip
diff --git a/tests/conformance/1-source/op_unknown_char.zc b/tests/conformance/1-source/op_unknown_char.zc
new file mode 100644
index 0000000..9de4300
--- /dev/null
+++ b/tests/conformance/1-source/op_unknown_char.zc
@@ -0,0 +1,5 @@
+// expect error: zc: line
+// spec 1.6.1: other punctuation is not an operator
+include rt;
+void pn(int x) { rt.put_n(x); rt.put_c(10); }
+fn main() { int x = 3 \ 4; return 0; }
diff --git a/tests/conformance/1-source/unit_ends_at_backtick.zc b/tests/conformance/1-source/unit_ends_at_backtick.zc
new file mode 100644
index 0000000..7bffa02
--- /dev/null
+++ b/tests/conformance/1-source/unit_ends_at_backtick.zc
@@ -0,0 +1,4 @@
+// expect: 5/
+include rt;
+fn main() { rt.put_n(5); rt.put_c(10); return 0; }
+` this is not compiled @@@ ~~~ ((( int int int
diff --git a/tests/conformance/1-source/unit_ends_at_backtick_first_line.zc b/tests/conformance/1-source/unit_ends_at_backtick_first_line.zc
new file mode 100644
index 0000000..8611df8
--- /dev/null
+++ b/tests/conformance/1-source/unit_ends_at_backtick_first_line.zc
@@ -0,0 +1,6 @@
+// expect: 7/
+// spec 1.1.3 and 1.5.1: the source-ending backtick ends the unit, the rest is stdin
+include rt;
+void pn(int x) { rt.put_n(x); rt.put_c(10); }
+fn main() { int c = rt.get_c(); pn(c - 'a' + 7); return 0; }
+`a
diff --git a/tests/conformance/1-source/unit_eof_ends_unit.zc b/tests/conformance/1-source/unit_eof_ends_unit.zc
new file mode 100644
index 0000000..99dff1c
--- /dev/null
+++ b/tests/conformance/1-source/unit_eof_ends_unit.zc
@@ -0,0 +1,6 @@
+// expect: 1/
+// spec 1.1.3: a unit ends at end of input
+include rt;
+void pn(int x) { rt.put_n(x); rt.put_c(10); }
+fn main() { pn(1); return 0; }
+
diff --git a/tests/conformance/1-source/ws_basic.zc b/tests/conformance/1-source/ws_basic.zc
new file mode 100644
index 0000000..34e0461
--- /dev/null
+++ b/tests/conformance/1-source/ws_basic.zc
@@ -0,0 +1,11 @@
+// expect: 3/
+include rt;
+fn main() {
+ int a = 1 ;
+ int
+ b
+ =
+ 2
+ ;
+ rt.put_n(a+b); rt.put_c(10); return 0;
+}
diff --git a/tests/conformance/1-source/ws_carriage_return_tab_ff.zc b/tests/conformance/1-source/ws_carriage_return_tab_ff.zc
new file mode 100644
index 0000000..1c6c5b2
--- /dev/null
+++ b/tests/conformance/1-source/ws_carriage_return_tab_ff.zc
@@ -0,0 +1,5 @@
+// expect: 3/
+// spec 1.1.2: white space is space, tab, line feed, carriage return
+include rt;
+void pn(int x) { rt.put_n(x); rt.put_c(10); }
+fn main() { int a = 1; int b = 2; pn(a + b); return 0; }
diff --git a/tests/conformance/1-source/ws_no_space_needed_between_tokens.zc b/tests/conformance/1-source/ws_no_space_needed_between_tokens.zc
new file mode 100644
index 0000000..e19542a
--- /dev/null
+++ b/tests/conformance/1-source/ws_no_space_needed_between_tokens.zc
@@ -0,0 +1,5 @@
+// expect: 5/
+// spec 1.1.2
+include rt;
+void pn(int x) { rt.put_n(x); rt.put_c(10); }
+fn main(){int a=2;int b=3;pn(a+b);return 0;}