kumi 0.0.17 → 0.0.19
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 +28 -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 +47 -5
- 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,415 +0,0 @@
|
|
1
|
-
# Hierarchical Broadcasting
|
2
|
-
|
3
|
-
Automatic vectorization of operations over hierarchical data structures with two complementary access modes for different use cases.
|
4
|
-
|
5
|
-
## Overview
|
6
|
-
|
7
|
-
The hierarchical broadcasting system enables natural field access syntax that automatically applies operations element-wise across complex nested data structures, with intelligent detection of map vs reduce operations and support for both structured objects and raw multi-dimensional arrays.
|
8
|
-
|
9
|
-
## Core Mechanism
|
10
|
-
|
11
|
-
The system uses a three-stage pipeline:
|
12
|
-
|
13
|
-
1. **Parser** - Creates InputElementReference AST nodes for nested field access
|
14
|
-
2. **BroadcastDetector** - Identifies which operations should be vectorized vs scalar
|
15
|
-
3. **Compiler** - Generates appropriate map/reduce functions based on usage context
|
16
|
-
|
17
|
-
## Access Modes
|
18
|
-
|
19
|
-
The system supports two complementary access modes that can be mixed within the same schema:
|
20
|
-
|
21
|
-
### Object Access Mode (Default)
|
22
|
-
For structured business data with named fields:
|
23
|
-
|
24
|
-
```ruby
|
25
|
-
input do
|
26
|
-
array :users do
|
27
|
-
string :name
|
28
|
-
integer :age
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
value :user_names, input.users.name # Broadcasts over structured objects
|
33
|
-
trait :adults, input.users.age >= 18 # Boolean array from age comparison
|
34
|
-
```
|
35
|
-
|
36
|
-
### Element Access Mode
|
37
|
-
For multi-dimensional raw arrays using `element` syntax with **progressive path traversal**:
|
38
|
-
|
39
|
-
```ruby
|
40
|
-
input do
|
41
|
-
array :cube do
|
42
|
-
element :array, :layer do
|
43
|
-
element :array, :row do
|
44
|
-
element :integer, :cell
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
# Progressive path traversal - each level goes deeper
|
51
|
-
value :dimensions, [
|
52
|
-
fn(:size, input.cube), # Number of layers
|
53
|
-
fn(:size, input.cube.layer), # Total matrices across all layers
|
54
|
-
fn(:size, input.cube.layer.row), # Total rows across all matrices
|
55
|
-
fn(:size, input.cube.layer.row.cell) # Total cells (leaf elements)
|
56
|
-
]
|
57
|
-
|
58
|
-
# Operations at different dimensional levels
|
59
|
-
value :layer_data, input.cube.layer # 3D matrices
|
60
|
-
value :row_data, input.cube.layer.row # 2D rows
|
61
|
-
value :cell_data, input.cube.layer.row.cell # 1D values
|
62
|
-
```
|
63
|
-
|
64
|
-
**Key Benefits of Progressive Path Traversal:**
|
65
|
-
- **Intuitive syntax**: `input.cube.layer.row` naturally represents "rows within layers within cube"
|
66
|
-
- **Direct dimensional access**: No need for complex flattening operations for basic dimensional analysis
|
67
|
-
- **Ranked polymorphism**: Same operations work across different dimensional arrays
|
68
|
-
- **Clean code**: `fn(:size, input.cube.layer.row)` instead of `fn(:size, fn(:flatten_one, input.cube.layer))`
|
69
|
-
|
70
|
-
### Dynamic Hash Elements with `element :any`
|
71
|
-
|
72
|
-
For arrays containing hash data with flexible or unknown structure, use `element :any` to access dynamic hash content:
|
73
|
-
|
74
|
-
```ruby
|
75
|
-
input do
|
76
|
-
array :api_responses do
|
77
|
-
element :any, :response_data # Flexible hash structure
|
78
|
-
end
|
79
|
-
|
80
|
-
array :user_events do
|
81
|
-
element :any, :event_data # Dynamic event properties (includes event_type)
|
82
|
-
end
|
83
|
-
end
|
84
|
-
|
85
|
-
# Access hash fields using fn(:fetch)
|
86
|
-
value :response_codes, fn(:fetch, input.api_responses.response_data, "status")
|
87
|
-
value :error_messages, fn(:fetch, input.api_responses.response_data, "error")
|
88
|
-
value :event_types, fn(:fetch, input.user_events.event_data, "event_type")
|
89
|
-
value :user_ids, fn(:fetch, input.user_events.event_data, "user_id")
|
90
|
-
value :timestamps, fn(:fetch, input.user_events.event_data, "timestamp")
|
91
|
-
|
92
|
-
# Mathematical operations on extracted values
|
93
|
-
value :avg_response_time, fn(:mean, fn(:fetch, input.api_responses.response_data, "response_time"))
|
94
|
-
value :total_events, fn(:size, input.user_events.event_data)
|
95
|
-
|
96
|
-
# Traits and cascades with dynamic data
|
97
|
-
trait :has_errors, fn(:any?, fn(:fetch, input.api_responses.response_data, "status") >= 400)
|
98
|
-
trait :recent_events, fn(:any?, fn(:fetch, input.user_events.event_data, "timestamp") > 1640995200)
|
99
|
-
|
100
|
-
value :system_status do
|
101
|
-
on has_errors, "Error State"
|
102
|
-
on recent_events, "Active"
|
103
|
-
base "Idle"
|
104
|
-
end
|
105
|
-
```
|
106
|
-
|
107
|
-
**When to use `element :any`:**
|
108
|
-
- API responses with varying JSON schemas
|
109
|
-
- Configuration files with flexible key-value structures
|
110
|
-
- Event data where properties vary by event type
|
111
|
-
- Legacy systems where data structure may change
|
112
|
-
- Prototyping when exact hash structure is unknown
|
113
|
-
|
114
|
-
**Comparison with Hash Objects:**
|
115
|
-
|
116
|
-
| Approach | Use Case | Flexibility | Type Safety |
|
117
|
-
|----------|----------|-------------|-------------|
|
118
|
-
| `hash :field do ... end` | Known structure, strong typing | Limited | High |
|
119
|
-
| `element :any, :field` | Unknown/flexible structure | High | Low |
|
120
|
-
|
121
|
-
```ruby
|
122
|
-
# Known structure - use hash objects
|
123
|
-
array :orders do
|
124
|
-
hash :customer do
|
125
|
-
string :name
|
126
|
-
string :email
|
127
|
-
end
|
128
|
-
end
|
129
|
-
|
130
|
-
# Unknown/flexible structure - use element :any
|
131
|
-
array :api_calls do
|
132
|
-
element :any, :response # Could be any JSON structure
|
133
|
-
end
|
134
|
-
```
|
135
|
-
|
136
|
-
## Business Use Cases
|
137
|
-
|
138
|
-
Element access mode is essential for common business scenarios involving simple nested arrays:
|
139
|
-
|
140
|
-
```ruby
|
141
|
-
# E-commerce: Product availability analysis
|
142
|
-
input do
|
143
|
-
array :products do
|
144
|
-
string :name
|
145
|
-
array :daily_sales do # Simple array: [12, 8, 15, 3]
|
146
|
-
element :integer, :units
|
147
|
-
end
|
148
|
-
end
|
149
|
-
end
|
150
|
-
|
151
|
-
# Create flags for business rules
|
152
|
-
trait :had_slow_days, fn(:any?, input.products.daily_sales.units < 5)
|
153
|
-
trait :consistently_strong, fn(:all?, input.products.daily_sales.units >= 10)
|
154
|
-
|
155
|
-
# Progressive analysis
|
156
|
-
value :sales_summary, [
|
157
|
-
fn(:size, input.products), # Number of products
|
158
|
-
fn(:size, input.products.daily_sales.units), # Total sales data points
|
159
|
-
fn(:sum, fn(:flatten, input.products.daily_sales.units)) # Total units sold
|
160
|
-
]
|
161
|
-
```
|
162
|
-
|
163
|
-
### Mixed Access Modes
|
164
|
-
Both modes work together seamlessly:
|
165
|
-
|
166
|
-
```ruby
|
167
|
-
input do
|
168
|
-
array :users do # Object access
|
169
|
-
string :name
|
170
|
-
integer :age
|
171
|
-
end
|
172
|
-
array :activity_logs do # Element access
|
173
|
-
element :integer, :day
|
174
|
-
end
|
175
|
-
end
|
176
|
-
|
177
|
-
value :user_count, fn(:size, input.users)
|
178
|
-
value :total_activity_days, fn(:size, fn(:flatten, input.activity_logs.day))
|
179
|
-
```
|
180
|
-
|
181
|
-
## Basic Broadcasting (Object Access)
|
182
|
-
|
183
|
-
```ruby
|
184
|
-
schema do
|
185
|
-
input do
|
186
|
-
array :line_items do
|
187
|
-
float :price
|
188
|
-
integer :quantity
|
189
|
-
string :category
|
190
|
-
end
|
191
|
-
float :tax_rate, type: :float
|
192
|
-
end
|
193
|
-
|
194
|
-
# Element-wise computation - broadcasts over each item
|
195
|
-
value :subtotals, input.line_items.price * input.line_items.quantity
|
196
|
-
|
197
|
-
# Element-wise traits - applied to each item
|
198
|
-
trait :is_taxable, (input.line_items.category != "digital")
|
199
|
-
|
200
|
-
# Conditional logic - element-wise evaluation
|
201
|
-
value :taxes, fn(:if, is_taxable, subtotals * input.tax_rate, 0.0)
|
202
|
-
end
|
203
|
-
```
|
204
|
-
|
205
|
-
## Aggregation Operations
|
206
|
-
|
207
|
-
Operations that consume arrays to produce scalars are automatically detected:
|
208
|
-
|
209
|
-
```ruby
|
210
|
-
schema do
|
211
|
-
# These aggregate the vectorized results
|
212
|
-
value :total_subtotal, fn(:sum, subtotals)
|
213
|
-
value :total_tax, fn(:sum, taxes)
|
214
|
-
value :grand_total, total_subtotal + total_tax
|
215
|
-
|
216
|
-
# Statistics over arrays
|
217
|
-
value :avg_price, fn(:avg, input.line_items.price)
|
218
|
-
value :max_quantity, fn(:max, input.line_items.quantity)
|
219
|
-
end
|
220
|
-
```
|
221
|
-
|
222
|
-
## Field Access Nesting
|
223
|
-
|
224
|
-
Supports arbitrary depth field access with path building:
|
225
|
-
|
226
|
-
```ruby
|
227
|
-
schema do
|
228
|
-
input do
|
229
|
-
array :orders do
|
230
|
-
array :items do
|
231
|
-
hash :product do
|
232
|
-
string :name
|
233
|
-
float :base_price
|
234
|
-
end
|
235
|
-
integer :quantity
|
236
|
-
end
|
237
|
-
end
|
238
|
-
end
|
239
|
-
|
240
|
-
# Deep field access - automatically broadcasts over nested arrays
|
241
|
-
value :all_product_names, input.orders.items.product.name
|
242
|
-
value :total_values, input.orders.items.product.base_price * input.orders.items.quantity
|
243
|
-
end
|
244
|
-
```
|
245
|
-
|
246
|
-
## Type Inference
|
247
|
-
|
248
|
-
The type system automatically infers appropriate types for broadcasted operations:
|
249
|
-
|
250
|
-
- `input.items.price` (float array) → inferred as `:float` per element
|
251
|
-
- `input.items.price * input.items.quantity` → element-wise `:float` result
|
252
|
-
- `fn(:sum, input.items.price)` → scalar `:float` result
|
253
|
-
|
254
|
-
## Implementation Details
|
255
|
-
|
256
|
-
### Parser Layer
|
257
|
-
- **InputFieldProxy** - Handles `input.field.subfield...` with path building
|
258
|
-
- **InputElementReference** - AST node representing array field access paths
|
259
|
-
|
260
|
-
### Analysis Layer
|
261
|
-
- **BroadcastDetector** - Identifies vectorized vs scalar operations
|
262
|
-
- **TypeInferencerPass** - Infers types for array element access patterns
|
263
|
-
|
264
|
-
### Compilation Layer
|
265
|
-
- **Automatic Dispatch** - Maps element-wise operations to array map functions
|
266
|
-
- **Reduction Detection** - Converts aggregation functions to array reduce operations
|
267
|
-
|
268
|
-
## Usage Patterns
|
269
|
-
|
270
|
-
### Element-wise Operations
|
271
|
-
```ruby
|
272
|
-
# All of these broadcast element-wise
|
273
|
-
value :discounted_prices, input.items.price * 0.9
|
274
|
-
trait :expensive, (input.items.price > 100.0)
|
275
|
-
value :categories, input.items.category
|
276
|
-
```
|
277
|
-
|
278
|
-
### Aggregation Operations
|
279
|
-
```ruby
|
280
|
-
# These consume arrays to produce scalars
|
281
|
-
value :item_count, fn(:size, input.items)
|
282
|
-
value :total_price, fn(:sum, input.items.price)
|
283
|
-
value :has_expensive, fn(:any?, expensive)
|
284
|
-
```
|
285
|
-
|
286
|
-
### Mixed Operations
|
287
|
-
```ruby
|
288
|
-
# Element-wise computation followed by aggregation
|
289
|
-
value :line_totals, input.items.price * input.items.quantity
|
290
|
-
value :order_total, fn(:sum, line_totals)
|
291
|
-
value :avg_line_total, fn(:avg, line_totals)
|
292
|
-
```
|
293
|
-
|
294
|
-
### Conditional Aggregation Functions
|
295
|
-
|
296
|
-
Kumi provides powerful conditional aggregation functions that make working with vectorized traits clean and intuitive:
|
297
|
-
|
298
|
-
```ruby
|
299
|
-
# Step 1: Create vectorized values and traits
|
300
|
-
value :revenues, input.sales.price * input.sales.quantity # → [3000.0, 2000.0, 1250.0]
|
301
|
-
trait :expensive, input.sales.price > 100 # → [true, true, false]
|
302
|
-
trait :bulk_order, input.sales.quantity >= 15 # → [false, false, true]
|
303
|
-
|
304
|
-
# Step 2: Use conditional aggregation functions (NEW - clean and readable)
|
305
|
-
value :expensive_count, fn(:count_if, expensive) # → 2
|
306
|
-
value :expensive_total, fn(:sum_if, revenues, expensive) # → 5000.0
|
307
|
-
value :expensive_average, fn(:avg_if, revenues, expensive) # → 2500.0
|
308
|
-
|
309
|
-
# Step 3: Combine conditions for complex filtering
|
310
|
-
trait :expensive_bulk, expensive & bulk_order # → [false, false, false]
|
311
|
-
value :expensive_bulk_total, fn(:sum_if, revenues, expensive_bulk) # → 0.0
|
312
|
-
```
|
313
|
-
|
314
|
-
**Old cascade pattern** (verbose, harder to read):
|
315
|
-
```ruby
|
316
|
-
# OLD WAY - required verbose cascade patterns
|
317
|
-
value :expensive_amounts do
|
318
|
-
on expensive, revenues
|
319
|
-
base 0.0
|
320
|
-
end
|
321
|
-
value :expensive_total, fn(:sum, expensive_amounts)
|
322
|
-
|
323
|
-
value :expensive_count_markers do
|
324
|
-
on expensive, 1.0
|
325
|
-
base 0.0
|
326
|
-
end
|
327
|
-
value :expensive_count, fn(:sum, expensive_count_markers)
|
328
|
-
```
|
329
|
-
|
330
|
-
**New conditional functions** (clean, direct):
|
331
|
-
```ruby
|
332
|
-
# NEW WAY - direct and readable
|
333
|
-
value :expensive_total, fn(:sum_if, revenues, expensive)
|
334
|
-
value :expensive_count, fn(:count_if, expensive)
|
335
|
-
value :expensive_average, fn(:avg_if, revenues, expensive)
|
336
|
-
```
|
337
|
-
|
338
|
-
The conditional aggregation functions are now the idiomatic way to work with boolean arrays in Kumi.
|
339
|
-
|
340
|
-
## Common Patterns and Gotchas
|
341
|
-
|
342
|
-
### Operator Precedence with Mixed Arithmetic
|
343
|
-
|
344
|
-
**Problem**: Complex arithmetic expressions with arrays can fail due to precedence parsing:
|
345
|
-
|
346
|
-
```ruby
|
347
|
-
# This fails with confusing error message
|
348
|
-
value :ones, input.items.price * 0 + 1
|
349
|
-
# Error: "no implicit conversion of Integer into Array"
|
350
|
-
|
351
|
-
# The expression is parsed as: (input.items.price * 0) + 1
|
352
|
-
# Which becomes: [0.0, 0.0, 0.0] + 1 (array + scalar in wrong context)
|
353
|
-
```
|
354
|
-
|
355
|
-
**Solutions**:
|
356
|
-
|
357
|
-
```ruby
|
358
|
-
# Use explicit function calls
|
359
|
-
value :ones, fn(:add, input.items.price * 0, 1)
|
360
|
-
|
361
|
-
# Use cascade pattern (most idiomatic)
|
362
|
-
trait :always_true, input.items.price >= 0
|
363
|
-
value :ones do
|
364
|
-
on always_true, 1.0
|
365
|
-
base 0.0
|
366
|
-
end
|
367
|
-
|
368
|
-
# Use separate steps
|
369
|
-
value :zeros, input.items.price * 0
|
370
|
-
value :ones, zeros + 1
|
371
|
-
```
|
372
|
-
|
373
|
-
The cascade pattern is preferred as it's more explicit about intent and leverages Kumi's automatic scalar broadcasting.
|
374
|
-
|
375
|
-
## Error Handling
|
376
|
-
|
377
|
-
### Dimension Mismatch Detection
|
378
|
-
|
379
|
-
Array broadcasting operations are only valid within the same array source. Attempting to broadcast across different arrays generates detailed error messages:
|
380
|
-
|
381
|
-
```ruby
|
382
|
-
schema do
|
383
|
-
input do
|
384
|
-
array :items do
|
385
|
-
string :name
|
386
|
-
end
|
387
|
-
array :logs do
|
388
|
-
string :user_name
|
389
|
-
end
|
390
|
-
end
|
391
|
-
|
392
|
-
# This will generate a dimension mismatch error
|
393
|
-
trait :same_name, input.items.name == input.logs.user_name
|
394
|
-
end
|
395
|
-
|
396
|
-
# Error:
|
397
|
-
# Cannot broadcast operation across arrays from different sources: items, logs.
|
398
|
-
# Problem: Multiple operands are arrays from different sources:
|
399
|
-
# - Operand 1 resolves to array(string) from array 'items'
|
400
|
-
# - Operand 2 resolves to array(string) from array 'logs'
|
401
|
-
# Direct operations on arrays from different sources is ambiguous and not supported.
|
402
|
-
# Vectorized operations can only work on fields from the same array input.
|
403
|
-
```
|
404
|
-
|
405
|
-
The error messages provide:
|
406
|
-
- **Quick Summary**: Identifies the conflicting array sources
|
407
|
-
- **Type Information**: Shows the resolved types of each operand
|
408
|
-
- **Clear Explanation**: Why the operation is ambiguous and not supported
|
409
|
-
|
410
|
-
## Performance Characteristics
|
411
|
-
|
412
|
-
- **Single Pass** - Each array is traversed once per computation chain
|
413
|
-
- **Lazy Evaluation** - Operations are composed into pipelines
|
414
|
-
- **Memory Efficient** - No intermediate array allocations for simple operations
|
415
|
-
- **Type Safe** - Full compile-time type checking for array element operations
|
@@ -1,58 +0,0 @@
|
|
1
|
-
# Input Declarations
|
2
|
-
|
3
|
-
Declares expected inputs with types and domain constraints, separating input metadata from business logic.
|
4
|
-
|
5
|
-
## Declaration Syntax
|
6
|
-
|
7
|
-
```ruby
|
8
|
-
schema do
|
9
|
-
input do
|
10
|
-
string :customer_name
|
11
|
-
integer :age, domain: 18..120
|
12
|
-
float :balance, domain: 0.0..Float::INFINITY
|
13
|
-
boolean :verified
|
14
|
-
array :tags, elem: { type: :string }
|
15
|
-
hash :metadata, key: { type: :string }, val: { type: :any }
|
16
|
-
any :flexible
|
17
|
-
|
18
|
-
# Structured arrays with defined fields
|
19
|
-
array :orders do
|
20
|
-
hash :customer do
|
21
|
-
string :name
|
22
|
-
string :email
|
23
|
-
end
|
24
|
-
float :total
|
25
|
-
end
|
26
|
-
|
27
|
-
# Dynamic arrays with flexible elements
|
28
|
-
array :api_responses do
|
29
|
-
element :any, :response_data # For unknown/flexible hash structures
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
trait :adult, (input.age >= 18)
|
34
|
-
value :status, input.verified ? "verified" : "pending"
|
35
|
-
value :customer_emails, input.orders.customer.email # Structured access
|
36
|
-
value :response_codes, fn(:fetch, input.api_responses.response_data, "status") # Dynamic access
|
37
|
-
end
|
38
|
-
```
|
39
|
-
|
40
|
-
## Domain Constraints
|
41
|
-
|
42
|
-
**Validation occurs at runtime:**
|
43
|
-
```ruby
|
44
|
-
schema.from(credit_score: 900) # Domain: 300..850
|
45
|
-
# => InputValidationError: Field :credit_score value 900 is outside domain 300..850
|
46
|
-
```
|
47
|
-
|
48
|
-
**Constraint types:**
|
49
|
-
- Range domains: `domain: 18..120`
|
50
|
-
- Array domains: `domain: %w[active inactive]`
|
51
|
-
- Regex domains: `domain: /^[a-zA-Z]+$/`
|
52
|
-
|
53
|
-
## Validation Process
|
54
|
-
|
55
|
-
- Input data validated against declared field metadata
|
56
|
-
- Type validation checks value matches declared type
|
57
|
-
- Domain validation checks value satisfies constraints
|
58
|
-
- Detailed error messages for violations
|
@@ -1,14 +0,0 @@
|
|
1
|
-
# Performance
|
2
|
-
|
3
|
-
Analysis, compilation, and execution performance for large schemas.
|
4
|
-
|
5
|
-
## Execution Model
|
6
|
-
|
7
|
-
**Compilation:**
|
8
|
-
- Each expression compiled to executable lambda
|
9
|
-
- Direct function calls for operations
|
10
|
-
|
11
|
-
**Runtime:**
|
12
|
-
- Result caching to avoid recomputation
|
13
|
-
- Selective evaluation: only requested keys computed
|
14
|
-
- Direct lambda invocation
|
@@ -1,77 +0,0 @@
|
|
1
|
-
# S-Expression Printer
|
2
|
-
|
3
|
-
Debug and inspect Kumi AST structures with readable S-expression notation output.
|
4
|
-
|
5
|
-
## Overview
|
6
|
-
|
7
|
-
The S-Expression Printer provides a clean, structured way to visualize Kumi's Abstract Syntax Tree (AST) nodes in traditional Lisp-style S-expression format. This is particularly useful for debugging schema parsing, understanding AST structure, and analyzing complex expressions.
|
8
|
-
|
9
|
-
## Usage
|
10
|
-
|
11
|
-
```ruby
|
12
|
-
require 'kumi/support/s_expression_printer'
|
13
|
-
|
14
|
-
# Print any AST node
|
15
|
-
Kumi::Support::SExpressionPrinter.print(node)
|
16
|
-
|
17
|
-
# Print a complete schema AST
|
18
|
-
module MySchema
|
19
|
-
extend Kumi::Schema
|
20
|
-
|
21
|
-
schema do
|
22
|
-
input do
|
23
|
-
integer :age
|
24
|
-
string :name
|
25
|
-
end
|
26
|
-
|
27
|
-
trait :adult, (input.age >= 18)
|
28
|
-
value :greeting, fn(:concat, "Hello ", input.name)
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
puts Kumi::Support::SExpressionPrinter.print(MySchema.__syntax_tree__)
|
33
|
-
```
|
34
|
-
|
35
|
-
## Output Format
|
36
|
-
|
37
|
-
The printer produces indented S-expressions that clearly show the hierarchical structure:
|
38
|
-
|
39
|
-
```lisp
|
40
|
-
(Root
|
41
|
-
inputs: [
|
42
|
-
(InputDeclaration :age :integer)
|
43
|
-
(InputDeclaration :name :string)
|
44
|
-
]
|
45
|
-
values: [
|
46
|
-
(ValueDeclaration :greeting
|
47
|
-
(CallExpression :concat
|
48
|
-
(Literal "Hello ")
|
49
|
-
(InputReference :name)
|
50
|
-
)
|
51
|
-
)
|
52
|
-
]
|
53
|
-
traits: [
|
54
|
-
(TraitDeclaration :adult
|
55
|
-
(CallExpression :>=
|
56
|
-
(InputReference :age)
|
57
|
-
(Literal 18)
|
58
|
-
)
|
59
|
-
)
|
60
|
-
]
|
61
|
-
)
|
62
|
-
```
|
63
|
-
|
64
|
-
## Supported Node Types
|
65
|
-
|
66
|
-
The printer handles all Kumi AST node types:
|
67
|
-
|
68
|
-
- **Root** - Schema container with inputs, values, and traits
|
69
|
-
- **Declarations** - InputDeclaration, ValueDeclaration, TraitDeclaration
|
70
|
-
- **Expressions** - CallExpression, ArrayExpression, CascadeExpression, CaseExpression
|
71
|
-
- **References** - InputReference, InputElementReference, DeclarationReference
|
72
|
-
- **Literals** - Literal values (strings, numbers, booleans)
|
73
|
-
- **Collections** - Arrays and HashExpression nodes
|
74
|
-
|
75
|
-
## Implementation
|
76
|
-
|
77
|
-
Built as a visitor pattern class that traverses AST nodes recursively, with each node type having its own specialized formatting method. The printer preserves proper indentation and handles nested structures gracefully.
|
@@ -1,53 +0,0 @@
|
|
1
|
-
# Broadcasts Metadata
|
2
|
-
|
3
|
-
Array broadcasting operation analysis for vectorized computations.
|
4
|
-
|
5
|
-
## Structure
|
6
|
-
|
7
|
-
```ruby
|
8
|
-
state[:broadcasts] = {
|
9
|
-
array_fields: Hash,
|
10
|
-
vectorized_operations: Hash,
|
11
|
-
reduction_operations: Hash
|
12
|
-
}
|
13
|
-
```
|
14
|
-
|
15
|
-
## Array Fields
|
16
|
-
|
17
|
-
```ruby
|
18
|
-
array_fields: {
|
19
|
-
:line_items => {
|
20
|
-
element_fields: [:price, :quantity, :name],
|
21
|
-
element_types: { price: :float, quantity: :integer, name: :string }
|
22
|
-
}
|
23
|
-
}
|
24
|
-
```
|
25
|
-
|
26
|
-
## Vectorized Operations
|
27
|
-
|
28
|
-
```ruby
|
29
|
-
vectorized_operations: {
|
30
|
-
:item_totals => {
|
31
|
-
operation: :multiply,
|
32
|
-
vectorized_args: { 0 => true, 1 => true }
|
33
|
-
}
|
34
|
-
}
|
35
|
-
```
|
36
|
-
|
37
|
-
## Reduction Operations
|
38
|
-
|
39
|
-
```ruby
|
40
|
-
reduction_operations: {
|
41
|
-
:total_amount => {
|
42
|
-
function: :sum,
|
43
|
-
source: :array_field
|
44
|
-
}
|
45
|
-
}
|
46
|
-
```
|
47
|
-
|
48
|
-
## Usage
|
49
|
-
|
50
|
-
- Compiler optimizations
|
51
|
-
- Parallel execution
|
52
|
-
- Type inference
|
53
|
-
- Performance analysis
|
@@ -1,45 +0,0 @@
|
|
1
|
-
# Cascades Metadata
|
2
|
-
|
3
|
-
Cascade mutual exclusion analysis for safe conditional cycles.
|
4
|
-
|
5
|
-
## Structure
|
6
|
-
|
7
|
-
```ruby
|
8
|
-
state[:cascades] = {
|
9
|
-
cascade_name => {
|
10
|
-
condition_traits: Array,
|
11
|
-
condition_count: Integer,
|
12
|
-
all_mutually_exclusive: Boolean,
|
13
|
-
exclusive_pairs: Integer,
|
14
|
-
total_pairs: Integer
|
15
|
-
}
|
16
|
-
}
|
17
|
-
```
|
18
|
-
|
19
|
-
## Example
|
20
|
-
|
21
|
-
```ruby
|
22
|
-
{
|
23
|
-
:tax_rate => {
|
24
|
-
condition_traits: [:single, :married],
|
25
|
-
condition_count: 2,
|
26
|
-
all_mutually_exclusive: true,
|
27
|
-
exclusive_pairs: 1,
|
28
|
-
total_pairs: 1
|
29
|
-
}
|
30
|
-
}
|
31
|
-
```
|
32
|
-
|
33
|
-
## Fields
|
34
|
-
|
35
|
-
- `condition_traits`: Trait names used in cascade conditions
|
36
|
-
- `all_mutually_exclusive`: Whether all condition pairs are exclusive
|
37
|
-
- `exclusive_pairs`: Count of mutually exclusive pairs
|
38
|
-
- `total_pairs`: Total possible pairs
|
39
|
-
|
40
|
-
## Usage
|
41
|
-
|
42
|
-
- Cycle safety analysis
|
43
|
-
- Topological sorting
|
44
|
-
- Optimization detection
|
45
|
-
- Dependency validation
|