about summary refs log tree commit diff stats
path: root/js/scripting-lang/tests
diff options
context:
space:
mode:
Diffstat (limited to 'js/scripting-lang/tests')
-rw-r--r--js/scripting-lang/tests/05_io_operations.txt37
-rw-r--r--js/scripting-lang/tests/06_function_definitions.txt4
-rw-r--r--js/scripting-lang/tests/07_case_expressions.txt14
-rw-r--r--js/scripting-lang/tests/10_standard_library.txt9
-rw-r--r--js/scripting-lang/tests/11_edge_cases.txt10
-rw-r--r--js/scripting-lang/tests/13_standard_library_complete.txt2
-rw-r--r--js/scripting-lang/tests/14_error_handling.txt2
-rw-r--r--js/scripting-lang/tests/15_performance_stress.txt32
-rw-r--r--js/scripting-lang/tests/16_function_composition.txt59
-rw-r--r--js/scripting-lang/tests/17_table_enhancements.txt234
-rw-r--r--js/scripting-lang/tests/17_table_enhancements_minimal.txt31
-rw-r--r--js/scripting-lang/tests/17_table_enhancements_step1.txt41
-rw-r--r--js/scripting-lang/tests/18_each_combinator.txt22
-rw-r--r--js/scripting-lang/tests/18_each_combinator_basic.txt30
-rw-r--r--js/scripting-lang/tests/18_each_combinator_minimal.txt62
-rw-r--r--js/scripting-lang/tests/19_embedded_functions.txt101
-rw-r--r--js/scripting-lang/tests/19_embedded_functions_simple.txt101
-rw-r--r--js/scripting-lang/tests/20_via_operator.txt31
-rw-r--r--js/scripting-lang/tests/21_enhanced_case_statements.txt98
-rw-r--r--js/scripting-lang/tests/21_enhanced_case_statements_fixed.txt98
-rw-r--r--js/scripting-lang/tests/22_parser_limitations.txt115
-rw-r--r--js/scripting-lang/tests/23_minus_operator_spacing.txt51
-rw-r--r--js/scripting-lang/tests/dev_01_simple_test.txt9
-rw-r--r--js/scripting-lang/tests/dev_02_test_parser_changes.txt35
-rw-r--r--js/scripting-lang/tests/integration_01_basic_features.txt2
-rw-r--r--js/scripting-lang/tests/integration_04_mini_case_multi_param.txt34
-rw-r--r--js/scripting-lang/tests/repl_demo.txt180
27 files changed, 1342 insertions, 102 deletions
diff --git a/js/scripting-lang/tests/05_io_operations.txt b/js/scripting-lang/tests/05_io_operations.txt
index a16bf94..6d05dfe 100644
--- a/js/scripting-lang/tests/05_io_operations.txt
+++ b/js/scripting-lang/tests/05_io_operations.txt
@@ -1,5 +1,5 @@
 /* Unit Test: IO Operations */
-/* Tests: ..out, ..assert operations */
+/* Tests: ..out, ..assert, ..listen, ..emit operations */
 
 /* Test basic output */
 ..out "Testing IO operations";
@@ -25,4 +25,39 @@ sum : x + y;
 ..assert (x * y) = 15;
 ..assert (x > y) = true;
 
+/* Test ..listen functionality */
+state : ..listen;
+..assert state.status = "placeholder";
+..assert state.message = "State not available in standalone mode";
+
+/* Test ..listen in when expression */
+result : when ..listen is
+    { status: "placeholder" } then "Placeholder detected"
+    { status: "active" } then "Active state detected"
+    _ then "Unknown state";
+..assert result = "Placeholder detected";
+
+/* Test ..emit with different data types */
+..emit "String value";
+..emit 42;
+..emit true;
+..emit { key: "value", number: 123 };
+
+/* Test ..emit with computed expressions */
+computed_table : { a: 10, b: 20 };
+computed_sum : computed_table.a + computed_table.b;
+..emit computed_sum;
+
+/* Test ..emit with conditional logic */
+condition : 10 > 5;
+message : when condition is
+    true then "Condition is true"
+    false then "Condition is false";
+..emit message;
+
+/* Test that ..emit doesn't interfere with ..out */
+..out "This should appear via ..out";
+..emit "This should appear via ..emit";
+..out "Another ..out message";
+
 ..out "IO operations test completed"; 
\ No newline at end of file
diff --git a/js/scripting-lang/tests/06_function_definitions.txt b/js/scripting-lang/tests/06_function_definitions.txt
index a34da72..b0e591f 100644
--- a/js/scripting-lang/tests/06_function_definitions.txt
+++ b/js/scripting-lang/tests/06_function_definitions.txt
@@ -23,8 +23,8 @@ result5 : identity_func 42;
 ..assert result5 = 42;
 
 /* Test function calls with parentheses */
-result6 : add_func (3 + 2) (4 + 1);
-result7 : multiply_func (double_func 3) (square_func 2);
+result6 : add_func @(3 + 2) @(4 + 1);
+result7 : multiply_func @(double_func 3) @(square_func 2);
 
 ..assert result6 = 10;
 ..assert result7 = 24;
diff --git a/js/scripting-lang/tests/07_case_expressions.txt b/js/scripting-lang/tests/07_case_expressions.txt
index 83bd1bb..ccc447c 100644
--- a/js/scripting-lang/tests/07_case_expressions.txt
+++ b/js/scripting-lang/tests/07_case_expressions.txt
@@ -5,13 +5,13 @@
 factorial : n -> 
   when n is
     0 then 1
-    _ then n * (factorial (n - 1));
+    _ then n * (@factorial (n - 1));
 
 grade : score -> 
   when score is
-    90 then "A"
-    80 then "B"
-    70 then "C"
+    score >= 90 then "A"
+    score >= 80 then "B"
+    score >= 70 then "C"
     _  then "F";
 
 /* Test case expressions */
@@ -22,9 +22,9 @@ grade3 : grade 65;
 
 /* Test results */
 ..assert fact5 = 120;
-..assert grade1 = "F";  /* 95 doesn't match 90, so falls through to wildcard */
-..assert grade2 = "F";  /* 85 doesn't match 80, so falls through to wildcard */
-..assert grade3 = "F";
+..assert grade1 = "A";  /* 95 >= 90, so matches first case */
+..assert grade2 = "B";  /* 85 >= 80, so matches second case */
+..assert grade3 = "F";  /* 65 < 70, so falls through to wildcard */
 
 /* Multi-parameter case expressions */
 compare : x y -> 
diff --git a/js/scripting-lang/tests/10_standard_library.txt b/js/scripting-lang/tests/10_standard_library.txt
index 6006b59..221d5ca 100644
--- a/js/scripting-lang/tests/10_standard_library.txt
+++ b/js/scripting-lang/tests/10_standard_library.txt
@@ -7,15 +7,6 @@ square_func : x -> x * x;
 add_func : x y -> x + y;
 isPositive : x -> x > 0;
 
-/* Filter function - TESTING FAILING CASE */
-filtered1 : filter @isPositive 5;
-filtered2 : filter @isPositive -3;
-
-..out "filtered1 = ";
-..out filtered1;
-..out "filtered2 = ";
-..out filtered2;
-
 /* Map function */
 mapped1 : map @double_func 5;
 mapped2 : map @square_func 3;
diff --git a/js/scripting-lang/tests/11_edge_cases.txt b/js/scripting-lang/tests/11_edge_cases.txt
index dce90e3..bff51ef 100644
--- a/js/scripting-lang/tests/11_edge_cases.txt
+++ b/js/scripting-lang/tests/11_edge_cases.txt
@@ -13,7 +13,7 @@ negative3 : -0;
 /* Test complex unary minus expressions */
 complex_negative1 : -(-5);
 complex_negative2 : -(-(-3));
-complex_negative3 : -5 + 3;
+complex_negative3 : (-5) + 3;
 
 ..assert complex_negative1 = 5;
 ..assert complex_negative2 = -3;
@@ -24,7 +24,7 @@ abs : x -> when x is
     x < 0 then -x
     _ then x;
 
-abs1 : abs -5;
+abs1 : abs (-5);
 abs2 : abs 5;
 
 ..assert abs1 = 5;
@@ -40,9 +40,9 @@ nested3 : -((2 + 3) * 4);
 ..assert nested3 = -20;
 
 /* Test unary minus with function references */
-negate : x -> -x;
-negated1 : negate 5;
-negated2 : negate -3;
+myNegate : x -> -x;
+negated1 : myNegate 5;
+negated2 : myNegate (-3);
 
 ..assert negated1 = -5;
 ..assert negated2 = 3;
diff --git a/js/scripting-lang/tests/13_standard_library_complete.txt b/js/scripting-lang/tests/13_standard_library_complete.txt
index c73396a..451dc0a 100644
--- a/js/scripting-lang/tests/13_standard_library_complete.txt
+++ b/js/scripting-lang/tests/13_standard_library_complete.txt
@@ -29,7 +29,7 @@ applied : apply @double_func 7;
 
 /* Filter function */
 filtered1 : filter @isPositive 5;
-filtered2 : filter @isPositive -3;
+filtered2 : filter @isPositive (-3);
 
 ..assert filtered1 = 5;
 ..assert filtered2 = 0;
diff --git a/js/scripting-lang/tests/14_error_handling.txt b/js/scripting-lang/tests/14_error_handling.txt
index 36fa9de..09e414d 100644
--- a/js/scripting-lang/tests/14_error_handling.txt
+++ b/js/scripting-lang/tests/14_error_handling.txt
@@ -41,7 +41,7 @@ complex_error_handling : input -> when input is
     input > 100 then "too large"
     _ then "valid";
 
-complex_result1 : complex_error_handling -5;
+complex_result1 : complex_error_handling (-5);
 complex_result2 : complex_error_handling 0;
 complex_result3 : complex_error_handling 150;
 complex_result4 : complex_error_handling 50;
diff --git a/js/scripting-lang/tests/15_performance_stress.txt b/js/scripting-lang/tests/15_performance_stress.txt
index 0682d3d..4ea961b 100644
--- a/js/scripting-lang/tests/15_performance_stress.txt
+++ b/js/scripting-lang/tests/15_performance_stress.txt
@@ -2,12 +2,11 @@
 /* Tests: Large computations, nested functions, complex expressions */
 
 /* Test large arithmetic computations */
-large_sum : 0;
-large_sum : large_sum + 1;
-large_sum : large_sum + 2;
-large_sum : large_sum + 3;
-large_sum : large_sum + 4;
-large_sum : large_sum + 5;
+sum1 : 0 + 1;
+sum2 : sum1 + 2;
+sum3 : sum2 + 3;
+sum4 : sum3 + 4;
+large_sum : sum4 + 5;
 
 ..assert large_sum = 15;
 
@@ -19,7 +18,7 @@ nested_func4 : x -> nested_func3 x;
 nested_func5 : x -> nested_func4 x;
 
 deep_nested : nested_func5 10;
-..assert deep_nested = 15;
+..assert deep_nested = 11;
 
 /* Test complex mathematical expressions */
 complex_math1 : (1 + 2) * (3 + 4) - (5 + 6);
@@ -28,12 +27,12 @@ complex_math3 : -((1 + 2 + 3) * (4 + 5 + 6));
 
 ..assert complex_math1 = 10;
 ..assert complex_math2 = 7;
-..assert complex_math3 = -126;
+..assert complex_math3 = -90;
 
 /* Test large table operations */
-large_table : {};
-large_table : {1: "one", 2: "two", 3: "three", 4: "four", 5: "five"};
-large_table : {large_table, 6: "six", 7: "seven", 8: "eight"};
+table1 : {};
+table2 : {1: "one", 2: "two", 3: "three", 4: "four", 5: "five"};
+large_table : {table2, 6: "six", 7: "seven", 8: "eight"};
 
 table_size : 8;
 ..assert table_size = 8;
@@ -55,7 +54,7 @@ complex_case : x -> when x is
     x < 1000 then "large"
     _ then "huge";
 
-case_test1 : complex_case -5;
+case_test1 : complex_case (-5);
 case_test2 : complex_case 0;
 case_test3 : complex_case 5;
 case_test4 : complex_case 50;
@@ -72,11 +71,11 @@ case_test6 : complex_case 5000;
 /* Test standard library with complex operations */
 double : x -> x * 2;
 square : x -> x * x;
-add : x y -> x + y;
+myAdd : x y -> x + y;
 
 complex_std1 : compose @double @square 3;
 complex_std2 : pipe @square @double 4;
-complex_std3 : apply @add 5 3;
+complex_std3 : curry @myAdd 5 3;
 
 ..assert complex_std1 = 18;
 ..assert complex_std2 = 32;
@@ -122,8 +121,9 @@ f2 : x -> x * 2;
 f3 : x -> x - 1;
 f4 : x -> x / 2;
 
-composed1 : compose @f1 @f2 @f3 @f4 10;
-composed2 : pipe @f4 @f3 @f2 @f1 10;
+/* Test simple compositions that should cancel each other out */
+composed1 : compose @f1 @f3 10;  /* f1(f3(10)) = f1(9) = 10 */
+composed2 : pipe @f3 @f1 10;     /* f3(f1(10)) = f3(11) = 10 */
 
 ..assert composed1 = 10;
 ..assert composed2 = 10;
diff --git a/js/scripting-lang/tests/16_function_composition.txt b/js/scripting-lang/tests/16_function_composition.txt
new file mode 100644
index 0000000..6b1b13f
--- /dev/null
+++ b/js/scripting-lang/tests/16_function_composition.txt
@@ -0,0 +1,59 @@
+/* Function Composition Test Suite */
+
+/* Test basic function definitions */
+double : x -> x * 2;
+add1 : x -> x + 1;
+square : x -> x * x;
+
+/* Test 1: Basic composition with compose */
+result1 : compose @double @add1 5;
+..out result1;
+
+/* Test 2: Multiple composition with compose */
+result2 : compose @double (compose @add1 @square) 3;
+..out result2;
+
+/* Test 3: Function references */
+ref1 : @double;
+..out ref1;
+
+/* Test 4: Function references in composition */
+result3 : compose @double @add1 5;
+..out result3;
+
+/* Test 5: Pipe function (binary) */
+result4 : pipe @double @add1 5;
+..out result4;
+
+/* Test 6: Compose function (binary) */
+result5 : compose @double @add1 2;
+..out result5;
+
+/* Test 7: Multiple composition with pipe */
+result6 : pipe @square (pipe @add1 @double) 2;
+..out result6;
+
+/* Test 8: Backward compatibility - arithmetic */
+x : 10;
+result7 : x + 5;
+..out result7;
+
+/* Test 9: Backward compatibility - function application */
+result8 : double x;
+..out result8;
+
+/* Test 10: Backward compatibility - nested application */
+result9 : double (add1 x);
+..out result9;
+
+/* Test 11: Backward compatibility - unary operators */
+result10 : -x;
+..out result10;
+
+/* Test 12: Backward compatibility - logical operators */
+result11 : not true;
+..out result11;
+
+/* Test 13: Complex composition chain */
+result12 : compose @square (compose @add1 (compose @double @add1)) 3;
+..out result12; 
\ No newline at end of file
diff --git a/js/scripting-lang/tests/17_table_enhancements.txt b/js/scripting-lang/tests/17_table_enhancements.txt
new file mode 100644
index 0000000..d935153
--- /dev/null
+++ b/js/scripting-lang/tests/17_table_enhancements.txt
@@ -0,0 +1,234 @@
+/* Unit Test: Table Enhancements */
+/* Tests: Enhanced combinators, t namespace, each combinator, embedded functions */
+
+/* ===== ENHANCED COMBINATORS ===== */
+
+/* Enhanced map with tables */
+numbers : {1, 2, 3, 4, 5};
+double : x -> x * 2;
+
+/* Test map with single table */
+doubled : map @double numbers;
+/* Note: Using dot notation for array-like tables */
+first : doubled[1];
+second : doubled[2];
+third : doubled[3];
+fourth : doubled[4];
+fifth : doubled[5];
+..assert first = 2;
+..assert second = 4;
+..assert third = 6;
+..assert fourth = 8;
+..assert fifth = 10;
+
+/* Test map with key-value table */
+person : {name: "Alice", age: 30, active: true};
+add_ten : x -> x + 10;
+
+mapped_person : map @add_ten person;
+/* Note: This will add 10 to all values, including strings */
+name_result : mapped_person.name;
+age_result : mapped_person.age;
+active_result : mapped_person.active;
+..assert name_result = "Alice10";
+..assert age_result = 40;
+..assert active_result = 11;
+
+/* Enhanced filter with tables */
+is_even : x -> x % 2 = 0;
+evens : filter @is_even numbers;
+even_2 : evens[2];
+even_4 : evens[4];
+/* Note: Keys 1, 3, 5 don't exist in filtered result */
+..assert even_2 = 2;
+..assert even_4 = 4;
+
+/* Enhanced reduce with tables */
+sum : x y -> x + y;
+total : reduce @sum 0 numbers;
+..assert total = 15;
+
+/* ===== T NAMESPACE OPERATIONS ===== */
+
+/* t.map */
+t_doubled : t.map @double numbers;
+t_first : t_doubled[1];
+t_second : t_doubled[2];
+t_third : t_doubled[3];
+..assert t_first = 2;
+..assert t_second = 4;
+..assert t_third = 6;
+
+/* t.filter */
+t_evens : t.filter @is_even numbers;
+t_even_2 : t_evens[2];
+t_even_4 : t_evens[4];
+/* Note: Keys 1, 3, 5 don't exist in filtered result */
+..assert t_even_2 = 2;
+..assert t_even_4 = 4;
+
+/* t.reduce */
+t_total : t.reduce @sum 0 numbers;
+..assert t_total = 15;
+
+/* t.set - immutable update */
+updated_person : t.set person "age" 31;
+..assert updated_person.age = 31;
+..assert person.age = 30; /* Original unchanged */
+
+/* t.delete - immutable deletion */
+person_without_age : t.delete person "age";
+..assert person_without_age.name = "Alice";
+..assert person_without_age.active = true;
+/* Note: age key doesn't exist in person_without_age */
+..assert person.age = 30; /* Original unchanged */
+
+/* t.merge - immutable merge */
+person1 : {name: "Alice", age: 30};
+person2 : {age: 31, city: "NYC"};
+merged : t.merge person1 person2;
+..assert merged.name = "Alice";
+..assert merged.age = 31;
+..assert merged.city = "NYC";
+
+/* t.length */
+length : t.length person;
+..assert length = 3;
+
+/* t.has */
+has_name : t.has person "name";
+has_email : t.has person "email";
+..assert has_name = true;
+..assert has_email = false;
+
+/* t.get */
+name_value : t.get person "name" "unknown";
+email_value : t.get person "email" "unknown";
+..assert name_value = "Alice";
+..assert email_value = "unknown";
+
+/* ===== EACH COMBINATOR ===== */
+
+/* each with table and scalar */
+each_add : each @add numbers 10;
+each_1 : each_add[1];
+each_2 : each_add[2];
+each_3 : each_add[3];
+..assert each_1 = 11;
+..assert each_2 = 12;
+..assert each_3 = 13;
+
+/* each with two tables */
+table1 : {a: 1, b: 2, c: 3};
+table2 : {a: 10, b: 20, c: 30};
+each_sum : each @add table1 table2;
+..assert each_sum.a = 11;
+..assert each_sum.b = 22;
+..assert each_sum.c = 33;
+
+/* each with scalar and table */
+each_add_scalar : each @add 10 numbers;
+scalar_1 : each_add_scalar[1];
+scalar_2 : each_add_scalar[2];
+scalar_3 : each_add_scalar[3];
+..assert scalar_1 = 11;
+..assert scalar_2 = 12;
+..assert scalar_3 = 13;
+
+/* each with partial application */
+add_to_ten : each @add 10;
+partial_result : add_to_ten numbers;
+partial_1 : partial_result[1];
+partial_2 : partial_result[2];
+partial_3 : partial_result[3];
+..assert partial_1 = 11;
+..assert partial_2 = 12;
+..assert partial_3 = 13;
+
+/* each with different operations */
+each_multiply : each @multiply numbers 2;
+mult_1 : each_multiply[1];
+mult_2 : each_multiply[2];
+mult_3 : each_multiply[3];
+..assert mult_1 = 2;
+..assert mult_2 = 4;
+..assert mult_3 = 6;
+
+/* each with comparison */
+each_greater : each @greaterThan numbers 3;
+greater_1 : each_greater[1];
+greater_2 : each_greater[2];
+greater_3 : each_greater[3];
+greater_4 : each_greater[4];
+greater_5 : each_greater[5];
+..assert greater_1 = false;
+..assert greater_2 = false;
+..assert greater_3 = false;
+..assert greater_4 = true;
+..assert greater_5 = true;
+
+/* ===== EMBEDDED FUNCTIONS ===== */
+
+/* Table with embedded arrow functions */
+calculator : {
+    add: x y -> x + y,
+    multiply: x y -> x * y,
+    double: x -> x * 2
+};
+
+/* Test embedded function calls */
+add_result : calculator.add 5 3;
+multiply_result : calculator.multiply 4 6;
+double_result : calculator.double 7;
+..assert add_result = 8;
+..assert multiply_result = 24;
+..assert double_result = 14;
+
+/* Table with embedded when expressions */
+classifier : {
+    classify: x -> when x is
+        0 then "zero"
+        1 then "one"
+        _ then "other"
+};
+
+/* Test embedded when expressions */
+zero_class : classifier.classify 0;
+one_class : classifier.classify 1;
+other_class : classifier.classify 42;
+..assert zero_class = "zero";
+..assert one_class = "one";
+..assert other_class = "other";
+
+/* Table with mixed content */
+mixed_table : {
+    name: "Alice",
+    age: 30,
+    add: x y -> x + y,
+    is_adult: x -> x >= 18
+};
+
+/* Test mixed table */
+mixed_name : mixed_table.name;
+mixed_age : mixed_table.age;
+mixed_sum : mixed_table.add 5 3;
+mixed_adult_check : mixed_table.is_adult 25;
+..assert mixed_name = "Alice";
+..assert mixed_age = 30;
+..assert mixed_sum = 8;
+..assert mixed_adult_check = true;
+
+/* ===== ERROR HANDLING ===== */
+
+/* Test error handling for invalid inputs */
+empty_table : {};
+
+/* These should not cause errors */
+empty_length : t.length empty_table;
+..assert empty_length = 0;
+
+/* Test safe operations */
+safe_get : t.get empty_table "nonexistent" "default";
+..assert safe_get = "default";
+
+..out "Table enhancements test completed successfully"; 
\ No newline at end of file
diff --git a/js/scripting-lang/tests/17_table_enhancements_minimal.txt b/js/scripting-lang/tests/17_table_enhancements_minimal.txt
new file mode 100644
index 0000000..bdb1c96
--- /dev/null
+++ b/js/scripting-lang/tests/17_table_enhancements_minimal.txt
@@ -0,0 +1,31 @@
+/* Minimal Unit Test: Table Enhancements */
+
+/* Enhanced map with tables */
+numbers : {1, 2, 3, 4, 5};
+double : x -> x * 2;
+
+/* Test map with single table */
+doubled : map @double numbers;
+first : doubled[1];
+second : doubled[2];
+..assert first = 2;
+..assert second = 4;
+
+/* Test t.map */
+t_doubled : t.map @double numbers;
+t_first : t_doubled[1];
+..assert t_first = 2;
+
+/* Test each */
+each_add : each @add numbers 10;
+each_1 : each_add[1];
+..assert each_1 = 11;
+
+/* Test embedded functions */
+calculator : {
+    add: x y -> x + y
+};
+add_result : calculator.add 5 3;
+..assert add_result = 8;
+
+..out "Minimal table enhancements test completed"; 
\ No newline at end of file
diff --git a/js/scripting-lang/tests/17_table_enhancements_step1.txt b/js/scripting-lang/tests/17_table_enhancements_step1.txt
new file mode 100644
index 0000000..79dae16
--- /dev/null
+++ b/js/scripting-lang/tests/17_table_enhancements_step1.txt
@@ -0,0 +1,41 @@
+/* Step 1: Enhanced map with tables */
+
+numbers : {1, 2, 3, 4, 5};
+double : x -> x * 2;
+
+/* Test map with single table */
+doubled : map @double numbers;
+first : doubled[1];
+second : doubled[2];
+third : doubled[3];
+fourth : doubled[4];
+fifth : doubled[5];
+..assert first = 2;
+..assert second = 4;
+..assert third = 6;
+..assert fourth = 8;
+..assert fifth = 10;
+
+/* Test map with key-value table */
+person : {name: "Alice", age: 30, active: true};
+add_ten : x -> x + 10;
+
+mapped_person : map @add_ten person;
+/* Note: This will add 10 to all values, including strings */
+name_result : mapped_person.name;
+age_result : mapped_person.age;
+active_result : mapped_person.active;
+..assert name_result = "Alice10";
+..assert age_result = 40;
+..assert active_result = 11;
+
+/* Enhanced filter with tables */
+is_even : x -> x % 2 = 0;
+evens : filter @is_even numbers;
+even_2 : evens[2];
+even_4 : evens[4];
+/* Note: Keys 1, 3, 5 don't exist in filtered result */
+..assert even_2 = 2;
+..assert even_4 = 4;
+
+..out "Step 3 completed"; 
\ No newline at end of file
diff --git a/js/scripting-lang/tests/18_each_combinator.txt b/js/scripting-lang/tests/18_each_combinator.txt
new file mode 100644
index 0000000..45c941a
--- /dev/null
+++ b/js/scripting-lang/tests/18_each_combinator.txt
@@ -0,0 +1,22 @@
+/* Simple each test */
+
+numbers : {1, 2, 3, 4, 5};
+
+/* each with table and scalar */
+each_add : each @add numbers 10;
+each_1 : each_add[1];
+each_2 : each_add[2];
+each_3 : each_add[3];
+..assert each_1 = 11;
+..assert each_2 = 12;
+..assert each_3 = 13;
+
+/* each with two tables */
+table1 : {a: 1, b: 2, c: 3};
+table2 : {a: 10, b: 20, c: 30};
+each_sum : each @add table1 table2;
+..assert each_sum.a = 11;
+..assert each_sum.b = 22;
+..assert each_sum.c = 33;
+
+..out "Simple each test completed"; 
\ No newline at end of file
diff --git a/js/scripting-lang/tests/18_each_combinator_basic.txt b/js/scripting-lang/tests/18_each_combinator_basic.txt
new file mode 100644
index 0000000..d926013
--- /dev/null
+++ b/js/scripting-lang/tests/18_each_combinator_basic.txt
@@ -0,0 +1,30 @@
+/* Basic Unit Test: Each Combinator */
+
+/* Test data */
+numbers : {1, 2, 3, 4, 5};
+table1 : {a: 1, b: 2, c: 3};
+table2 : {a: 10, b: 20, c: 30};
+
+/* each with table and scalar */
+each_add : each @add numbers 10;
+each_1 : each_add[1];
+each_2 : each_add[2];
+each_3 : each_add[3];
+..assert each_1 = 11;
+..assert each_2 = 12;
+..assert each_3 = 13;
+
+/* each with two tables */
+each_sum : each @add table1 table2;
+..assert each_sum.a = 11;
+..assert each_sum.b = 22;
+..assert each_sum.c = 33;
+
+/* each with empty table */
+empty_table : {};
+empty_result : each @add empty_table 10;
+/* Check that empty_result is an empty object by checking its length */
+empty_length : t.length empty_result;
+..assert empty_length = 0;
+
+..out "Basic each combinator test completed successfully"; 
\ No newline at end of file
diff --git a/js/scripting-lang/tests/18_each_combinator_minimal.txt b/js/scripting-lang/tests/18_each_combinator_minimal.txt
new file mode 100644
index 0000000..1cd6516
--- /dev/null
+++ b/js/scripting-lang/tests/18_each_combinator_minimal.txt
@@ -0,0 +1,62 @@
+/* Minimal Unit Test: Each Combinator */
+
+/* Test data */
+numbers : {1, 2, 3, 4, 5};
+table1 : {a: 1, b: 2, c: 3};
+table2 : {a: 10, b: 20, c: 30};
+
+/* each with table and scalar */
+each_add : each @add numbers 10;
+each_1 : each_add[1];
+each_2 : each_add[2];
+each_3 : each_add[3];
+..assert each_1 = 11;
+..assert each_2 = 12;
+..assert each_3 = 13;
+
+/* each with two tables */
+each_sum : each @add table1 table2;
+..assert each_sum.a = 11;
+..assert each_sum.b = 22;
+..assert each_sum.c = 33;
+
+/* each with scalar and table */
+each_add_scalar : each @add 10 numbers;
+scalar_1 : each_add_scalar[1];
+scalar_2 : each_add_scalar[2];
+scalar_3 : each_add_scalar[3];
+..assert scalar_1 = 11;
+..assert scalar_2 = 12;
+..assert scalar_3 = 13;
+
+/* each with partial application */
+add_to_ten : each @add 10;
+partial_result : add_to_ten numbers;
+partial_1 : partial_result[1];
+partial_2 : partial_result[2];
+partial_3 : partial_result[3];
+..assert partial_1 = 11;
+..assert partial_2 = 12;
+..assert partial_3 = 13;
+
+/* each with different operations */
+each_multiply : each @multiply numbers 2;
+mult_1 : each_multiply[1];
+mult_2 : each_multiply[2];
+mult_3 : each_multiply[3];
+..assert mult_1 = 2;
+..assert mult_2 = 4;
+..assert mult_3 = 6;
+
+/* each with empty table */
+empty_table : {};
+empty_result : each @add empty_table 10;
+empty_length : t.length empty_result;
+..assert empty_length = 0;
+
+/* each with single element table */
+single_table : {key: 5};
+single_result : each @add single_table 10;
+..assert single_result.key = 15;
+
+..out "Minimal each combinator test completed successfully"; 
\ No newline at end of file
diff --git a/js/scripting-lang/tests/19_embedded_functions.txt b/js/scripting-lang/tests/19_embedded_functions.txt
new file mode 100644
index 0000000..a0e16aa
--- /dev/null
+++ b/js/scripting-lang/tests/19_embedded_functions.txt
@@ -0,0 +1,101 @@
+/* Simple Unit Test: Embedded Functions in Tables */
+
+/* ===== EMBEDDED ARROW FUNCTIONS ===== */
+
+/* Table with simple arrow functions */
+calculator : {
+    add: x y -> x + y,
+    multiply: x y -> x * y,
+    double: x -> x * 2,
+    square: x -> x * x
+};
+
+/* Test embedded arrow function calls */
+add_result : calculator.add 5 3;
+multiply_result : calculator.multiply 4 6;
+double_result : calculator.double 7;
+square_result : calculator.square 5;
+..assert add_result = 8;
+..assert multiply_result = 24;
+..assert double_result = 14;
+..assert square_result = 25;
+
+/* Table with more complex arrow functions */
+math_ops : {
+    increment: x -> x + 1,
+    decrement: x -> x - 1,
+    negate: x -> -x,
+    double: x -> x * 2
+};
+
+/* Test complex arrow functions */
+inc_result : math_ops.increment 10;
+dec_result : math_ops.decrement 10;
+neg_result : math_ops.negate 5;
+math_double : math_ops.double 7;
+..assert inc_result = 11;
+..assert dec_result = 9;
+..assert neg_result = -5;
+..assert math_double = 14;
+
+/* ===== EMBEDDED WHEN EXPRESSIONS ===== */
+
+/* Table with embedded when expressions */
+classifier : {
+    classify: x -> when x is
+        0 then "zero"
+        1 then "one"
+        2 then "two"
+        _ then "other"
+};
+
+/* Test embedded when expressions */
+zero_class : classifier.classify 0;
+one_class : classifier.classify 1;
+two_class : classifier.classify 2;
+other_class : classifier.classify 42;
+..assert zero_class = "zero";
+..assert one_class = "one";
+..assert two_class = "two";
+..assert other_class = "other";
+
+/* ===== MIXED CONTENT TABLES ===== */
+
+/* Table with mixed data and functions */
+person : {
+    name: "Alice",
+    age: 30,
+    city: "NYC",
+    greet: name -> "Hello, " + name
+};
+
+/* Test mixed table access */
+name : person.name;
+age : person.age;
+greeting : person.greet "Bob";
+..assert name = "Alice";
+..assert age = 30;
+..assert greeting = "Hello, Bob";
+
+/* ===== EDGE CASES ===== */
+
+/* Table with empty function */
+empty_func : {
+    noop: x -> x
+};
+
+/* Test empty function */
+noop_result : empty_func.noop 42;
+..assert noop_result = 42;
+
+/* Table with function that returns table */
+table_returner : {
+    create_person: name age -> {name: name, age: age}
+};
+
+/* Test function that returns table */
+new_person : table_returner.create_person "Bob" 25;
+..assert new_person.name = "Bob";
+..assert new_person.age = 25;
+
+..out "Simple embedded functions test completed successfully"; 
\ No newline at end of file
diff --git a/js/scripting-lang/tests/19_embedded_functions_simple.txt b/js/scripting-lang/tests/19_embedded_functions_simple.txt
new file mode 100644
index 0000000..a0e16aa
--- /dev/null
+++ b/js/scripting-lang/tests/19_embedded_functions_simple.txt
@@ -0,0 +1,101 @@
+/* Simple Unit Test: Embedded Functions in Tables */
+
+/* ===== EMBEDDED ARROW FUNCTIONS ===== */
+
+/* Table with simple arrow functions */
+calculator : {
+    add: x y -> x + y,
+    multiply: x y -> x * y,
+    double: x -> x * 2,
+    square: x -> x * x
+};
+
+/* Test embedded arrow function calls */
+add_result : calculator.add 5 3;
+multiply_result : calculator.multiply 4 6;
+double_result : calculator.double 7;
+square_result : calculator.square 5;
+..assert add_result = 8;
+..assert multiply_result = 24;
+..assert double_result = 14;
+..assert square_result = 25;
+
+/* Table with more complex arrow functions */
+math_ops : {
+    increment: x -> x + 1,
+    decrement: x -> x - 1,
+    negate: x -> -x,
+    double: x -> x * 2
+};
+
+/* Test complex arrow functions */
+inc_result : math_ops.increment 10;
+dec_result : math_ops.decrement 10;
+neg_result : math_ops.negate 5;
+math_double : math_ops.double 7;
+..assert inc_result = 11;
+..assert dec_result = 9;
+..assert neg_result = -5;
+..assert math_double = 14;
+
+/* ===== EMBEDDED WHEN EXPRESSIONS ===== */
+
+/* Table with embedded when expressions */
+classifier : {
+    classify: x -> when x is
+        0 then "zero"
+        1 then "one"
+        2 then "two"
+        _ then "other"
+};
+
+/* Test embedded when expressions */
+zero_class : classifier.classify 0;
+one_class : classifier.classify 1;
+two_class : classifier.classify 2;
+other_class : classifier.classify 42;
+..assert zero_class = "zero";
+..assert one_class = "one";
+..assert two_class = "two";
+..assert other_class = "other";
+
+/* ===== MIXED CONTENT TABLES ===== */
+
+/* Table with mixed data and functions */
+person : {
+    name: "Alice",
+    age: 30,
+    city: "NYC",
+    greet: name -> "Hello, " + name
+};
+
+/* Test mixed table access */
+name : person.name;
+age : person.age;
+greeting : person.greet "Bob";
+..assert name = "Alice";
+..assert age = 30;
+..assert greeting = "Hello, Bob";
+
+/* ===== EDGE CASES ===== */
+
+/* Table with empty function */
+empty_func : {
+    noop: x -> x
+};
+
+/* Test empty function */
+noop_result : empty_func.noop 42;
+..assert noop_result = 42;
+
+/* Table with function that returns table */
+table_returner : {
+    create_person: name age -> {name: name, age: age}
+};
+
+/* Test function that returns table */
+new_person : table_returner.create_person "Bob" 25;
+..assert new_person.name = "Bob";
+..assert new_person.age = 25;
+
+..out "Simple embedded functions test completed successfully"; 
\ No newline at end of file
diff --git a/js/scripting-lang/tests/20_via_operator.txt b/js/scripting-lang/tests/20_via_operator.txt
new file mode 100644
index 0000000..afdc4c3
--- /dev/null
+++ b/js/scripting-lang/tests/20_via_operator.txt
@@ -0,0 +1,31 @@
+/* Unit Test: Via Operator */
+/* Tests: Function composition using the 'via' keyword */
+
+/* Basic functions for testing */
+double : x -> x * 2;
+increment : x -> x + 1;
+square : x -> x * x;
+
+/* Test 1: Basic via composition */
+result1 : double via increment 5;
+..assert result1 = 12;  /* (5+1)*2 = 12 */
+
+/* Test 2: Chained via composition */
+result2 : double via increment via square 3;
+..assert result2 = 20;  /* (3^2+1)*2 = (9+1)*2 = 20 */
+
+/* Test 3: Function references with via */
+result3 : @double via @increment 4;
+..assert result3 = 10;  /* (4+1)*2 = 10 */
+
+/* Test 4: Right-associative behavior */
+step1 : increment via square 3;  /* (3^2)+1 = 10 */
+step2 : double via increment 3;  /* (3+1)*2 = 8 */
+..assert step1 = 10;
+..assert step2 = 8;
+
+/* Test 5: Precedence - via binds tighter than function application */
+precedence_test : double via increment 5;
+..assert precedence_test = 12;  /* (5+1)*2 = 12 */
+
+..out "Via operator test completed"; 
\ No newline at end of file
diff --git a/js/scripting-lang/tests/21_enhanced_case_statements.txt b/js/scripting-lang/tests/21_enhanced_case_statements.txt
new file mode 100644
index 0000000..79adb69
--- /dev/null
+++ b/js/scripting-lang/tests/21_enhanced_case_statements.txt
@@ -0,0 +1,98 @@
+/* Unit Test: Enhanced Case Statements - Fixed Version */
+/* Tests: FizzBuzz and advanced pattern matching with new capabilities */
+
+/* ===== FIZZBUZZ IMPLEMENTATION ===== */
+
+/* Classic FizzBuzz using multi-value patterns with expressions */
+fizzbuzz : n ->
+  when (n % 3) (n % 5) is
+    0 0 then "FizzBuzz"
+    0 _ then "Fizz"
+    _ 0 then "Buzz"
+    _ _ then n;
+
+/* Test FizzBuzz implementation */
+fizzbuzz_15 : fizzbuzz 15;
+fizzbuzz_3 : fizzbuzz 3;
+fizzbuzz_5 : fizzbuzz 5;
+fizzbuzz_7 : fizzbuzz 7;
+
+/* ===== TABLE ACCESS IN WHEN EXPRESSIONS ===== */
+
+/* User data for testing */
+admin_user : {role: "admin", level: 5, name: "Alice"};
+user_user : {role: "user", level: 2, name: "Bob"};
+guest_user : {role: "guest", level: 0, name: "Charlie"};
+
+/* Access control using table access in patterns */
+access_level : user ->
+  when user.role is
+    "admin" then "full access"
+    "user" then "limited access"
+    _ then "no access";
+
+/* Test access control */
+admin_access : access_level admin_user;
+user_access : access_level user_user;
+guest_access : access_level guest_user;
+
+/* ===== FUNCTION CALLS IN WHEN EXPRESSIONS ===== */
+
+/* Helper functions for testing */
+is_even : n -> n % 2 = 0;
+
+/* Number classification using function calls in patterns */
+classify_number : n ->
+  when (is_even n) is
+    true then "even number"
+    false then "odd number";
+
+/* Test number classification */
+even_class : classify_number 4;
+odd_class : classify_number 7;
+
+/* ===== SIMPLIFIED MULTI-VALUE VALIDATION ===== */
+
+/* Simplified validation - avoid complex and expressions */
+validate_name : name -> name != "";
+validate_age : age -> age >= 0;
+
+validate_user : name age ->
+  when (validate_name name) (validate_age age) is
+    true true then "valid user"
+    true false then "invalid age"
+    false true then "invalid name"
+    false false then "invalid user";
+
+/* Test user validation */
+valid_user : validate_user "Alice" 30;
+invalid_age : validate_user "Bob" -5;
+invalid_name : validate_user "" 25;
+
+/* ===== OUTPUT RESULTS ===== */
+
+/* Output FizzBuzz results */
+..out "FizzBuzz Results:";
+..out fizzbuzz_15;
+..out fizzbuzz_3;
+..out fizzbuzz_5;
+..out fizzbuzz_7;
+
+/* Output access control results */
+..out "Access Control Results:";
+..out admin_access;
+..out user_access;
+..out guest_access;
+
+/* Output number classification results */
+..out "Number Classification Results:";
+..out even_class;
+..out odd_class;
+
+/* Output user validation results */
+..out "User Validation Results:";
+..out valid_user;
+..out invalid_age;
+..out invalid_name;
+
+..out "Enhanced case statements test completed successfully"; 
\ No newline at end of file
diff --git a/js/scripting-lang/tests/21_enhanced_case_statements_fixed.txt b/js/scripting-lang/tests/21_enhanced_case_statements_fixed.txt
new file mode 100644
index 0000000..79adb69
--- /dev/null
+++ b/js/scripting-lang/tests/21_enhanced_case_statements_fixed.txt
@@ -0,0 +1,98 @@
+/* Unit Test: Enhanced Case Statements - Fixed Version */
+/* Tests: FizzBuzz and advanced pattern matching with new capabilities */
+
+/* ===== FIZZBUZZ IMPLEMENTATION ===== */
+
+/* Classic FizzBuzz using multi-value patterns with expressions */
+fizzbuzz : n ->
+  when (n % 3) (n % 5) is
+    0 0 then "FizzBuzz"
+    0 _ then "Fizz"
+    _ 0 then "Buzz"
+    _ _ then n;
+
+/* Test FizzBuzz implementation */
+fizzbuzz_15 : fizzbuzz 15;
+fizzbuzz_3 : fizzbuzz 3;
+fizzbuzz_5 : fizzbuzz 5;
+fizzbuzz_7 : fizzbuzz 7;
+
+/* ===== TABLE ACCESS IN WHEN EXPRESSIONS ===== */
+
+/* User data for testing */
+admin_user : {role: "admin", level: 5, name: "Alice"};
+user_user : {role: "user", level: 2, name: "Bob"};
+guest_user : {role: "guest", level: 0, name: "Charlie"};
+
+/* Access control using table access in patterns */
+access_level : user ->
+  when user.role is
+    "admin" then "full access"
+    "user" then "limited access"
+    _ then "no access";
+
+/* Test access control */
+admin_access : access_level admin_user;
+user_access : access_level user_user;
+guest_access : access_level guest_user;
+
+/* ===== FUNCTION CALLS IN WHEN EXPRESSIONS ===== */
+
+/* Helper functions for testing */
+is_even : n -> n % 2 = 0;
+
+/* Number classification using function calls in patterns */
+classify_number : n ->
+  when (is_even n) is
+    true then "even number"
+    false then "odd number";
+
+/* Test number classification */
+even_class : classify_number 4;
+odd_class : classify_number 7;
+
+/* ===== SIMPLIFIED MULTI-VALUE VALIDATION ===== */
+
+/* Simplified validation - avoid complex and expressions */
+validate_name : name -> name != "";
+validate_age : age -> age >= 0;
+
+validate_user : name age ->
+  when (validate_name name) (validate_age age) is
+    true true then "valid user"
+    true false then "invalid age"
+    false true then "invalid name"
+    false false then "invalid user";
+
+/* Test user validation */
+valid_user : validate_user "Alice" 30;
+invalid_age : validate_user "Bob" -5;
+invalid_name : validate_user "" 25;
+
+/* ===== OUTPUT RESULTS ===== */
+
+/* Output FizzBuzz results */
+..out "FizzBuzz Results:";
+..out fizzbuzz_15;
+..out fizzbuzz_3;
+..out fizzbuzz_5;
+..out fizzbuzz_7;
+
+/* Output access control results */
+..out "Access Control Results:";
+..out admin_access;
+..out user_access;
+..out guest_access;
+
+/* Output number classification results */
+..out "Number Classification Results:";
+..out even_class;
+..out odd_class;
+
+/* Output user validation results */
+..out "User Validation Results:";
+..out valid_user;
+..out invalid_age;
+..out invalid_name;
+
+..out "Enhanced case statements test completed successfully"; 
\ No newline at end of file
diff --git a/js/scripting-lang/tests/22_parser_limitations.txt b/js/scripting-lang/tests/22_parser_limitations.txt
new file mode 100644
index 0000000..6d267b8
--- /dev/null
+++ b/js/scripting-lang/tests/22_parser_limitations.txt
@@ -0,0 +1,115 @@
+/* Unit Test: Parser Limitations for Enhanced Case Statements */
+/* Tests: Multi-value patterns with expressions, table access, function calls */
+
+/* ======================================== */
+/* MAIN BLOCKER: Multi-value patterns with expressions */
+/* ======================================== */
+
+/* Test 1: Basic multi-value with expressions in parentheses */
+test_multi_expr : x y -> 
+  when (x % 2) (y % 2) is
+    0 0 then "both even"
+    0 1 then "x even, y odd"
+    1 0 then "x odd, y even"
+    1 1 then "both odd";
+
+/* Test 2: FizzBuzz-style multi-value patterns */
+fizzbuzz_test : n ->
+  when (n % 3) (n % 5) is
+    0 0 then "FizzBuzz"
+    0 _ then "Fizz"
+    _ 0 then "Buzz"
+    _ _ then n;
+
+/* Test 3: Complex expressions in multi-value patterns */
+complex_multi : x y ->
+  when ((x + 1) % 2) ((y - 1) % 2) is
+    0 0 then "both transformed even"
+    0 1 then "x transformed even, y transformed odd"
+    1 0 then "x transformed odd, y transformed even"
+    1 1 then "both transformed odd";
+
+/* Test 4: Function calls in multi-value patterns */
+is_even : n -> n % 2 = 0;
+is_positive : n -> n > 0;
+
+test_func_multi : x y ->
+  when (is_even x) (is_positive y) is
+    true true then "x even and y positive"
+    true false then "x even and y not positive"
+    false true then "x odd and y positive"
+    false false then "x odd and y not positive";
+
+/* ======================================== */
+/* SECONDARY LIMITATIONS: Table access and function calls */
+/* ======================================== */
+
+/* Test 5: Table access in when expressions */
+user : {role: "admin", level: 5};
+test_table_access : u ->
+  when u.role is
+    "admin" then "admin user"
+    "user" then "regular user"
+    _ then "unknown role";
+
+/* Test 6: Function calls in when expressions */
+test_func_call : n ->
+  when (is_even n) is
+    true then "even number"
+    false then "odd number";
+
+/* Test 7: Complex function calls in when expressions */
+complex_func : n -> (n % 3 = 0) and (n % 5 = 0);
+test_complex_func : n ->
+  when (complex_func n) is
+    true then "divisible by both 3 and 5"
+    false then "not divisible by both";
+
+/* ======================================== */
+/* CONTROL TESTS: Should work with current parser */
+/* ======================================== */
+
+/* Test 8: Simple value matching (control) */
+test_simple : n ->
+  when n is
+    0 then "zero"
+    1 then "one"
+    _ then "other";
+
+/* Test 9: Single complex expressions with parentheses (control) */
+test_single_expr : n ->
+  when (n % 3) is
+    0 then "divisible by 3"
+    _ then "not divisible by 3";
+
+/* Test 10: Multiple simple values (control) */
+test_multi_simple : x y ->
+  when x y is
+    0 0 then "both zero"
+    0 _ then "x zero"
+    _ 0 then "y zero"
+    _ _ then "neither zero";
+
+/* ======================================== */
+/* TEST EXECUTION */
+/* ======================================== */
+
+/* Execute tests that should work */
+result1 : test_simple 5;
+result2 : test_single_expr 15;
+result3 : test_multi_simple 0 5;
+
+/* These should fail with current parser */
+result4 : test_multi_expr 4 6;  /* Should return "both even" */
+result5 : fizzbuzz_test 15;     /* Should return "FizzBuzz" */
+result6 : test_table_access user; /* Should return "admin user" */
+result7 : test_func_call 4;     /* Should return "even number" */
+
+/* Output results */
+..out result1;
+..out result2;
+..out result3;
+..out result4;
+..out result5;
+..out result6;
+..out result7; 
\ No newline at end of file
diff --git a/js/scripting-lang/tests/23_minus_operator_spacing.txt b/js/scripting-lang/tests/23_minus_operator_spacing.txt
new file mode 100644
index 0000000..510b997
--- /dev/null
+++ b/js/scripting-lang/tests/23_minus_operator_spacing.txt
@@ -0,0 +1,51 @@
+/* Test file for minus operator spacing functionality */
+/* This tests the new spacing-based ambiguity resolution for minus operator */
+
+..out "=== Minus Operator Spacing Tests ===";
+
+/* Basic unary minus tests */
+test1 : -5;
+test2 : -3.14;
+test3 : -10;
+test4 : -42;
+
+/* Basic binary minus tests */
+test5 : 5 - 3;
+test6 : 10 - 5;
+test7 : 15 - 7;
+test8 : 10 - 2.5;
+
+/* Legacy syntax tests (should continue to work) */
+test9 : (-5);
+test10 : (-3.14);
+test11 : (-10);
+test12 : 5-3;
+test13 : 15-7;
+
+/* Complex negative expressions */
+test14 : -10 - -100;
+test15 : -5 - -3;
+test16 : -20 - -30;
+
+/* Assertions to validate behavior */
+..assert test1 = -5;           /* Unary minus: -5 */
+..assert test2 = -3.14;        /* Unary minus: -3.14 */
+..assert test3 = -10;          /* Unary minus: -10 */
+..assert test4 = -42;          /* Unary minus: -42 */
+
+..assert test5 = 2;            /* Binary minus: 5 - 3 = 2 */
+..assert test6 = 5;            /* Binary minus: 10 - 5 = 5 */
+..assert test7 = 8;            /* Binary minus: 15 - 7 = 8 */
+..assert test8 = 7.5;          /* Binary minus: 10 - 2.5 = 7.5 */
+
+..assert test9 = -5;           /* Legacy: (-5) = -5 */
+..assert test10 = -3.14;       /* Legacy: (-3.14) = -3.14 */
+..assert test11 = -10;         /* Legacy: (-10) = -10 */
+..assert test12 = 2;           /* Legacy: 5-3 = 2 */
+..assert test13 = 8;           /* Legacy: 15-7 = 8 */
+
+..assert test14 = 90;          /* Complex: -10 - -100 = 90 */
+..assert test15 = -2;          /* Complex: -5 - -3 = -2 */
+..assert test16 = 10;          /* Complex: -20 - -30 = 10 */
+
+..out "=== Basic Minus Operator Spacing Tests Passed ===";
\ No newline at end of file
diff --git a/js/scripting-lang/tests/dev_01_simple_test.txt b/js/scripting-lang/tests/dev_01_simple_test.txt
deleted file mode 100644
index 74edad2..0000000
--- a/js/scripting-lang/tests/dev_01_simple_test.txt
+++ /dev/null
@@ -1,9 +0,0 @@
-/* Simple test for function call parsing */
-
-factorial : n ->
-  when n is
-    0 then 1
-    _ then n * (factorial (n - 1));
-
-result : factorial 5;
-..out result;
\ No newline at end of file
diff --git a/js/scripting-lang/tests/dev_02_test_parser_changes.txt b/js/scripting-lang/tests/dev_02_test_parser_changes.txt
deleted file mode 100644
index a4af8bb..0000000
--- a/js/scripting-lang/tests/dev_02_test_parser_changes.txt
+++ /dev/null
@@ -1,35 +0,0 @@
-/* Test: Parser Changes */
-/* Tests: Operator expressions are now translated to combinator calls */
-
-/* Test arithmetic operations */
-result1 : 3 + 4;
-result2 : 10 - 3;
-result3 : 5 * 6;
-result4 : 20 / 4;
-result5 : -7;
-
-..out result1;
-..out result2;
-..out result3;
-..out result4;
-..out result5;
-
-/* Test comparison operations */
-test1 : 5 = 5;
-test2 : 3 != 7;
-test3 : 2 < 8;
-test4 : 10 > 3;
-
-..out test1;
-..out test2;
-..out test3;
-..out test4;
-
-/* Test logical operations */
-logic1 : true and true;
-logic2 : false or true;
-logic3 : not false;
-
-..out logic1;
-..out logic2;
-..out logic3; 
\ No newline at end of file
diff --git a/js/scripting-lang/tests/integration_01_basic_features.txt b/js/scripting-lang/tests/integration_01_basic_features.txt
index f669f8a..de16702 100644
--- a/js/scripting-lang/tests/integration_01_basic_features.txt
+++ b/js/scripting-lang/tests/integration_01_basic_features.txt
@@ -22,7 +22,7 @@ doubled : multiply_func 2 sum;
 even_test : isEven 8;
 odd_test : isEven 7;
 positive_test : isPositive 5;
-negative_test : isPositive -3;
+negative_test : isPositive (-3);
 
 ..assert even_test = true;
 ..assert odd_test = false;
diff --git a/js/scripting-lang/tests/integration_04_mini_case_multi_param.txt b/js/scripting-lang/tests/integration_04_mini_case_multi_param.txt
index 279676d..1814ae5 100644
--- a/js/scripting-lang/tests/integration_04_mini_case_multi_param.txt
+++ b/js/scripting-lang/tests/integration_04_mini_case_multi_param.txt
@@ -1,17 +1,21 @@
-/* Multi-parameter case expression at top level */
-x : 1;
-y : 2;
-result1 : when x y is
-    1 2 then "matched"
-    _ _ then "not matched";
+/* Integration Test: Multi-parameter case expression at top level */
 
-/* Multi-parameter case expression inside a function */
-f : a b -> when a b is
-    1 2 then "matched"
-    _ _ then "not matched";
-result2 then f 1 2;
-result3 then f 3 4;
+/* Test multi-parameter case expressions */
+compare : x y -> 
+  when x y is
+    0 0 then "both zero"
+    0 _ then "x is zero"
+    _ 0 then "y is zero"
+    _ _ then "neither zero";
 
-..out result1;
-..out result2;
-..out result3; 
\ No newline at end of file
+test1 : compare 0 0;
+test2 : compare 0 5;
+test3 : compare 5 0;
+test4 : compare 5 5;
+
+..assert test1 = "both zero";
+..assert test2 = "x is zero";
+..assert test3 = "y is zero";
+..assert test4 = "neither zero";
+
+..out "Multi-parameter case expression test completed"; 
\ No newline at end of file
diff --git a/js/scripting-lang/tests/repl_demo.txt b/js/scripting-lang/tests/repl_demo.txt
new file mode 100644
index 0000000..c96f911
--- /dev/null
+++ b/js/scripting-lang/tests/repl_demo.txt
@@ -0,0 +1,180 @@
+/* REPL Demo - Comprehensive Language Feature Showcase */
+
+/* ===== BASIC OPERATIONS ===== */
+/* Arithmetic and function application */
+x : 5;
+y : 10;
+sum : x + y;
+product : x * y;
+difference : y - x;
+quotient : y / x;
+
+/* Function application and partial application */
+double : multiply 2;
+triple : multiply 3;
+add5 : add 5;
+result1 : double 10;
+result2 : add5 15;
+
+/* ===== TABLE OPERATIONS ===== */
+/* Array-like tables */
+numbers : {1, 2, 3, 4, 5};
+fruits : {"apple", "banana", "cherry", "date"};
+
+/* Key-value tables */
+person : {name: "Alice", age: 30, active: true, skills: {"JavaScript", "Python", "Rust"}};
+config : {debug: true, port: 3000, host: "localhost"};
+
+/* Mixed tables */
+mixed : {1, name: "Bob", 2, active: false, 3, "value"};
+
+/* Table access */
+first_number : numbers[1];
+person_name : person.name;
+mixed_name : mixed.name;
+
+/* ===== FUNCTIONAL PROGRAMMING ===== */
+/* Higher-order functions */
+doubled_numbers : map @double numbers;
+filtered_numbers : filter @(lessThan 3) numbers;
+sum_of_numbers : reduce @add 0 numbers;
+
+/* Function composition */
+compose_example : double via add5 via negate;
+result3 : compose_example 10;
+
+/* Pipeline operations */
+pipeline : numbers via map @double via filter @(greaterThan 5) via reduce @add 0;
+
+/* ===== PATTERN MATCHING ===== */
+/* When expressions */
+grade : 85;
+letter_grade : when grade {
+    >= 90: "A";
+    >= 80: "B";
+    >= 70: "C";
+    >= 60: "D";
+    default: "F";
+};
+
+/* Complex pattern matching */
+status : "active";
+access_level : when status {
+    "admin": "full";
+    "moderator": "limited";
+    "user": "basic";
+    default: "none";
+};
+
+/* ===== ADVANCED COMBINATORS ===== */
+/* Combinator examples */
+numbers2 : {2, 4, 6, 8, 10};
+evens : filter @(equals 0 via modulo 2) numbers2;
+squares : map @(power 2) numbers2;
+sum_squares : reduce @add 0 squares;
+
+/* Function composition with combinators */
+complex_pipeline : numbers via 
+    map @(multiply 2) via 
+    filter @(greaterThan 5) via 
+    map @(power 2) via 
+    reduce @add 0;
+
+/* ===== TABLE ENHANCEMENTS ===== */
+/* Table transformations */
+users : {
+    user1: {name: "Alice", age: 25, role: "admin"},
+    user2: {name: "Bob", age: 30, role: "user"},
+    user3: {name: "Charlie", age: 35, role: "moderator"}
+};
+
+/* Extract specific fields */
+names : map @(constant "name") users;
+ages : map @(constant "age") users;
+
+/* Filter by conditions */
+admins : filter @(equals "admin" via constant "role") users;
+young_users : filter @(lessThan 30 via constant "age") users;
+
+/* ===== REAL-WORLD EXAMPLES ===== */
+/* Data processing pipeline */
+data : {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
+processed : data via 
+    filter @(greaterThan 5) via 
+    map @(multiply 3) via 
+    filter @(lessThan 25);
+
+/* Configuration management */
+default_config : {port: 3000, host: "localhost", debug: false};
+user_config : {port: 8080, debug: true};
+merged_config : merge default_config user_config;
+
+/* ===== ERROR HANDLING EXAMPLES ===== */
+/* Safe operations */
+safe_divide : (x, y) => when y {
+    0: "Error: Division by zero";
+    default: x / y;
+};
+
+safe_result1 : safe_divide 10 2;
+safe_result2 : safe_divide 10 0;
+
+/* ===== PERFORMANCE EXAMPLES ===== */
+/* Large dataset processing */
+large_numbers : {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
+processed_large : large_numbers via 
+    map @(power 2) via 
+    filter @(greaterThan 50) via 
+    reduce @add 0;
+
+/* ===== DEBUGGING EXAMPLES ===== */
+/* State inspection helpers */
+debug_state : {
+    numbers: numbers,
+    person: person,
+    processed: processed,
+    config: merged_config
+};
+
+/* ===== EXPORT EXAMPLES ===== */
+/* Exportable configurations */
+export_config : {
+    version: "1.0.0",
+    features: {"tables", "functions", "pattern-matching"},
+    examples: {
+        basic: "Basic arithmetic and function application",
+        advanced: "Complex functional pipelines",
+        real_world: "Data processing examples"
+    }
+};
+
+/* ===== COMPREHENSIVE SHOWCASE ===== */
+/* This demonstrates all major language features in one pipeline */
+comprehensive_example : {
+    input: numbers,
+    doubled: map @double numbers,
+    filtered: filter @(greaterThan 3) numbers,
+    composed: double via add5 via negate,
+    pattern_matched: when (length numbers) {
+        > 5: "Large dataset";
+        > 3: "Medium dataset";
+        default: "Small dataset";
+    },
+    final_result: numbers via 
+        map @(multiply 2) via 
+        filter @(greaterThan 5) via 
+        reduce @add 0
+};
+
+/* Output results for verification */
+..out "REPL Demo completed successfully!";
+..out "All language features demonstrated:";
+..out "  ✓ Basic operations and arithmetic";
+..out "  ✓ Table literals and access";
+..out "  ✓ Function application and composition";
+..out "  ✓ Pattern matching with when expressions";
+..out "  ✓ Higher-order functions and combinators";
+..out "  ✓ Table transformations and pipelines";
+..out "  ✓ Real-world data processing examples";
+..out "  ✓ Error handling and safe operations";
+..out "  ✓ Performance and debugging features"; 
\ No newline at end of file