kumi 0.0.18 ā 0.0.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +4 -1
- data/.ruby-version +1 -0
- data/CHANGELOG.md +27 -0
- data/CLAUDE.md +26 -139
- data/README.md +143 -372
- data/data/functions/agg/boolean.yaml +14 -0
- data/data/functions/agg/numeric.yaml +80 -0
- data/data/functions/agg/string.yaml +8 -0
- data/data/functions/core/arithmetic.yaml +50 -0
- data/data/functions/core/boolean.yaml +18 -0
- data/data/functions/core/comparison.yaml +42 -0
- data/data/functions/core/constructor.yaml +32 -0
- data/data/functions/core/select.yaml +7 -0
- data/data/functions/core/stencil.yaml +21 -0
- data/data/functions/core/string.yaml +19 -0
- data/data/kernels/javascript/agg/boolean.yaml +12 -0
- data/data/kernels/javascript/agg/numeric.yaml +27 -0
- data/data/kernels/javascript/agg/string.yaml +5 -0
- data/data/kernels/javascript/core/arithmetic.yaml +32 -0
- data/data/kernels/javascript/core/boolean.yaml +12 -0
- data/data/kernels/javascript/core/comparison.yaml +24 -0
- data/data/kernels/javascript/core/constructor.yaml +15 -0
- data/data/kernels/javascript/core/select.yaml +7 -0
- data/data/kernels/javascript/core/string.yaml +12 -0
- data/data/kernels/ruby/agg/boolean.yaml +18 -0
- data/data/kernels/ruby/agg/numeric.yaml +29 -0
- data/data/kernels/ruby/agg/string.yaml +5 -0
- data/data/kernels/ruby/core/arithmetic.yaml +38 -0
- data/data/kernels/ruby/core/boolean.yaml +15 -0
- data/data/kernels/ruby/core/comparison.yaml +30 -0
- data/data/kernels/ruby/core/constructor.yaml +17 -0
- data/data/kernels/ruby/core/select.yaml +4 -0
- data/data/kernels/ruby/core/string.yaml +15 -0
- data/debug_ordering.rb +52 -0
- data/docs/FORM_SCHEMA.md +85 -0
- data/docs/OUTPUT_SCHEMA.md +69 -0
- data/docs/SYNTAX.md +626 -373
- data/golden/array_element/expected/ast.txt +21 -0
- data/golden/array_element/expected/input_plan.txt +5 -0
- data/golden/array_element/expected/lir_00_unoptimized.txt +13 -0
- data/golden/array_element/expected/lir_01_hoist_scalar_references.txt +13 -0
- data/golden/array_element/expected/lir_02_inlined.txt +13 -0
- data/golden/array_element/expected/lir_03_cse.txt +13 -0
- data/golden/array_element/expected/lir_04_1_loop_fusion.txt +13 -0
- data/golden/array_element/expected/lir_04_loop_invcm.txt +13 -0
- data/golden/array_element/expected/lir_06_const_prop.txt +13 -0
- data/golden/array_element/expected/nast.txt +7 -0
- data/golden/array_element/expected/schema_javascript.mjs +13 -0
- data/golden/array_element/expected/schema_ruby.rb +41 -0
- data/golden/array_element/expected/snast.txt +7 -0
- data/golden/array_element/expected.json +5 -0
- data/golden/array_element/input.json +9 -0
- data/golden/array_element/schema.kumi +11 -0
- data/golden/array_index/expected/ast.txt +59 -0
- data/golden/array_index/expected/input_plan.txt +5 -0
- data/golden/array_index/expected/lir_00_unoptimized.txt +41 -0
- data/golden/array_index/expected/lir_01_hoist_scalar_references.txt +41 -0
- data/golden/array_index/expected/lir_02_inlined.txt +42 -0
- data/golden/array_index/expected/lir_03_cse.txt +40 -0
- data/golden/array_index/expected/lir_04_1_loop_fusion.txt +40 -0
- data/golden/array_index/expected/lir_04_loop_invcm.txt +40 -0
- data/golden/array_index/expected/lir_06_const_prop.txt +40 -0
- data/golden/array_index/expected/nast.txt +33 -0
- data/golden/array_index/expected/schema_javascript.mjs +46 -0
- data/golden/array_index/expected/schema_ruby.rb +75 -0
- data/golden/array_index/expected/snast.txt +33 -0
- data/golden/array_index/expected.json +5 -0
- data/golden/array_index/input.json +1 -0
- data/golden/array_index/schema.kumi +19 -0
- data/golden/array_operations/expected/ast.txt +50 -0
- data/golden/array_operations/expected/input_plan.txt +10 -0
- data/golden/array_operations/expected/lir_00_unoptimized.txt +47 -0
- data/golden/array_operations/expected/lir_01_hoist_scalar_references.txt +47 -0
- data/golden/array_operations/expected/lir_02_inlined.txt +47 -0
- data/golden/array_operations/expected/lir_03_cse.txt +47 -0
- data/golden/array_operations/expected/lir_04_1_loop_fusion.txt +47 -0
- data/golden/array_operations/expected/lir_04_loop_invcm.txt +47 -0
- data/golden/array_operations/expected/lir_06_const_prop.txt +47 -0
- data/golden/array_operations/expected/nast.txt +32 -0
- data/golden/array_operations/expected/schema_javascript.mjs +60 -0
- data/golden/array_operations/expected/schema_ruby.rb +91 -0
- data/golden/array_operations/expected/snast.txt +32 -0
- data/golden/array_operations/expected.json +27 -0
- data/golden/array_operations/input.json +8 -0
- data/golden/array_operations/schema.kumi +12 -10
- data/golden/cascade_logic/expected/ast.txt +37 -0
- data/golden/cascade_logic/expected/input_plan.txt +2 -0
- data/golden/cascade_logic/expected/lir_00_unoptimized.txt +29 -0
- data/golden/cascade_logic/expected/lir_01_hoist_scalar_references.txt +29 -0
- data/golden/cascade_logic/expected/lir_02_inlined.txt +37 -0
- data/golden/cascade_logic/expected/lir_03_cse.txt +30 -0
- data/golden/cascade_logic/expected/lir_04_1_loop_fusion.txt +30 -0
- data/golden/cascade_logic/expected/lir_04_loop_invcm.txt +30 -0
- data/golden/cascade_logic/expected/lir_06_const_prop.txt +30 -0
- data/golden/cascade_logic/expected/nast.txt +32 -0
- data/golden/cascade_logic/expected/schema_javascript.mjs +31 -0
- data/golden/cascade_logic/expected/schema_ruby.rb +57 -0
- data/golden/cascade_logic/expected/snast.txt +32 -0
- data/golden/cascade_logic/expected.json +5 -0
- data/golden/cascade_logic/input.json +4 -0
- data/golden/cascade_logic/schema.kumi +1 -3
- data/golden/chained_fusion/expected/ast.txt +57 -0
- data/golden/chained_fusion/expected/input_plan.txt +13 -0
- data/golden/chained_fusion/expected/lir_00_unoptimized.txt +76 -0
- data/golden/chained_fusion/expected/lir_01_hoist_scalar_references.txt +76 -0
- data/golden/chained_fusion/expected/lir_02_inlined.txt +114 -0
- data/golden/chained_fusion/expected/lir_03_cse.txt +97 -0
- data/golden/chained_fusion/expected/lir_04_1_loop_fusion.txt +99 -0
- data/golden/chained_fusion/expected/lir_04_loop_invcm.txt +97 -0
- data/golden/chained_fusion/expected/lir_06_const_prop.txt +97 -0
- data/golden/chained_fusion/expected/nast.txt +55 -0
- data/golden/chained_fusion/expected/schema_javascript.mjs +116 -0
- data/golden/chained_fusion/expected/schema_ruby.rb +149 -0
- data/golden/chained_fusion/expected/snast.txt +55 -0
- data/golden/chained_fusion/expected.json +45 -0
- data/golden/chained_fusion/input.json +51 -0
- data/golden/chained_fusion/schema.kumi +52 -0
- data/golden/element_arrays/expected/ast.txt +55 -0
- data/golden/element_arrays/expected/input_plan.txt +7 -0
- data/golden/element_arrays/expected/lir_00_unoptimized.txt +81 -0
- data/golden/element_arrays/expected/lir_01_hoist_scalar_references.txt +81 -0
- data/golden/element_arrays/expected/lir_02_inlined.txt +85 -0
- data/golden/element_arrays/expected/lir_03_cse.txt +83 -0
- data/golden/element_arrays/expected/lir_04_1_loop_fusion.txt +83 -0
- data/golden/element_arrays/expected/lir_04_loop_invcm.txt +83 -0
- data/golden/element_arrays/expected/lir_06_const_prop.txt +83 -0
- data/golden/element_arrays/expected/nast.txt +42 -0
- data/golden/element_arrays/expected/schema_javascript.mjs +106 -0
- data/golden/element_arrays/expected/schema_ruby.rb +141 -0
- data/golden/element_arrays/expected/snast.txt +42 -0
- data/golden/element_arrays/expected.json +55 -0
- data/golden/element_arrays/input.json +12 -0
- data/golden/element_arrays/schema.kumi +21 -0
- data/golden/empty_and_null_inputs/expected/ast.txt +42 -0
- data/golden/empty_and_null_inputs/expected/input_plan.txt +12 -0
- data/golden/empty_and_null_inputs/expected/lir_00_unoptimized.txt +31 -0
- data/golden/empty_and_null_inputs/expected/lir_01_hoist_scalar_references.txt +31 -0
- data/golden/empty_and_null_inputs/expected/lir_02_inlined.txt +51 -0
- data/golden/empty_and_null_inputs/expected/lir_03_cse.txt +49 -0
- data/golden/empty_and_null_inputs/expected/lir_04_1_loop_fusion.txt +49 -0
- data/golden/empty_and_null_inputs/expected/lir_04_loop_invcm.txt +49 -0
- data/golden/empty_and_null_inputs/expected/lir_06_const_prop.txt +49 -0
- data/golden/empty_and_null_inputs/expected/nast.txt +18 -0
- data/golden/empty_and_null_inputs/expected/schema_javascript.mjs +47 -0
- data/golden/empty_and_null_inputs/expected/schema_ruby.rb +79 -0
- data/golden/empty_and_null_inputs/expected/snast.txt +18 -0
- data/golden/empty_and_null_inputs/expected.json +8 -0
- data/golden/empty_and_null_inputs/input.json +16 -0
- data/golden/empty_and_null_inputs/schema.kumi +30 -0
- data/golden/game_of_life/expected/ast.txt +118 -0
- data/golden/game_of_life/expected/input_plan.txt +5 -0
- data/golden/game_of_life/expected/lir_00_unoptimized.txt +343 -0
- data/golden/game_of_life/expected/lir_01_hoist_scalar_references.txt +343 -0
- data/golden/game_of_life/expected/lir_02_inlined.txt +1918 -0
- data/golden/game_of_life/expected/lir_03_cse.txt +766 -0
- data/golden/game_of_life/expected/lir_04_1_loop_fusion.txt +766 -0
- data/golden/game_of_life/expected/lir_04_loop_invcm.txt +766 -0
- data/golden/game_of_life/expected/lir_06_const_prop.txt +766 -0
- data/golden/game_of_life/expected/nast.txt +104 -0
- data/golden/game_of_life/expected/schema_javascript.mjs +98 -0
- data/golden/game_of_life/expected/schema_ruby.rb +125 -0
- data/golden/game_of_life/expected/snast.txt +104 -0
- data/golden/game_of_life/expected.json +3 -0
- data/golden/game_of_life/input.json +8 -0
- data/golden/game_of_life/schema.kumi +33 -0
- data/golden/hash_keys/expected/ast.txt +29 -0
- data/golden/hash_keys/expected/input_plan.txt +2 -0
- data/golden/hash_keys/expected/lir_00_unoptimized.txt +18 -0
- data/golden/hash_keys/expected/lir_01_hoist_scalar_references.txt +18 -0
- data/golden/hash_keys/expected/lir_02_inlined.txt +18 -0
- data/golden/hash_keys/expected/lir_03_cse.txt +18 -0
- data/golden/hash_keys/expected/lir_04_1_loop_fusion.txt +18 -0
- data/golden/hash_keys/expected/lir_04_loop_invcm.txt +18 -0
- data/golden/hash_keys/expected/lir_06_const_prop.txt +18 -0
- data/golden/hash_keys/expected/nast.txt +46 -0
- data/golden/hash_keys/expected/schema_javascript.mjs +34 -0
- data/golden/hash_keys/expected/schema_ruby.rb +61 -0
- data/golden/hash_keys/expected/snast.txt +46 -0
- data/golden/hash_keys/expected.json +20 -0
- data/golden/hash_keys/input.json +4 -0
- data/golden/hash_keys/schema.kumi +14 -0
- data/golden/hash_value/expected/ast.txt +37 -0
- data/golden/hash_value/expected/input_plan.txt +7 -0
- data/golden/hash_value/expected/lir_00_unoptimized.txt +30 -0
- data/golden/hash_value/expected/lir_01_hoist_scalar_references.txt +30 -0
- data/golden/hash_value/expected/lir_02_inlined.txt +36 -0
- data/golden/hash_value/expected/lir_03_cse.txt +33 -0
- data/golden/hash_value/expected/lir_04_1_loop_fusion.txt +33 -0
- data/golden/hash_value/expected/lir_04_loop_invcm.txt +33 -0
- data/golden/hash_value/expected/lir_06_const_prop.txt +33 -0
- data/golden/hash_value/expected/nast.txt +25 -0
- data/golden/hash_value/expected/schema_javascript.mjs +46 -0
- data/golden/hash_value/expected/schema_ruby.rb +75 -0
- data/golden/hash_value/expected/snast.txt +25 -0
- data/golden/hash_value/expected.json +19 -0
- data/golden/hash_value/input.json +12 -0
- data/golden/hash_value/schema.kumi +19 -0
- data/golden/hierarchical_complex/expected/ast.txt +85 -0
- data/golden/hierarchical_complex/expected/input_plan.txt +23 -0
- data/golden/hierarchical_complex/expected/lir_00_unoptimized.txt +87 -0
- data/golden/hierarchical_complex/expected/lir_01_hoist_scalar_references.txt +87 -0
- data/golden/hierarchical_complex/expected/lir_02_inlined.txt +115 -0
- data/golden/hierarchical_complex/expected/lir_03_cse.txt +89 -0
- data/golden/hierarchical_complex/expected/lir_04_1_loop_fusion.txt +89 -0
- data/golden/hierarchical_complex/expected/lir_04_loop_invcm.txt +89 -0
- data/golden/hierarchical_complex/expected/lir_06_const_prop.txt +89 -0
- data/golden/hierarchical_complex/expected/nast.txt +49 -0
- data/golden/hierarchical_complex/expected/schema_javascript.mjs +121 -0
- data/golden/hierarchical_complex/expected/schema_ruby.rb +151 -0
- data/golden/hierarchical_complex/expected/snast.txt +49 -0
- data/golden/hierarchical_complex/expected.json +34 -0
- data/golden/hierarchical_complex/input.json +26 -0
- data/golden/hierarchical_complex/schema.kumi +38 -0
- data/golden/input_reference/expected/ast.txt +46 -0
- data/golden/input_reference/expected/input_plan.txt +15 -0
- data/golden/input_reference/expected/lir_00_unoptimized.txt +39 -0
- data/golden/input_reference/expected/lir_01_hoist_scalar_references.txt +39 -0
- data/golden/input_reference/expected/lir_02_inlined.txt +39 -0
- data/golden/input_reference/expected/lir_03_cse.txt +39 -0
- data/golden/input_reference/expected/lir_04_1_loop_fusion.txt +39 -0
- data/golden/input_reference/expected/lir_04_loop_invcm.txt +39 -0
- data/golden/input_reference/expected/lir_06_const_prop.txt +39 -0
- data/golden/input_reference/expected/nast.txt +21 -0
- data/golden/input_reference/expected/schema_javascript.mjs +45 -0
- data/golden/input_reference/expected/schema_ruby.rb +74 -0
- data/golden/input_reference/expected/snast.txt +21 -0
- data/golden/input_reference/expected.json +7 -0
- data/golden/input_reference/input.json +11 -0
- data/golden/input_reference/schema.kumi +22 -0
- data/golden/interleaved_fusion/expected/ast.txt +51 -0
- data/golden/interleaved_fusion/expected/input_plan.txt +13 -0
- data/golden/interleaved_fusion/expected/lir_00_unoptimized.txt +53 -0
- data/golden/interleaved_fusion/expected/lir_01_hoist_scalar_references.txt +53 -0
- data/golden/interleaved_fusion/expected/lir_02_inlined.txt +89 -0
- data/golden/interleaved_fusion/expected/lir_03_cse.txt +77 -0
- data/golden/interleaved_fusion/expected/lir_04_1_loop_fusion.txt +77 -0
- data/golden/interleaved_fusion/expected/lir_04_loop_invcm.txt +77 -0
- data/golden/interleaved_fusion/expected/lir_06_const_prop.txt +77 -0
- data/golden/interleaved_fusion/expected/nast.txt +41 -0
- data/golden/interleaved_fusion/expected/schema_javascript.mjs +86 -0
- data/golden/interleaved_fusion/expected/schema_ruby.rb +122 -0
- data/golden/interleaved_fusion/expected/snast.txt +41 -0
- data/golden/interleaved_fusion/expected.json +37 -0
- data/golden/interleaved_fusion/input.json +26 -0
- data/golden/interleaved_fusion/schema.kumi +57 -0
- data/golden/let_inline/expected/ast.txt +33 -0
- data/golden/let_inline/expected/input_plan.txt +2 -0
- data/golden/let_inline/expected/lir_00_unoptimized.txt +26 -0
- data/golden/let_inline/expected/lir_01_hoist_scalar_references.txt +26 -0
- data/golden/let_inline/expected/lir_02_inlined.txt +36 -0
- data/golden/let_inline/expected/lir_03_cse.txt +30 -0
- data/golden/let_inline/expected/lir_04_1_loop_fusion.txt +30 -0
- data/golden/let_inline/expected/lir_04_loop_invcm.txt +30 -0
- data/golden/let_inline/expected/lir_06_const_prop.txt +30 -0
- data/golden/let_inline/expected/nast.txt +26 -0
- data/golden/let_inline/expected/schema_javascript.mjs +11 -0
- data/golden/let_inline/expected/schema_ruby.rb +37 -0
- data/golden/let_inline/expected/snast.txt +26 -0
- data/golden/let_inline/expected.json +1 -0
- data/golden/let_inline/input.json +1 -0
- data/golden/let_inline/schema.kumi +11 -0
- data/golden/loop_fusion/expected/ast.txt +44 -0
- data/golden/loop_fusion/expected/input_plan.txt +13 -0
- data/golden/loop_fusion/expected/lir_00_unoptimized.txt +43 -0
- data/golden/loop_fusion/expected/lir_01_hoist_scalar_references.txt +43 -0
- data/golden/loop_fusion/expected/lir_02_inlined.txt +62 -0
- data/golden/loop_fusion/expected/lir_03_cse.txt +57 -0
- data/golden/loop_fusion/expected/lir_04_1_loop_fusion.txt +57 -0
- data/golden/loop_fusion/expected/lir_04_loop_invcm.txt +57 -0
- data/golden/loop_fusion/expected/lir_06_const_prop.txt +57 -0
- data/golden/loop_fusion/expected/nast.txt +32 -0
- data/golden/loop_fusion/expected/schema_javascript.mjs +64 -0
- data/golden/loop_fusion/expected/schema_ruby.rb +97 -0
- data/golden/loop_fusion/expected/snast.txt +32 -0
- data/golden/loop_fusion/expected.json +30 -0
- data/golden/loop_fusion/input.json +28 -0
- data/golden/loop_fusion/schema.kumi +32 -0
- data/golden/min_reduce_scope/expected/ast.txt +49 -0
- data/golden/min_reduce_scope/expected/input_plan.txt +9 -0
- data/golden/min_reduce_scope/expected/lir_00_unoptimized.txt +59 -0
- data/golden/min_reduce_scope/expected/lir_01_hoist_scalar_references.txt +59 -0
- data/golden/min_reduce_scope/expected/lir_02_inlined.txt +63 -0
- data/golden/min_reduce_scope/expected/lir_03_cse.txt +60 -0
- data/golden/min_reduce_scope/expected/lir_04_1_loop_fusion.txt +60 -0
- data/golden/min_reduce_scope/expected/lir_04_loop_invcm.txt +60 -0
- data/golden/min_reduce_scope/expected/lir_06_const_prop.txt +60 -0
- data/golden/min_reduce_scope/expected/nast.txt +29 -0
- data/golden/min_reduce_scope/expected/schema_javascript.mjs +66 -0
- data/golden/min_reduce_scope/expected/schema_ruby.rb +99 -0
- data/golden/min_reduce_scope/expected/snast.txt +29 -0
- data/golden/min_reduce_scope/expected.json +9 -0
- data/golden/min_reduce_scope/input.json +18 -0
- data/golden/min_reduce_scope/schema.kumi +25 -0
- data/golden/mixed_dimensions/expected/ast.txt +54 -0
- data/golden/mixed_dimensions/expected/input_plan.txt +15 -0
- data/golden/mixed_dimensions/expected/lir_00_unoptimized.txt +42 -0
- data/golden/mixed_dimensions/expected/lir_01_hoist_scalar_references.txt +42 -0
- data/golden/mixed_dimensions/expected/lir_02_inlined.txt +48 -0
- data/golden/mixed_dimensions/expected/lir_03_cse.txt +48 -0
- data/golden/mixed_dimensions/expected/lir_04_1_loop_fusion.txt +48 -0
- data/golden/mixed_dimensions/expected/lir_04_loop_invcm.txt +48 -0
- data/golden/mixed_dimensions/expected/lir_06_const_prop.txt +48 -0
- data/golden/mixed_dimensions/expected/nast.txt +22 -0
- data/golden/mixed_dimensions/expected/schema_javascript.mjs +53 -0
- data/golden/mixed_dimensions/expected/schema_ruby.rb +84 -0
- data/golden/mixed_dimensions/expected/snast.txt +22 -0
- data/golden/mixed_dimensions/expected.json +6 -0
- data/golden/mixed_dimensions/input.json +22 -0
- data/golden/mixed_dimensions/schema.kumi +35 -0
- data/golden/multirank_hoisting/expected/ast.txt +72 -0
- data/golden/multirank_hoisting/expected/input_plan.txt +18 -0
- data/golden/multirank_hoisting/expected/lir_00_unoptimized.txt +75 -0
- data/golden/multirank_hoisting/expected/lir_01_hoist_scalar_references.txt +75 -0
- data/golden/multirank_hoisting/expected/lir_02_inlined.txt +126 -0
- data/golden/multirank_hoisting/expected/lir_03_cse.txt +109 -0
- data/golden/multirank_hoisting/expected/lir_04_1_loop_fusion.txt +109 -0
- data/golden/multirank_hoisting/expected/lir_04_loop_invcm.txt +109 -0
- data/golden/multirank_hoisting/expected/lir_06_const_prop.txt +109 -0
- data/golden/multirank_hoisting/expected/nast.txt +39 -0
- data/golden/multirank_hoisting/expected/schema_javascript.mjs +128 -0
- data/golden/multirank_hoisting/expected/schema_ruby.rb +162 -0
- data/golden/multirank_hoisting/expected/snast.txt +39 -0
- data/golden/multirank_hoisting/expected.json +15 -0
- data/golden/multirank_hoisting/input.json +19 -0
- data/golden/multirank_hoisting/schema.kumi +38 -0
- data/golden/nested_hash/expected/ast.txt +22 -0
- data/golden/nested_hash/expected/input_plan.txt +5 -0
- data/golden/nested_hash/expected/lir_00_unoptimized.txt +10 -0
- data/golden/nested_hash/expected/lir_01_hoist_scalar_references.txt +10 -0
- data/golden/nested_hash/expected/lir_02_inlined.txt +10 -0
- data/golden/nested_hash/expected/lir_03_cse.txt +10 -0
- data/golden/nested_hash/expected/lir_04_1_loop_fusion.txt +10 -0
- data/golden/nested_hash/expected/lir_04_loop_invcm.txt +10 -0
- data/golden/nested_hash/expected/lir_06_const_prop.txt +10 -0
- data/golden/nested_hash/expected/nast.txt +8 -0
- data/golden/nested_hash/expected/schema_javascript.mjs +9 -0
- data/golden/nested_hash/expected/schema_ruby.rb +35 -0
- data/golden/nested_hash/expected/snast.txt +8 -0
- data/golden/nested_hash/expected.json +3 -0
- data/golden/nested_hash/input.json +7 -0
- data/golden/nested_hash/schema.kumi +11 -0
- data/golden/reduction_broadcast/expected/ast.txt +49 -0
- data/golden/reduction_broadcast/expected/input_plan.txt +13 -0
- data/golden/reduction_broadcast/expected/lir_00_unoptimized.txt +49 -0
- data/golden/reduction_broadcast/expected/lir_01_hoist_scalar_references.txt +49 -0
- data/golden/reduction_broadcast/expected/lir_02_inlined.txt +80 -0
- data/golden/reduction_broadcast/expected/lir_03_cse.txt +68 -0
- data/golden/reduction_broadcast/expected/lir_04_1_loop_fusion.txt +68 -0
- data/golden/reduction_broadcast/expected/lir_04_loop_invcm.txt +68 -0
- data/golden/reduction_broadcast/expected/lir_06_const_prop.txt +68 -0
- data/golden/reduction_broadcast/expected/nast.txt +24 -0
- data/golden/reduction_broadcast/expected/schema_javascript.mjs +74 -0
- data/golden/reduction_broadcast/expected/schema_ruby.rb +110 -0
- data/golden/reduction_broadcast/expected/snast.txt +24 -0
- data/golden/reduction_broadcast/expected.json +25 -0
- data/golden/reduction_broadcast/input.json +19 -0
- data/golden/reduction_broadcast/schema.kumi +34 -0
- data/golden/roll/expected/ast.txt +36 -0
- data/golden/roll/expected/input_plan.txt +3 -0
- data/golden/roll/expected/lir_00_unoptimized.txt +56 -0
- data/golden/roll/expected/lir_01_hoist_scalar_references.txt +56 -0
- data/golden/roll/expected/lir_02_inlined.txt +56 -0
- data/golden/roll/expected/lir_03_cse.txt +55 -0
- data/golden/roll/expected/lir_04_1_loop_fusion.txt +55 -0
- data/golden/roll/expected/lir_04_loop_invcm.txt +55 -0
- data/golden/roll/expected/lir_06_const_prop.txt +55 -0
- data/golden/roll/expected/nast.txt +26 -0
- data/golden/roll/expected/schema_javascript.mjs +65 -0
- data/golden/roll/expected/schema_ruby.rb +95 -0
- data/golden/roll/expected/snast.txt +26 -0
- data/golden/roll/expected.json +6 -0
- data/golden/roll/input.json +1 -0
- data/golden/roll/schema.kumi +13 -0
- data/golden/shift/expected/ast.txt +48 -0
- data/golden/shift/expected/input_plan.txt +3 -0
- data/golden/shift/expected/lir_00_unoptimized.txt +96 -0
- data/golden/shift/expected/lir_01_hoist_scalar_references.txt +96 -0
- data/golden/shift/expected/lir_02_inlined.txt +96 -0
- data/golden/shift/expected/lir_03_cse.txt +90 -0
- data/golden/shift/expected/lir_04_1_loop_fusion.txt +90 -0
- data/golden/shift/expected/lir_04_loop_invcm.txt +90 -0
- data/golden/shift/expected/lir_06_const_prop.txt +90 -0
- data/golden/shift/expected/nast.txt +38 -0
- data/golden/shift/expected/schema_javascript.mjs +106 -0
- data/golden/shift/expected/schema_ruby.rb +138 -0
- data/golden/shift/expected/snast.txt +38 -0
- data/golden/shift/expected.json +8 -0
- data/golden/shift/input.json +1 -0
- data/golden/shift/schema.kumi +15 -0
- data/golden/shift_2d/expected/ast.txt +88 -0
- data/golden/shift_2d/expected/input_plan.txt +5 -0
- data/golden/shift_2d/expected/lir_00_unoptimized.txt +274 -0
- data/golden/shift_2d/expected/lir_01_hoist_scalar_references.txt +274 -0
- data/golden/shift_2d/expected/lir_02_inlined.txt +274 -0
- data/golden/shift_2d/expected/lir_03_cse.txt +262 -0
- data/golden/shift_2d/expected/lir_04_1_loop_fusion.txt +262 -0
- data/golden/shift_2d/expected/lir_04_loop_invcm.txt +262 -0
- data/golden/shift_2d/expected/lir_06_const_prop.txt +262 -0
- data/golden/shift_2d/expected/nast.txt +74 -0
- data/golden/shift_2d/expected/schema_javascript.mjs +320 -0
- data/golden/shift_2d/expected/schema_ruby.rb +358 -0
- data/golden/shift_2d/expected/snast.txt +74 -0
- data/golden/shift_2d/expected.json +15 -0
- data/golden/shift_2d/input.json +14 -0
- data/golden/shift_2d/schema.kumi +25 -0
- data/golden/simple_math/expected/ast.txt +40 -0
- data/golden/simple_math/expected/input_plan.txt +2 -0
- data/golden/simple_math/expected/lir_00_unoptimized.txt +31 -0
- data/golden/simple_math/expected/lir_01_hoist_scalar_references.txt +31 -0
- data/golden/simple_math/expected/lir_02_inlined.txt +31 -0
- data/golden/simple_math/expected/lir_03_cse.txt +31 -0
- data/golden/simple_math/expected/lir_04_1_loop_fusion.txt +31 -0
- data/golden/simple_math/expected/lir_04_loop_invcm.txt +31 -0
- data/golden/simple_math/expected/lir_06_const_prop.txt +31 -0
- data/golden/simple_math/expected/nast.txt +33 -0
- data/golden/simple_math/expected/schema_javascript.mjs +33 -0
- data/golden/simple_math/expected/schema_ruby.rb +59 -0
- data/golden/simple_math/expected/snast.txt +33 -0
- data/golden/simple_math/expected.json +1 -0
- data/golden/simple_math/input.json +4 -0
- data/golden/simple_math/schema.kumi +2 -1
- data/golden/streaming_basics/expected/ast.txt +64 -0
- data/golden/streaming_basics/expected/input_plan.txt +8 -0
- data/golden/streaming_basics/expected/lir_00_unoptimized.txt +73 -0
- data/golden/streaming_basics/expected/lir_01_hoist_scalar_references.txt +73 -0
- data/golden/streaming_basics/expected/lir_02_inlined.txt +100 -0
- data/golden/streaming_basics/expected/lir_03_cse.txt +84 -0
- data/golden/streaming_basics/expected/lir_04_1_loop_fusion.txt +84 -0
- data/golden/streaming_basics/expected/lir_04_loop_invcm.txt +84 -0
- data/golden/streaming_basics/expected/lir_06_const_prop.txt +84 -0
- data/golden/streaming_basics/expected/nast.txt +48 -0
- data/golden/streaming_basics/expected/schema_javascript.mjs +94 -0
- data/golden/streaming_basics/expected/schema_ruby.rb +127 -0
- data/golden/streaming_basics/expected/snast.txt +48 -0
- data/golden/streaming_basics/expected.json +10 -0
- data/golden/streaming_basics/input.json +8 -0
- data/golden/streaming_basics/schema.kumi +24 -0
- data/golden/tuples/expected/ast.txt +48 -0
- data/golden/tuples/expected/input_plan.txt +1 -0
- data/golden/tuples/expected/lir_00_unoptimized.txt +40 -0
- data/golden/tuples/expected/lir_01_hoist_scalar_references.txt +40 -0
- data/golden/tuples/expected/lir_02_inlined.txt +48 -0
- data/golden/tuples/expected/lir_03_cse.txt +48 -0
- data/golden/tuples/expected/lir_04_1_loop_fusion.txt +48 -0
- data/golden/tuples/expected/lir_04_loop_invcm.txt +48 -0
- data/golden/tuples/expected/lir_06_const_prop.txt +48 -0
- data/golden/tuples/expected/nast.txt +42 -0
- data/golden/tuples/expected/schema_javascript.mjs +51 -0
- data/golden/tuples/expected/schema_ruby.rb +77 -0
- data/golden/tuples/expected/snast.txt +42 -0
- data/golden/tuples/expected.json +7 -0
- data/golden/tuples/input.json +3 -0
- data/golden/tuples/schema.kumi +11 -0
- data/golden/tuples_and_arrays/expected/ast.txt +44 -0
- data/golden/tuples_and_arrays/expected/input_plan.txt +7 -0
- data/golden/tuples_and_arrays/expected/lir_00_unoptimized.txt +41 -0
- data/golden/tuples_and_arrays/expected/lir_01_hoist_scalar_references.txt +41 -0
- data/golden/tuples_and_arrays/expected/lir_02_inlined.txt +62 -0
- data/golden/tuples_and_arrays/expected/lir_03_cse.txt +51 -0
- data/golden/tuples_and_arrays/expected/lir_04_1_loop_fusion.txt +51 -0
- data/golden/tuples_and_arrays/expected/lir_04_loop_invcm.txt +51 -0
- data/golden/tuples_and_arrays/expected/lir_06_const_prop.txt +51 -0
- data/golden/tuples_and_arrays/expected/nast.txt +28 -0
- data/golden/tuples_and_arrays/expected/schema_javascript.mjs +58 -0
- data/golden/tuples_and_arrays/expected/schema_ruby.rb +88 -0
- data/golden/tuples_and_arrays/expected/snast.txt +28 -0
- data/golden/tuples_and_arrays/expected.json +18 -0
- data/golden/tuples_and_arrays/input.json +7 -0
- data/golden/tuples_and_arrays/schema.kumi +38 -0
- data/golden/with_constants/expected/ast.txt +28 -0
- data/golden/with_constants/expected/input_plan.txt +2 -0
- data/golden/with_constants/expected/lir_00_unoptimized.txt +17 -0
- data/golden/with_constants/expected/lir_01_hoist_scalar_references.txt +17 -0
- data/golden/with_constants/expected/lir_02_inlined.txt +17 -0
- data/golden/with_constants/expected/lir_03_cse.txt +17 -0
- data/golden/with_constants/expected/lir_04_1_loop_fusion.txt +17 -0
- data/golden/with_constants/expected/lir_04_loop_invcm.txt +17 -0
- data/golden/with_constants/expected/lir_06_const_prop.txt +17 -0
- data/golden/with_constants/expected/nast.txt +21 -0
- data/golden/with_constants/expected/schema_javascript.mjs +18 -0
- data/golden/with_constants/expected/schema_ruby.rb +44 -0
- data/golden/with_constants/expected/snast.txt +15 -0
- data/golden/with_constants/schema.kumi +10 -0
- data/lib/kumi/analyzer.rb +76 -24
- data/lib/kumi/configuration.rb +60 -0
- data/lib/kumi/core/analyzer/binder.rb +121 -0
- data/lib/kumi/core/analyzer/checkpoint.rb +15 -9
- data/lib/kumi/core/analyzer/constant_evaluator.rb +32 -37
- data/lib/kumi/core/analyzer/constant_folding_helpers.rb +55 -0
- data/lib/kumi/core/analyzer/debug.rb +14 -16
- data/lib/kumi/core/analyzer/fn_aliases.rb +46 -0
- data/lib/kumi/core/analyzer/folder.rb +94 -0
- data/lib/kumi/core/analyzer/macro_expander.rb +69 -0
- data/lib/kumi/core/analyzer/passes/assemble_irv2_pass.rb +130 -0
- data/lib/kumi/core/analyzer/passes/attach_anchors_pass.rb +71 -0
- data/lib/kumi/core/analyzer/passes/attach_terminal_info_pass.rb +181 -0
- data/lib/kumi/core/analyzer/passes/codegen/js/declaration_emitter.rb +317 -0
- data/lib/kumi/core/analyzer/passes/codegen/js/emitter.rb +75 -0
- data/lib/kumi/core/analyzer/passes/codegen/js/output_buffer.rb +103 -0
- data/lib/kumi/core/analyzer/passes/codegen/js_pass.rb +27 -0
- data/lib/kumi/core/analyzer/passes/codegen/ruby/declaration_emitter.rb +321 -0
- data/lib/kumi/core/analyzer/passes/codegen/ruby/emitter.rb +85 -0
- data/lib/kumi/core/analyzer/passes/codegen/ruby/output_buffer.rb +111 -0
- data/lib/kumi/core/analyzer/passes/codegen/ruby_pass.rb +32 -0
- data/lib/kumi/core/analyzer/passes/constant_folding_pass.rb +33 -0
- data/lib/kumi/core/analyzer/passes/contract_checker_pass.rb +220 -0
- data/lib/kumi/core/analyzer/passes/dependency_resolver.rb +5 -6
- data/lib/kumi/core/analyzer/passes/input_access_planner_pass.rb +7 -3
- data/lib/kumi/core/analyzer/passes/input_collector.rb +74 -122
- data/lib/kumi/core/analyzer/passes/input_form_schema_pass.rb +43 -0
- data/lib/kumi/core/analyzer/passes/ir_dependency_pass.rb +1 -1
- data/lib/kumi/core/analyzer/passes/ir_execution_schedule_pass.rb +1 -1
- data/lib/kumi/core/analyzer/passes/join_reduce_planning_pass.rb +21 -23
- data/lib/kumi/core/analyzer/passes/lir/constant_propagation_pass.rb +84 -0
- data/lib/kumi/core/analyzer/passes/lir/dead_code_elimination_pass.rb +93 -0
- data/lib/kumi/core/analyzer/passes/lir/hoist_scalar_references_pass.rb +115 -0
- data/lib/kumi/core/analyzer/passes/lir/inline_declarations_pass.rb +274 -0
- data/lib/kumi/core/analyzer/passes/lir/instruction_scheduling_pass.rb +198 -0
- data/lib/kumi/core/analyzer/passes/lir/kernel_binding_pass.rb +30 -0
- data/lib/kumi/core/analyzer/passes/lir/local_cse_pass.rb +121 -0
- data/lib/kumi/core/analyzer/passes/lir/loop_fusion_pass.rb +156 -0
- data/lib/kumi/core/analyzer/passes/lir/loop_invariant_code_motion_pass.rb +148 -0
- data/lib/kumi/core/analyzer/passes/lir/lower_pass.rb +407 -0
- data/lib/kumi/core/analyzer/passes/lir/stencil_emitter.rb +243 -0
- data/lib/kumi/core/analyzer/passes/lir/validation_pass.rb +83 -0
- data/lib/kumi/core/analyzer/passes/load_input_cse.rb +17 -16
- data/lib/kumi/core/analyzer/passes/lower_to_ir_pass.rb +4 -2
- data/lib/kumi/core/analyzer/passes/lower_to_irv2_pass.rb +197 -0
- data/lib/kumi/core/analyzer/passes/name_indexer.rb +4 -1
- data/lib/kumi/core/analyzer/passes/nast_dimensional_analyzer_pass.rb +237 -0
- data/lib/kumi/core/analyzer/passes/normalize_to_nast_pass.rb +156 -0
- data/lib/kumi/core/analyzer/passes/output_schema_pass.rb +38 -0
- data/lib/kumi/core/analyzer/passes/pass_base.rb +30 -4
- data/lib/kumi/core/analyzer/passes/precompute_access_paths_pass.rb +93 -0
- data/lib/kumi/core/analyzer/passes/scope_resolution_pass.rb +33 -30
- data/lib/kumi/core/analyzer/passes/semantic_constraint_validator.rb +5 -26
- data/lib/kumi/core/analyzer/passes/snast_pass.rb +229 -0
- data/lib/kumi/core/analyzer/passes/toposorter.rb +1 -0
- data/lib/kumi/core/analyzer/passes/type_checker.rb +13 -0
- data/lib/kumi/core/analyzer/passes/type_inferencer_pass.rb +14 -16
- data/lib/kumi/core/analyzer/passes/unsat_detector.rb +2 -1
- data/lib/kumi/core/analyzer/plans.rb +12 -0
- data/lib/kumi/core/analyzer/state_serde.rb +4 -4
- data/lib/kumi/core/analyzer/structs/access_plan.rb +2 -2
- data/lib/kumi/core/analyzer/unsat_constant_evaluator.rb +59 -0
- data/lib/kumi/core/compiler/access_codegen.rb +1 -1
- data/lib/kumi/core/compiler/access_emit/base.rb +9 -5
- data/lib/kumi/core/compiler/access_emit/each_indexed.rb +10 -3
- data/lib/kumi/core/compiler/access_emit/materialize.rb +12 -5
- data/lib/kumi/core/compiler/access_emit/ravel.rb +10 -3
- data/lib/kumi/core/compiler/access_emit/read.rb +4 -1
- data/lib/kumi/core/compiler/access_planner.rb +42 -4
- data/lib/kumi/core/compiler/access_planner_v2.rb +164 -0
- data/lib/kumi/core/explain.rb +18 -11
- data/lib/kumi/core/functions/loader.rb +47 -0
- data/lib/kumi/core/functions/model.rb +10 -0
- data/lib/kumi/core/functions/type_rules.rb +108 -0
- data/lib/kumi/core/ir/execution_engine/interpreter.rb +1 -1
- data/lib/kumi/core/ir/execution_engine/profiler.rb +107 -97
- data/lib/kumi/core/ir.rb +6 -2
- data/lib/kumi/core/irv2/builder.rb +48 -0
- data/lib/kumi/core/irv2/declaration.rb +28 -0
- data/lib/kumi/core/irv2/module.rb +108 -0
- data/lib/kumi/core/irv2/value.rb +28 -0
- data/lib/kumi/core/lir/analyze.rb +64 -0
- data/lib/kumi/core/lir/build.rb +363 -0
- data/lib/kumi/core/lir/emit.rb +62 -0
- data/lib/kumi/core/lir/structs/instruction.rb +44 -0
- data/lib/kumi/core/lir/structs/literal.rb +14 -0
- data/lib/kumi/core/lir/structs/stamp.rb +13 -0
- data/lib/kumi/core/lir/support/error.rb +9 -0
- data/lib/kumi/core/lir/support/ids.rb +34 -0
- data/lib/kumi/core/lir/validate.rb +74 -0
- data/lib/kumi/core/lir.rb +34 -0
- data/lib/kumi/core/nast.rb +216 -0
- data/lib/kumi/core/ruby_parser/dsl.rb +2 -2
- data/lib/kumi/core/ruby_parser/dsl_cascade_builder.rb +1 -1
- data/lib/kumi/core/ruby_parser/expression_converter.rb +10 -0
- data/lib/kumi/core/ruby_parser/input_builder.rb +16 -17
- data/lib/kumi/core/ruby_parser/schema_builder.rb +36 -10
- data/lib/kumi/core/ruby_parser/sugar.rb +64 -0
- data/lib/kumi/core/types/builder.rb +2 -2
- data/lib/kumi/core/types/normalizer.rb +2 -0
- data/lib/kumi/core/types/validator.rb +10 -3
- data/lib/kumi/core/types.rb +7 -0
- data/lib/kumi/dev/codegen.rb +194 -0
- data/lib/kumi/dev/golden/generator.rb +105 -0
- data/lib/kumi/dev/golden/reporter.rb +160 -0
- data/lib/kumi/dev/golden/representation.rb +45 -0
- data/lib/kumi/dev/golden/result.rb +98 -0
- data/lib/kumi/dev/golden/runtime_test.rb +93 -0
- data/lib/kumi/dev/golden/suite.rb +131 -0
- data/lib/kumi/dev/golden/verifier.rb +76 -0
- data/lib/kumi/dev/golden.rb +75 -0
- data/lib/kumi/dev/ir.rb +4 -4
- data/lib/kumi/dev/parse.rb +1 -1
- data/lib/kumi/dev/pretty_printer.rb +229 -0
- data/lib/kumi/dev/printer/irv2_formatter.rb +163 -0
- data/lib/kumi/dev/printer/width_aware_json.rb +44 -0
- data/lib/kumi/dev/profile_aggregator.rb +36 -38
- data/lib/kumi/dev/profile_runner.rb +19 -23
- data/lib/kumi/dev/runner.rb +12 -22
- data/lib/kumi/dev/support/kumi_runner.mjs +39 -0
- data/lib/kumi/dev.rb +3 -3
- data/lib/kumi/frontends/ruby.rb +12 -12
- data/lib/kumi/frontends/text.rb +26 -21
- data/lib/kumi/frontends.rb +6 -8
- data/lib/kumi/kernel_registry.rb +59 -0
- data/lib/kumi/pack/builder.rb +229 -0
- data/lib/kumi/pack.rb +15 -0
- data/lib/kumi/registry_v2/loader.rb +81 -0
- data/lib/kumi/registry_v2.rb +118 -0
- data/lib/kumi/schema.rb +83 -43
- data/lib/kumi/support/diff.rb +3 -2
- data/lib/kumi/support/ir_render.rb +1 -1
- data/lib/kumi/support/lir_printer.rb +143 -0
- data/lib/kumi/support/nast_printer.rb +93 -0
- data/lib/kumi/support/s_expression_printer.rb +5 -4
- data/lib/kumi/support/snast_printer.rb +111 -0
- data/lib/kumi/syntax/call_expression.rb +1 -1
- data/lib/kumi/syntax/input_declaration.rb +2 -2
- data/lib/kumi/syntax/node.rb +4 -12
- data/lib/kumi/syntax/root.rb +10 -0
- data/lib/kumi/syntax/trait_declaration.rb +1 -0
- data/lib/kumi/syntax/value_declaration.rb +1 -0
- data/lib/kumi/version.rb +1 -1
- data/lib/kumi.rb +46 -4
- metadata +571 -54
- data/docs/AST.md +0 -133
- data/docs/DSL.md +0 -154
- data/docs/FUNCTIONS.md +0 -176
- data/docs/VECTOR_SEMANTICS.md +0 -286
- data/docs/compiler_design_principles.md +0 -86
- data/docs/dev/analyzer-debug.md +0 -52
- data/docs/dev/parse-command.md +0 -64
- data/docs/dev/vm-profiling.md +0 -95
- data/docs/development/README.md +0 -120
- data/docs/development/error-reporting.md +0 -361
- data/docs/features/README.md +0 -58
- data/docs/features/analysis-type-inference.md +0 -42
- data/docs/features/analysis-unsat-detection.md +0 -71
- data/docs/features/hierarchical-broadcasting.md +0 -415
- data/docs/features/input-declaration-system.md +0 -58
- data/docs/features/performance.md +0 -14
- data/docs/features/s-expression-printer.md +0 -77
- data/docs/schema_metadata/broadcasts.md +0 -53
- data/docs/schema_metadata/cascades.md +0 -45
- data/docs/schema_metadata/declarations.md +0 -54
- data/docs/schema_metadata/dependencies.md +0 -57
- data/docs/schema_metadata/evaluation_order.md +0 -29
- data/docs/schema_metadata/examples.md +0 -95
- data/docs/schema_metadata/inferred_types.md +0 -46
- data/docs/schema_metadata/inputs.md +0 -86
- data/docs/schema_metadata.md +0 -108
- data/golden/mixed_nesting/schema.kumi +0 -42
- data/lib/kumi/core/function_registry/collection_functions.rb +0 -298
- data/lib/kumi/core/function_registry/comparison_functions.rb +0 -33
- data/lib/kumi/core/function_registry/conditional_functions.rb +0 -48
- data/lib/kumi/core/function_registry/function_builder.rb +0 -184
- data/lib/kumi/core/function_registry/logical_functions.rb +0 -214
- data/lib/kumi/core/function_registry/math_functions.rb +0 -74
- data/lib/kumi/core/function_registry/stat_functions.rb +0 -156
- data/lib/kumi/core/function_registry/string_functions.rb +0 -57
- data/lib/kumi/core/function_registry/type_functions.rb +0 -53
- data/lib/kumi/core/function_registry.rb +0 -176
- data/lib/kumi/registry.rb +0 -32
- data/lib/kumi/runtime/executable.rb +0 -135
- data/lib/kumi/runtime/run.rb +0 -105
- data/performance_results.txt +0 -63
- data/scripts/analyze_broadcast_methods.rb +0 -68
- data/scripts/analyze_cascade_methods.rb +0 -74
- data/scripts/check_broadcasting_coverage.rb +0 -51
- data/scripts/find_dead_code.rb +0 -114
- data/scripts/generate_function_docs.rb +0 -71
- data/scripts/test_mixed_nesting_performance.rb +0 -206
@@ -1,176 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Kumi
|
4
|
-
module Core
|
5
|
-
# Internal function registry (single source of truth).
|
6
|
-
module FunctionRegistry
|
7
|
-
Entry = FunctionBuilder::Entry
|
8
|
-
|
9
|
-
CORE_OPERATORS = %i[== > < >= <= != between?].freeze
|
10
|
-
|
11
|
-
# Build core functions once
|
12
|
-
CORE_FUNCTIONS = {}.tap do |registry|
|
13
|
-
[
|
14
|
-
ComparisonFunctions.definitions,
|
15
|
-
MathFunctions.definitions,
|
16
|
-
StringFunctions.definitions,
|
17
|
-
LogicalFunctions.definitions,
|
18
|
-
CollectionFunctions.definitions,
|
19
|
-
ConditionalFunctions.definitions,
|
20
|
-
TypeFunctions.definitions,
|
21
|
-
StatFunctions.definitions
|
22
|
-
].each do |defs|
|
23
|
-
defs.each do |name, entry|
|
24
|
-
raise ArgumentError, "Duplicate core function: #{name}" if registry.key?(name)
|
25
|
-
|
26
|
-
registry[name] = entry
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end.freeze
|
30
|
-
|
31
|
-
@lock = Mutex.new
|
32
|
-
@functions = CORE_FUNCTIONS.transform_values(&:dup)
|
33
|
-
@frozen = false
|
34
|
-
|
35
|
-
class FrozenError < RuntimeError; end
|
36
|
-
|
37
|
-
class << self
|
38
|
-
def auto_register(*mods)
|
39
|
-
mods.each do |mod|
|
40
|
-
mod.public_instance_methods(false).each do |m|
|
41
|
-
next if function?(m)
|
42
|
-
|
43
|
-
register(m) { |*args| mod.new.public_send(m, *args) }
|
44
|
-
end
|
45
|
-
mod.singleton_methods(false).each do |m|
|
46
|
-
next if function?(m)
|
47
|
-
|
48
|
-
fn = mod.method(m)
|
49
|
-
register(m) { |*args| fn.call(*args) }
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
#
|
55
|
-
# Lifecycle
|
56
|
-
#
|
57
|
-
def reset!
|
58
|
-
@lock.synchronize do
|
59
|
-
@functions = CORE_FUNCTIONS.transform_values(&:dup)
|
60
|
-
@frozen = false
|
61
|
-
end
|
62
|
-
end
|
63
|
-
|
64
|
-
def freeze!
|
65
|
-
@lock.synchronize do
|
66
|
-
@functions.each_value(&:freeze)
|
67
|
-
@functions.freeze
|
68
|
-
@frozen = true
|
69
|
-
end
|
70
|
-
end
|
71
|
-
|
72
|
-
def frozen?
|
73
|
-
@frozen
|
74
|
-
end
|
75
|
-
|
76
|
-
#
|
77
|
-
# Registration
|
78
|
-
#
|
79
|
-
# Unified entry point; used by both public and internal callers.
|
80
|
-
def register(name, fn_or = nil, **meta, &block)
|
81
|
-
fn = fn_or || block
|
82
|
-
raise ArgumentError, "block or Proc required" unless fn.is_a?(Proc)
|
83
|
-
|
84
|
-
defaults = {
|
85
|
-
arity: fn.arity,
|
86
|
-
param_types: [:any],
|
87
|
-
return_type: :any,
|
88
|
-
description: nil,
|
89
|
-
param_modes: nil,
|
90
|
-
reducer: false,
|
91
|
-
structure_function: false
|
92
|
-
}
|
93
|
-
register_with_metadata(name, fn, **defaults, **meta)
|
94
|
-
end
|
95
|
-
|
96
|
-
# Back-compat explicit API
|
97
|
-
def register_with_metadata(name, fn, arity:, param_types: [:any], return_type: :any,
|
98
|
-
description: nil, param_modes: nil, reducer: false,
|
99
|
-
structure_function: false)
|
100
|
-
@lock.synchronize do
|
101
|
-
raise FrozenError, "registry is frozen" if @frozen
|
102
|
-
raise ArgumentError, "Function #{name.inspect} already registered" if @functions.key?(name)
|
103
|
-
|
104
|
-
@functions[name] = Entry.new(
|
105
|
-
fn: fn,
|
106
|
-
arity: arity,
|
107
|
-
param_types: param_types,
|
108
|
-
return_type: return_type,
|
109
|
-
description: description,
|
110
|
-
param_modes: param_modes,
|
111
|
-
reducer: reducer,
|
112
|
-
structure_function: structure_function
|
113
|
-
)
|
114
|
-
end
|
115
|
-
end
|
116
|
-
|
117
|
-
#
|
118
|
-
# Queries
|
119
|
-
#
|
120
|
-
def function?(name)
|
121
|
-
@functions.key?(name)
|
122
|
-
end
|
123
|
-
alias supported? function?
|
124
|
-
|
125
|
-
def operator?(name)
|
126
|
-
name.is_a?(Symbol) && function?(name) && CORE_OPERATORS.include?(name)
|
127
|
-
end
|
128
|
-
|
129
|
-
def entry(name)
|
130
|
-
@functions[name]
|
131
|
-
end
|
132
|
-
|
133
|
-
def fetch(name)
|
134
|
-
ent = entry(name)
|
135
|
-
raise Kumi::Errors::UnknownFunction, "Unknown function: #{name}" unless ent
|
136
|
-
|
137
|
-
ent.fn
|
138
|
-
end
|
139
|
-
|
140
|
-
def signature(name)
|
141
|
-
ent = entry(name) or raise Kumi::Errors::UnknownFunction, "Unknown function: #{name}"
|
142
|
-
{ arity: ent.arity, param_types: ent.param_types, return_type: ent.return_type, description: ent.description }
|
143
|
-
end
|
144
|
-
|
145
|
-
def reducer?(name)
|
146
|
-
ent = entry(name)
|
147
|
-
ent ? !!ent.reducer : false
|
148
|
-
end
|
149
|
-
|
150
|
-
def structure_function?(name)
|
151
|
-
ent = entry(name)
|
152
|
-
ent ? !!ent.structure_function : false
|
153
|
-
end
|
154
|
-
|
155
|
-
def all_functions
|
156
|
-
@functions.keys
|
157
|
-
end
|
158
|
-
alias all all_functions
|
159
|
-
|
160
|
-
def functions
|
161
|
-
@functions.dup
|
162
|
-
end
|
163
|
-
|
164
|
-
# Introspection helpers
|
165
|
-
def comparison_operators = ComparisonFunctions.definitions.keys
|
166
|
-
def math_operations = MathFunctions.definitions.keys
|
167
|
-
def string_operations = StringFunctions.definitions.keys
|
168
|
-
def logical_operations = LogicalFunctions.definitions.keys
|
169
|
-
def collection_operations = CollectionFunctions.definitions.keys
|
170
|
-
def conditional_operations = ConditionalFunctions.definitions.keys
|
171
|
-
def type_operations = TypeFunctions.definitions.keys
|
172
|
-
def stat_operations = StatFunctions.definitions.keys
|
173
|
-
end
|
174
|
-
end
|
175
|
-
end
|
176
|
-
end
|
data/lib/kumi/registry.rb
DELETED
@@ -1,32 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Kumi
|
4
|
-
# Public facade for the function registry.
|
5
|
-
# Delegates to Kumi::Core::FunctionRegistry.
|
6
|
-
module Registry
|
7
|
-
Entry = Core::FunctionRegistry::FunctionBuilder::Entry
|
8
|
-
FrozenError = Core::FunctionRegistry::FrozenError
|
9
|
-
|
10
|
-
class << self
|
11
|
-
def auto_register(*mods)
|
12
|
-
Core::FunctionRegistry.auto_register(*mods)
|
13
|
-
end
|
14
|
-
|
15
|
-
def method_missing(name, ...)
|
16
|
-
if Core::FunctionRegistry.respond_to?(name)
|
17
|
-
Core::FunctionRegistry.public_send(name, ...)
|
18
|
-
else
|
19
|
-
super
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
def respond_to_missing?(name, include_private = false)
|
24
|
-
Core::FunctionRegistry.respond_to?(name, include_private) || super
|
25
|
-
end
|
26
|
-
|
27
|
-
def freeze!
|
28
|
-
Core::FunctionRegistry.freeze!
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
@@ -1,135 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Kumi
|
4
|
-
module Runtime
|
5
|
-
# Executable / Reader: evaluation interface for compiled schemas
|
6
|
-
#
|
7
|
-
# BUILD:
|
8
|
-
# - Executable.from_analysis(state) consumes:
|
9
|
-
# * :ir_module (lowered IR)
|
10
|
-
# * :access_plans (for AccessBuilder)
|
11
|
-
# * function registry
|
12
|
-
# - Builds accessor lambdas once per plan id.
|
13
|
-
#
|
14
|
-
# EVALUATION:
|
15
|
-
# - program.read(inputs, mode: :public|:wrapped, target: nil)
|
16
|
-
# * mode=:public ā returns āuser valuesā (scalars and plain Ruby arrays). Vec results are exposed as their lifted scalar.
|
17
|
-
# * mode=:wrapped ā returns internal VM structures for introspection:
|
18
|
-
# - Scalars as {k: :scalar, v: ...}
|
19
|
-
# - Vec twins available as :name__vec (and :name for lifted scalar)
|
20
|
-
# * target: symbol ā short-circuit after computing the requested declaration and its dependencies.
|
21
|
-
#
|
22
|
-
# NAMING & TWINS (TODO: we are not exposing for now):
|
23
|
-
# - Every vectorized declaration with indices has:
|
24
|
-
# * :name__vec ā internal vec form (rows with idx)
|
25
|
-
# * :name ā lifted scalar form (nested arrays shaped by scope)
|
26
|
-
# - only :name is visible (TODO: For now, we do not expose the twins)
|
27
|
-
#
|
28
|
-
# CACHING / MEMOIZATION:
|
29
|
-
# - Values are computed once per evaluation; dependent requests reuse cached slots.
|
30
|
-
#
|
31
|
-
# ERROR SURFACE:
|
32
|
-
# - VM errors are wrapped as Kumi::Core::Errors::RuntimeError with op context (decl/op index).
|
33
|
-
# - Accessors raise descriptive KeyError for missing fields/arrays (policy-aware).
|
34
|
-
#
|
35
|
-
# DEBUGGING:
|
36
|
-
# - DEBUG_LOWER=1 to print IR at build time
|
37
|
-
# - DEBUG_VM_ARGS=1 to trace VM execution
|
38
|
-
# - Accessors can be debugged independently with DEBUG_ACCESSOR_OPS=1
|
39
|
-
class Executable
|
40
|
-
def self.from_analysis(state, registry: nil, schema_name: nil)
|
41
|
-
ir = state.fetch(:ir_module)
|
42
|
-
access_plans = state.fetch(:access_plans)
|
43
|
-
input_metadata = state[:input_metadata] || {}
|
44
|
-
dependents = state[:dependents] || {}
|
45
|
-
schedules = state[:ir_execution_schedules] || {}
|
46
|
-
|
47
|
-
accessors = Dev::Profiler.phase("compiler.access_builder") do
|
48
|
-
Kumi::Core::Compiler::AccessBuilder.build(access_plans)
|
49
|
-
end
|
50
|
-
|
51
|
-
access_meta = {}
|
52
|
-
|
53
|
-
# access_plans.each_value do |plans|
|
54
|
-
# plans.each do |p|
|
55
|
-
# access_meta[p.accessor_key] = { mode: p.mode, scope: p.scope }
|
56
|
-
|
57
|
-
# # Build precise field -> plan_ids mapping for invalidation
|
58
|
-
# root_field = p.accessor_key.to_s.split(":").first.split(".").first.to_sym
|
59
|
-
# field_to_plan_ids[root_field] << p.accessor_key
|
60
|
-
# end
|
61
|
-
# end
|
62
|
-
|
63
|
-
# Use the internal functions hash that VM expects
|
64
|
-
registry ||= Kumi::Registry.functions
|
65
|
-
new(ir: ir, accessors: accessors, access_meta: access_meta, registry: registry,
|
66
|
-
input_metadata: input_metadata, dependents: dependents,
|
67
|
-
schema_name: schema_name, schedules: schedules)
|
68
|
-
end
|
69
|
-
|
70
|
-
def initialize(ir:, accessors:, access_meta:, registry:, input_metadata:, dependents: {}, schedules: {}, schema_name: nil)
|
71
|
-
@ir = ir.freeze
|
72
|
-
@acc = accessors.freeze
|
73
|
-
@meta = access_meta.freeze
|
74
|
-
@reg = registry
|
75
|
-
@input_metadata = input_metadata.freeze
|
76
|
-
@dependents = dependents.freeze
|
77
|
-
@schema_name = schema_name
|
78
|
-
@schedules = schedules
|
79
|
-
@decl = @ir.decls.map { |d| [d.name, d] }.to_h
|
80
|
-
@accessor_cache = {} # Persistent accessor cache across evaluations
|
81
|
-
end
|
82
|
-
|
83
|
-
def decl?(name) = @decl.key?(name)
|
84
|
-
|
85
|
-
def read(input, mode: :ruby)
|
86
|
-
Run.new(self, input, mode: mode, input_metadata: @input_metadata, dependents: @dependents, declarations: @decl.keys)
|
87
|
-
end
|
88
|
-
|
89
|
-
# API compatibility for backward compatibility
|
90
|
-
def evaluate(ctx, *key_names)
|
91
|
-
target_keys = key_names.empty? ? @decl.keys : validate_keys(key_names)
|
92
|
-
|
93
|
-
# Handle context wrapping for backward compatibility
|
94
|
-
input = ctx.respond_to?(:ctx) ? ctx.ctx : ctx
|
95
|
-
|
96
|
-
target_keys.each_with_object({}) do |key, result|
|
97
|
-
result[key] = eval_decl(key, input, mode: :ruby)
|
98
|
-
end
|
99
|
-
end
|
100
|
-
|
101
|
-
def eval_decl(name, input, mode: :ruby, declaration_cache: {})
|
102
|
-
raise Kumi::Core::Errors::RuntimeError, "unknown decl #{name}" unless decl?(name)
|
103
|
-
|
104
|
-
schedule = @schedules[name]
|
105
|
-
# If the caller asked for a specific binding, schedule deps once
|
106
|
-
|
107
|
-
runtime = {
|
108
|
-
accessor_cache: @accessor_cache,
|
109
|
-
declaration_cache: declaration_cache, # run-local cache
|
110
|
-
schema_name: @schema_name,
|
111
|
-
target: name
|
112
|
-
}
|
113
|
-
|
114
|
-
out = Dev::Profiler.phase("vm.run", target: name) do
|
115
|
-
Kumi::Core::IR::ExecutionEngine.run(schedule, input: input, runtime: runtime, accessors: @acc, registry: @reg).fetch(name)
|
116
|
-
end
|
117
|
-
|
118
|
-
mode == :ruby ? unwrap(@decl[name], out) : out
|
119
|
-
end
|
120
|
-
|
121
|
-
def unwrap(_decl, v)
|
122
|
-
v[:k] == :scalar ? v[:v] : v # no grouping needed
|
123
|
-
end
|
124
|
-
|
125
|
-
private
|
126
|
-
|
127
|
-
def validate_keys(keys)
|
128
|
-
unknown_keys = keys - @decl.keys
|
129
|
-
return keys if unknown_keys.empty?
|
130
|
-
|
131
|
-
raise Kumi::Errors::RuntimeError, "No binding named #{unknown_keys.first}"
|
132
|
-
end
|
133
|
-
end
|
134
|
-
end
|
135
|
-
end
|
data/lib/kumi/runtime/run.rb
DELETED
@@ -1,105 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Kumi
|
4
|
-
module Runtime
|
5
|
-
class Run
|
6
|
-
def initialize(program, input, mode:, input_metadata:, dependents:, declarations:)
|
7
|
-
@program = program
|
8
|
-
@input = input
|
9
|
-
@mode = mode
|
10
|
-
@input_metadata = input_metadata
|
11
|
-
@declarations = declarations
|
12
|
-
@dependents = dependents
|
13
|
-
@cache = {}
|
14
|
-
end
|
15
|
-
|
16
|
-
def key?(name)
|
17
|
-
@declarations.include? name
|
18
|
-
end
|
19
|
-
|
20
|
-
def get(name)
|
21
|
-
unless @cache.key?(name)
|
22
|
-
# Get the result in VM internal format
|
23
|
-
vm_result = @program.eval_decl(name, @input, mode: :wrapped, declaration_cache: @cache)
|
24
|
-
# Store VM format for cross-VM caching
|
25
|
-
@cache[name] = vm_result
|
26
|
-
end
|
27
|
-
|
28
|
-
# Convert to requested format when returning
|
29
|
-
vm_result = @cache[name]
|
30
|
-
@mode == :wrapped ? vm_result : @program.unwrap(nil, vm_result)
|
31
|
-
end
|
32
|
-
|
33
|
-
def to_h
|
34
|
-
slice(*@declarations)
|
35
|
-
end
|
36
|
-
|
37
|
-
def [](name)
|
38
|
-
get(name)
|
39
|
-
end
|
40
|
-
|
41
|
-
def slice(*keys)
|
42
|
-
return {} if keys.empty?
|
43
|
-
|
44
|
-
keys.each_with_object({}) { |key, result| result[key] = get(key) }
|
45
|
-
end
|
46
|
-
|
47
|
-
def compiled_schema
|
48
|
-
@program
|
49
|
-
end
|
50
|
-
|
51
|
-
def method_missing(sym, *args, **kwargs, &)
|
52
|
-
return super unless args.empty? && kwargs.empty? && key?(sym)
|
53
|
-
|
54
|
-
get(sym)
|
55
|
-
end
|
56
|
-
|
57
|
-
def respond_to_missing?(sym, priv = false)
|
58
|
-
key?(sym) || super
|
59
|
-
end
|
60
|
-
|
61
|
-
def update(**changes)
|
62
|
-
affected_declarations = Set.new
|
63
|
-
|
64
|
-
changes.each do |field, value|
|
65
|
-
raise ArgumentError, "unknown input field: #{field}" unless input_field_exists?(field)
|
66
|
-
|
67
|
-
validate_domain_constraint(field, value)
|
68
|
-
|
69
|
-
@input[field] = value
|
70
|
-
if (deps = @dependents[field])
|
71
|
-
deps.each { |d| @cache.delete(d) }
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|
75
|
-
self
|
76
|
-
end
|
77
|
-
|
78
|
-
private
|
79
|
-
|
80
|
-
def input_field_exists?(field)
|
81
|
-
# Check if field is declared in input block
|
82
|
-
@input_metadata.key?(field)
|
83
|
-
end
|
84
|
-
|
85
|
-
def validate_domain_constraint(field, value)
|
86
|
-
field_meta = @input_metadata[field]
|
87
|
-
return unless field_meta&.dig(:domain)
|
88
|
-
|
89
|
-
domain = field_meta[:domain]
|
90
|
-
return unless violates_domain?(value, domain)
|
91
|
-
|
92
|
-
raise ArgumentError, "value #{value} is not in domain #{domain}"
|
93
|
-
end
|
94
|
-
|
95
|
-
def violates_domain?(value, domain)
|
96
|
-
case domain
|
97
|
-
when Range, Array
|
98
|
-
!domain.include?(value)
|
99
|
-
else
|
100
|
-
false
|
101
|
-
end
|
102
|
-
end
|
103
|
-
end
|
104
|
-
end
|
105
|
-
end
|
data/performance_results.txt
DELETED
@@ -1,63 +0,0 @@
|
|
1
|
-
=== MIXED NESTING SCHEMA PERFORMANCE TEST ===
|
2
|
-
Test run: 2025-08-21 01:31:06 -0300
|
3
|
-
Ruby version: 3.3.8
|
4
|
-
|
5
|
-
ā
Schema loaded successfully
|
6
|
-
|
7
|
-
=== COMPILATION PERFORMANCE ===
|
8
|
-
|
9
|
-
Tiny ( 1 items): 2.47ms
|
10
|
-
Small ( 4 items): 3.67ms
|
11
|
-
Medium ( 25 items): 1.86ms
|
12
|
-
Large (100 items): 1.92ms
|
13
|
-
XLarge (200 items): 2.96ms
|
14
|
-
Huge (250 items): 2.0ms
|
15
|
-
|
16
|
-
=== EXECUTION PERFORMANCE ===
|
17
|
-
|
18
|
-
Tiny ( 1 items): avg= 0.54ms, throughput= 1.8 items/ms
|
19
|
-
Small ( 4 items): avg= 0.64ms, throughput= 6.2 items/ms
|
20
|
-
Medium ( 25 items): avg= 1.15ms, throughput= 21.8 items/ms
|
21
|
-
Large (100 items): avg= 3.61ms, throughput= 27.7 items/ms
|
22
|
-
XLarge (200 items): avg= 7.25ms, throughput= 27.6 items/ms
|
23
|
-
Huge (250 items): avg= 11.8ms, throughput= 21.2 items/ms
|
24
|
-
|
25
|
-
=== SCALING ANALYSIS ===
|
26
|
-
|
27
|
-
50 items: 0.87ms (57.2 items/ms)
|
28
|
-
100 items: 1.45ms (68.9 items/ms)
|
29
|
-
200 items: 2.85ms (70.3 items/ms)
|
30
|
-
400 items: 5.75ms (69.6 items/ms)
|
31
|
-
800 items: 15.16ms (52.8 items/ms)
|
32
|
-
|
33
|
-
=== MEMORY ANALYSIS ===
|
34
|
-
|
35
|
-
Iteration 0: RSS=35472KB (Ī256KB)
|
36
|
-
Iteration 3: RSS=35472KB (Ī256KB)
|
37
|
-
Iteration 6: RSS=35472KB (Ī256KB)
|
38
|
-
Iteration 9: RSS=35472KB (Ī256KB)
|
39
|
-
|
40
|
-
=== SAMPLE OUTPUT VALIDATION ===
|
41
|
-
|
42
|
-
org_name: Global Corp
|
43
|
-
region_names: ["Region 1", "Region 2"]
|
44
|
-
total_capacity: [147, 173]
|
45
|
-
org_classification: Enterprise
|
46
|
-
|
47
|
-
=== PERFORMANCE BOTTLENECKS IDENTIFIED ===
|
48
|
-
|
49
|
-
1. Deep nesting (5+ levels) creates complex IR with many lift operations
|
50
|
-
2. Each nested access requires scope transitions
|
51
|
-
3. Compilation cold start: ~80ms first time
|
52
|
-
4. Linear scaling with data size is expected behavior
|
53
|
-
5. Memory usage is stable (no leaks detected)
|
54
|
-
|
55
|
-
=== RECOMMENDATIONS ===
|
56
|
-
|
57
|
-
⢠For production: Cache compiled schemas to avoid cold start
|
58
|
-
⢠For large datasets: Consider schema restructuring to reduce nesting
|
59
|
-
⢠Current performance acceptable for <1000 items
|
60
|
-
⢠Deep nesting workable but monitor performance with >10,000 items
|
61
|
-
|
62
|
-
Test completed at: 2025-08-21 01:31:06 -0300
|
63
|
-
Total runtime: 0.37s
|
@@ -1,68 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# frozen_string_literal: true
|
3
|
-
|
4
|
-
require "json"
|
5
|
-
|
6
|
-
coverage_file = "coverage/.resultset.json"
|
7
|
-
|
8
|
-
unless File.exist?(coverage_file)
|
9
|
-
puts "ā No coverage data found. Run tests first:"
|
10
|
-
puts " COVERAGE=true bundle exec rspec"
|
11
|
-
exit 1
|
12
|
-
end
|
13
|
-
|
14
|
-
data = JSON.parse(File.read(coverage_file))
|
15
|
-
coverage = data.values.first["coverage"]
|
16
|
-
|
17
|
-
broadcast_file = coverage.find { |file, _| file.include?("broadcast_detector.rb") }
|
18
|
-
|
19
|
-
if broadcast_file
|
20
|
-
file_path, line_data = broadcast_file
|
21
|
-
lines = line_data["lines"]
|
22
|
-
|
23
|
-
puts "š BroadcastDetector Coverage Analysis:"
|
24
|
-
puts "File: #{File.basename(file_path)}"
|
25
|
-
|
26
|
-
total_lines = lines.count { |hits| !hits.nil? }
|
27
|
-
covered_lines = lines.count { |hits| hits && hits > 0 }
|
28
|
-
coverage_percent = (covered_lines.to_f / total_lines * 100).round(1)
|
29
|
-
|
30
|
-
puts "Coverage: #{coverage_percent}% (#{covered_lines}/#{total_lines} lines)"
|
31
|
-
|
32
|
-
# Find uncovered method definitions
|
33
|
-
file_content = File.read(file_path)
|
34
|
-
uncovered_methods = []
|
35
|
-
covered_methods = []
|
36
|
-
|
37
|
-
file_content.lines.each_with_index do |line, i|
|
38
|
-
if line.match?(/^\s*def\s+(\w+)/)
|
39
|
-
method_name = line.match(/^\s*def\s+(\w+)/)[1]
|
40
|
-
line_hits = lines[i]
|
41
|
-
|
42
|
-
if line_hits.nil?
|
43
|
-
# Line not tracked
|
44
|
-
elsif line_hits == 0
|
45
|
-
uncovered_methods << "#{method_name} (line #{i+1})"
|
46
|
-
else
|
47
|
-
covered_methods << "#{method_name} (line #{i+1})"
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
puts "\nš Method Coverage Summary:"
|
53
|
-
puts " Total methods: #{covered_methods.length + uncovered_methods.length}"
|
54
|
-
puts " Covered methods: #{covered_methods.length}"
|
55
|
-
puts " Uncovered methods: #{uncovered_methods.length}"
|
56
|
-
|
57
|
-
if uncovered_methods.any?
|
58
|
-
puts "\nšØ Uncovered methods (potential dead code):"
|
59
|
-
uncovered_methods.each { |m| puts " - #{m}" }
|
60
|
-
end
|
61
|
-
|
62
|
-
if covered_methods.any?
|
63
|
-
puts "\nā
Covered methods:"
|
64
|
-
covered_methods.each { |m| puts " - #{m}" }
|
65
|
-
end
|
66
|
-
else
|
67
|
-
puts "ā BroadcastDetector file not found in coverage data"
|
68
|
-
end
|
@@ -1,74 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# frozen_string_literal: true
|
3
|
-
|
4
|
-
require "json"
|
5
|
-
|
6
|
-
coverage_file = "coverage/.resultset.json"
|
7
|
-
target_file = "cascade_executor_builder.rb"
|
8
|
-
|
9
|
-
unless File.exist?(coverage_file)
|
10
|
-
puts "ā No coverage data found. Run tests first"
|
11
|
-
exit 1
|
12
|
-
end
|
13
|
-
|
14
|
-
data = JSON.parse(File.read(coverage_file))
|
15
|
-
coverage = data.values.first["coverage"]
|
16
|
-
|
17
|
-
file_entry = coverage.find { |file, _| file.include?(target_file) }
|
18
|
-
|
19
|
-
if file_entry
|
20
|
-
file_path, line_data = file_entry
|
21
|
-
lines = line_data["lines"]
|
22
|
-
|
23
|
-
puts "š CascadeExecutorBuilder Method Coverage:"
|
24
|
-
puts "=" * 50
|
25
|
-
|
26
|
-
file_content = File.read(file_path)
|
27
|
-
methods = []
|
28
|
-
|
29
|
-
file_content.lines.each_with_index do |line, i|
|
30
|
-
if line.match?(/^\s*def\s+/)
|
31
|
-
method_match = line.match(/^\s*def\s+(self\.)?(\w+)/)
|
32
|
-
if method_match
|
33
|
-
method_name = method_match[2]
|
34
|
-
is_class_method = !method_match[1].nil?
|
35
|
-
line_hits = lines[i]
|
36
|
-
|
37
|
-
status = if line_hits.nil?
|
38
|
-
"āŖ NOT TRACKED"
|
39
|
-
elsif line_hits == 0
|
40
|
-
"šØ UNCOVERED"
|
41
|
-
else
|
42
|
-
"ā
COVERED (#{line_hits} hits)"
|
43
|
-
end
|
44
|
-
|
45
|
-
prefix = is_class_method ? "self." : ""
|
46
|
-
methods << {
|
47
|
-
name: "#{prefix}#{method_name}",
|
48
|
-
line: i + 1,
|
49
|
-
hits: line_hits,
|
50
|
-
status: status
|
51
|
-
}
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
methods.each do |method|
|
57
|
-
printf " %-25s (line %3d) %s\n", method[:name], method[:line], method[:status]
|
58
|
-
end
|
59
|
-
|
60
|
-
uncovered = methods.select { |m| m[:hits] == 0 }
|
61
|
-
covered = methods.select { |m| m[:hits] && m[:hits] > 0 }
|
62
|
-
|
63
|
-
puts "\nš Summary:"
|
64
|
-
puts " Total methods: #{methods.length}"
|
65
|
-
puts " Covered: #{covered.length}"
|
66
|
-
puts " Uncovered: #{uncovered.length}"
|
67
|
-
|
68
|
-
if uncovered.any?
|
69
|
-
puts "\nšØ Uncovered methods (potential dead code):"
|
70
|
-
uncovered.each { |m| puts " #{m[:name]} (line #{m[:line]})" }
|
71
|
-
end
|
72
|
-
else
|
73
|
-
puts "ā #{target_file} not found in coverage data"
|
74
|
-
end
|
@@ -1,51 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# frozen_string_literal: true
|
3
|
-
|
4
|
-
require "json"
|
5
|
-
|
6
|
-
coverage_file = "coverage/.resultset.json"
|
7
|
-
|
8
|
-
unless File.exist?(coverage_file)
|
9
|
-
puts "ā No coverage data found. Run tests first"
|
10
|
-
exit 1
|
11
|
-
end
|
12
|
-
|
13
|
-
data = JSON.parse(File.read(coverage_file))
|
14
|
-
coverage = data.values.first["coverage"]
|
15
|
-
|
16
|
-
broadcasting_files = [
|
17
|
-
"cascade_executor_builder.rb",
|
18
|
-
"vectorized_function_builder.rb",
|
19
|
-
"nested_structure_utils.rb",
|
20
|
-
"broadcast_detector.rb"
|
21
|
-
]
|
22
|
-
|
23
|
-
puts "š Broadcasting Files Coverage:"
|
24
|
-
puts "=" * 60
|
25
|
-
|
26
|
-
broadcasting_files.each do |filename|
|
27
|
-
file_entry = coverage.find { |file, _| file.include?(filename) }
|
28
|
-
|
29
|
-
if file_entry
|
30
|
-
file_path, line_data = file_entry
|
31
|
-
lines = line_data["lines"]
|
32
|
-
|
33
|
-
total_lines = lines.count { |hits| !hits.nil? }
|
34
|
-
covered_lines = lines.count { |hits| hits && hits > 0 }
|
35
|
-
coverage_percent = total_lines > 0 ? (covered_lines.to_f / total_lines * 100).round(1) : 0
|
36
|
-
|
37
|
-
status = if coverage_percent == 0
|
38
|
-
"šØ DEAD"
|
39
|
-
elsif coverage_percent < 20
|
40
|
-
"š“ LOW"
|
41
|
-
elsif coverage_percent < 50
|
42
|
-
"š” MEDIUM"
|
43
|
-
else
|
44
|
-
"ā
GOOD"
|
45
|
-
end
|
46
|
-
|
47
|
-
printf "%-35s %s %6.1f%% (%d/%d lines)\n", filename, status, coverage_percent, covered_lines, total_lines
|
48
|
-
else
|
49
|
-
printf "%-35s ā NOT FOUND\n", filename
|
50
|
-
end
|
51
|
-
end
|