From 61fb44bbce2a5257587b25f61f7f40ba32078a83 Mon Sep 17 00:00:00 2001 From: Danila Fedorin Date: Sun, 5 Aug 2018 14:25:40 -0700 Subject: [PATCH] Add more small test programs. --- ...{arithmetic.chalk => basic_arithmetic.chalk} | 0 programs/{call.chalk => basic_call.chalk} | 0 programs/basic_draw_number.chalk | 3 +++ programs/{empty.chalk => basic_empty.chalk} | 0 programs/basic_if.chalk | 17 +++++++++++++++++ programs/basic_input.chalk | 4 ++++ programs/basic_while.chalk | 8 ++++++++ programs/comb_fib.chalk | 14 ++++++++++++++ programs/comb_input.chalk | 13 +++++++++++++ 9 files changed, 59 insertions(+) rename programs/{arithmetic.chalk => basic_arithmetic.chalk} (100%) rename programs/{call.chalk => basic_call.chalk} (100%) create mode 100644 programs/basic_draw_number.chalk rename programs/{empty.chalk => basic_empty.chalk} (100%) create mode 100644 programs/basic_if.chalk create mode 100644 programs/basic_input.chalk create mode 100644 programs/basic_while.chalk create mode 100644 programs/comb_fib.chalk create mode 100644 programs/comb_input.chalk diff --git a/programs/arithmetic.chalk b/programs/basic_arithmetic.chalk similarity index 100% rename from programs/arithmetic.chalk rename to programs/basic_arithmetic.chalk diff --git a/programs/call.chalk b/programs/basic_call.chalk similarity index 100% rename from programs/call.chalk rename to programs/basic_call.chalk diff --git a/programs/basic_draw_number.chalk b/programs/basic_draw_number.chalk new file mode 100644 index 0000000..2489faf --- /dev/null +++ b/programs/basic_draw_number.chalk @@ -0,0 +1,3 @@ +fun main(): u0 { + draw_number(69, 1, 1); +} diff --git a/programs/empty.chalk b/programs/basic_empty.chalk similarity index 100% rename from programs/empty.chalk rename to programs/basic_empty.chalk diff --git a/programs/basic_if.chalk b/programs/basic_if.chalk new file mode 100644 index 0000000..10a4c6b --- /dev/null +++ b/programs/basic_if.chalk @@ -0,0 +1,17 @@ +fun main(): u0 { + var a = 3+3; + if(a) { + a = 0; + } + + var b = 0; + if(b) { + b = 4; + } + + if(b) { + b = 4; + } else { + b = 5; + } +} diff --git a/programs/basic_input.chalk b/programs/basic_input.chalk new file mode 100644 index 0000000..c8ebd4c --- /dev/null +++ b/programs/basic_input.chalk @@ -0,0 +1,4 @@ +fun main(): u0 { + var a = get_key(); + var b = get_key(); +} diff --git a/programs/basic_while.chalk b/programs/basic_while.chalk new file mode 100644 index 0000000..9c52d59 --- /dev/null +++ b/programs/basic_while.chalk @@ -0,0 +1,8 @@ +fun main(): u0 { + var a = 5; + var b = 0; + while(a) { + b = b + 2; + a = a - 1; + } +} diff --git a/programs/comb_fib.chalk b/programs/comb_fib.chalk new file mode 100644 index 0000000..f37d584 --- /dev/null +++ b/programs/comb_fib.chalk @@ -0,0 +1,14 @@ +fun main(): u0 { + var a = 1; + var b = 1; + while(233 - a) { + draw_number(a, 24, 13); + set_delay(30); + var temp = a; + a = b; + b = b + temp; + while(get_delay()){} + draw_number(temp, 24, 13); + } + draw_number(a, 24, 13); +} diff --git a/programs/comb_input.chalk b/programs/comb_input.chalk new file mode 100644 index 0000000..2468495 --- /dev/null +++ b/programs/comb_input.chalk @@ -0,0 +1,13 @@ +fun main(): u0 { + var a = 1; + var b = 0; + var previous = 0; + draw_number(0, 24, 13); + + while(a) { + previous = b; + b = get_key(); + draw_number(previous, 24, 13); + draw_number(b, 24, 13); + } +}