@elaraai/east 0.0.1-beta.9 → 1.0.0
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.
- package/LICENSE.md +15 -666
- package/README.md +113 -88
- package/dist/src/analyze.d.ts +3 -0
- package/dist/src/analyze.d.ts.map +1 -1
- package/dist/src/analyze.js +223 -111
- package/dist/src/analyze.js.map +1 -1
- package/dist/src/analyze.spec.d.ts +2 -0
- package/dist/src/analyze.spec.d.ts.map +1 -0
- package/dist/src/analyze.spec.js +445 -0
- package/dist/src/analyze.spec.js.map +1 -0
- package/dist/src/ast.d.ts +54 -35
- package/dist/src/ast.d.ts.map +1 -1
- package/dist/src/ast_to_ir.coerce_to.spec.d.ts +15 -0
- package/dist/src/ast_to_ir.coerce_to.spec.d.ts.map +1 -0
- package/dist/src/ast_to_ir.coerce_to.spec.js +420 -0
- package/dist/src/ast_to_ir.coerce_to.spec.js.map +1 -0
- package/dist/src/ast_to_ir.d.ts +18 -4
- package/dist/src/ast_to_ir.d.ts.map +1 -1
- package/dist/src/ast_to_ir.js +233 -178
- package/dist/src/ast_to_ir.js.map +1 -1
- package/dist/src/builtins.d.ts +1 -1
- package/dist/src/builtins.d.ts.map +1 -1
- package/dist/src/builtins.js +194 -2
- package/dist/src/builtins.js.map +1 -1
- package/dist/src/comparison.d.ts +2 -2
- package/dist/src/comparison.d.ts.map +1 -1
- package/dist/src/comparison.js +115 -40
- package/dist/src/comparison.js.map +1 -1
- package/dist/src/comparison.spec.d.ts +2 -0
- package/dist/src/comparison.spec.d.ts.map +1 -0
- package/dist/src/comparison.spec.js +1200 -0
- package/dist/src/comparison.spec.js.map +1 -0
- package/dist/src/compile.d.ts +31 -9
- package/dist/src/compile.d.ts.map +1 -1
- package/dist/src/compile.js +1048 -548
- package/dist/src/compile.js.map +1 -1
- package/dist/src/containers/matrix.d.ts +15 -0
- package/dist/src/containers/matrix.d.ts.map +1 -0
- package/dist/src/containers/matrix.js +15 -0
- package/dist/src/containers/matrix.js.map +1 -0
- package/dist/src/containers/ref.d.ts.map +1 -1
- package/dist/src/containers/ref.js +1 -1
- package/dist/src/containers/ref.js.map +1 -1
- package/dist/src/containers/sortedmap.spec.d.ts +2 -0
- package/dist/src/containers/sortedmap.spec.d.ts.map +1 -0
- package/dist/src/containers/sortedmap.spec.js +180 -0
- package/dist/src/containers/sortedmap.spec.js.map +1 -0
- package/dist/src/containers/sortedset.spec.d.ts +2 -0
- package/dist/src/containers/sortedset.spec.d.ts.map +1 -0
- package/dist/src/containers/sortedset.spec.js +228 -0
- package/dist/src/containers/sortedset.spec.js.map +1 -0
- package/dist/src/containers/variant.d.ts.map +1 -1
- package/dist/src/containers/variant.js +1 -1
- package/dist/src/containers/variant.js.map +1 -1
- package/dist/src/containers/variant.spec.d.ts +2 -0
- package/dist/src/containers/variant.spec.d.ts.map +1 -0
- package/dist/src/containers/variant.spec.js +217 -0
- package/dist/src/containers/variant.spec.js.map +1 -0
- package/dist/src/datetime_format/parse.spec.d.ts +6 -0
- package/dist/src/datetime_format/parse.spec.d.ts.map +1 -0
- package/dist/src/datetime_format/parse.spec.js +379 -0
- package/dist/src/datetime_format/parse.spec.js.map +1 -0
- package/dist/src/datetime_format/print.spec.d.ts +6 -0
- package/dist/src/datetime_format/print.spec.d.ts.map +1 -0
- package/dist/src/datetime_format/print.spec.js +257 -0
- package/dist/src/datetime_format/print.spec.js.map +1 -0
- package/dist/src/datetime_format/tokenize.spec.d.ts +2 -0
- package/dist/src/datetime_format/tokenize.spec.d.ts.map +1 -0
- package/dist/src/datetime_format/tokenize.spec.js +508 -0
- package/dist/src/datetime_format/tokenize.spec.js.map +1 -0
- package/dist/src/datetime_format/types.d.ts +23 -23
- package/dist/src/default.d.ts.map +1 -1
- package/dist/src/default.js +33 -0
- package/dist/src/default.js.map +1 -1
- package/dist/src/default.spec.d.ts +2 -0
- package/dist/src/default.spec.d.ts.map +1 -0
- package/dist/src/default.spec.js +178 -0
- package/dist/src/default.spec.js.map +1 -0
- package/dist/src/eastir.d.ts +7 -0
- package/dist/src/eastir.d.ts.map +1 -1
- package/dist/src/eastir.js +55 -7
- package/dist/src/eastir.js.map +1 -1
- package/dist/src/error.d.ts +14 -4
- package/dist/src/error.d.ts.map +1 -1
- package/dist/src/error.js +28 -3
- package/dist/src/error.js.map +1 -1
- package/dist/src/example.d.ts +87 -0
- package/dist/src/example.d.ts.map +1 -0
- package/dist/src/example.js +18 -0
- package/dist/src/example.js.map +1 -0
- package/dist/src/expr/array.d.ts +43 -1
- package/dist/src/expr/array.d.ts.map +1 -1
- package/dist/src/expr/array.js +103 -53
- package/dist/src/expr/array.js.map +1 -1
- package/dist/src/expr/ast.d.ts +1 -1
- package/dist/src/expr/ast.d.ts.map +1 -1
- package/dist/src/expr/ast.js +112 -54
- package/dist/src/expr/ast.js.map +1 -1
- package/dist/src/expr/asyncfunction.d.ts.map +1 -1
- package/dist/src/expr/asyncfunction.js +6 -4
- package/dist/src/expr/asyncfunction.js.map +1 -1
- package/dist/src/expr/blob.d.ts +48 -0
- package/dist/src/expr/blob.d.ts.map +1 -1
- package/dist/src/expr/blob.js +63 -8
- package/dist/src/expr/blob.js.map +1 -1
- package/dist/src/expr/block.d.ts +213 -12
- package/dist/src/expr/block.d.ts.map +1 -1
- package/dist/src/expr/block.js +796 -293
- package/dist/src/expr/block.js.map +1 -1
- package/dist/src/expr/boolean.d.ts +44 -0
- package/dist/src/expr/boolean.d.ts.map +1 -1
- package/dist/src/expr/boolean.js +58 -6
- package/dist/src/expr/boolean.js.map +1 -1
- package/dist/src/expr/datetime.d.ts +135 -0
- package/dist/src/expr/datetime.d.ts.map +1 -1
- package/dist/src/expr/datetime.js +184 -34
- package/dist/src/expr/datetime.js.map +1 -1
- package/dist/src/expr/dict.d.ts +47 -2
- package/dist/src/expr/dict.d.ts.map +1 -1
- package/dist/src/expr/dict.js +122 -61
- package/dist/src/expr/dict.js.map +1 -1
- package/dist/src/expr/expr.d.ts +3 -1
- package/dist/src/expr/expr.d.ts.map +1 -1
- package/dist/src/expr/expr.js +4 -3
- package/dist/src/expr/expr.js.map +1 -1
- package/dist/src/expr/float.d.ts +153 -0
- package/dist/src/expr/float.d.ts.map +1 -1
- package/dist/src/expr/float.js +191 -17
- package/dist/src/expr/float.js.map +1 -1
- package/dist/src/expr/function.d.ts +7 -2
- package/dist/src/expr/function.d.ts.map +1 -1
- package/dist/src/expr/function.js +6 -4
- package/dist/src/expr/function.js.map +1 -1
- package/dist/src/expr/index.d.ts +186 -2
- package/dist/src/expr/index.d.ts.map +1 -1
- package/dist/src/expr/index.js +183 -2
- package/dist/src/expr/index.js.map +1 -1
- package/dist/src/expr/integer.d.ts +180 -0
- package/dist/src/expr/integer.d.ts.map +1 -1
- package/dist/src/expr/integer.js +189 -18
- package/dist/src/expr/integer.js.map +1 -1
- package/dist/src/expr/libs/array.js +3 -3
- package/dist/src/expr/libs/array.js.map +1 -1
- package/dist/src/expr/libs/blob.js +3 -3
- package/dist/src/expr/libs/blob.js.map +1 -1
- package/dist/src/expr/libs/dict.js +1 -1
- package/dist/src/expr/libs/dict.js.map +1 -1
- package/dist/src/expr/libs/matrix.d.ts +17 -0
- package/dist/src/expr/libs/matrix.d.ts.map +1 -0
- package/dist/src/expr/libs/matrix.js +60 -0
- package/dist/src/expr/libs/matrix.js.map +1 -0
- package/dist/src/expr/libs/set.js +1 -1
- package/dist/src/expr/libs/set.js.map +1 -1
- package/dist/src/expr/libs/string.d.ts.map +1 -1
- package/dist/src/expr/libs/string.js +2 -1
- package/dist/src/expr/libs/string.js.map +1 -1
- package/dist/src/expr/libs/vector.d.ts +16 -0
- package/dist/src/expr/libs/vector.d.ts.map +1 -0
- package/dist/src/expr/libs/vector.js +44 -0
- package/dist/src/expr/libs/vector.js.map +1 -0
- package/dist/src/expr/matrix.d.ts +109 -0
- package/dist/src/expr/matrix.d.ts.map +1 -0
- package/dist/src/expr/matrix.js +224 -0
- package/dist/src/expr/matrix.js.map +1 -0
- package/dist/src/expr/recursive.d.ts +83 -0
- package/dist/src/expr/recursive.d.ts.map +1 -0
- package/dist/src/expr/recursive.js +99 -0
- package/dist/src/expr/recursive.js.map +1 -0
- package/dist/src/expr/ref.js +5 -5
- package/dist/src/expr/ref.js.map +1 -1
- package/dist/src/expr/set.d.ts +44 -2
- package/dist/src/expr/set.d.ts.map +1 -1
- package/dist/src/expr/set.js +102 -52
- package/dist/src/expr/set.js.map +1 -1
- package/dist/src/expr/string.d.ts +134 -0
- package/dist/src/expr/string.d.ts.map +1 -1
- package/dist/src/expr/string.js +173 -23
- package/dist/src/expr/string.js.map +1 -1
- package/dist/src/expr/struct.d.ts +1 -1
- package/dist/src/expr/struct.d.ts.map +1 -1
- package/dist/src/expr/struct.js +2 -2
- package/dist/src/expr/struct.js.map +1 -1
- package/dist/src/expr/types.d.ts +12 -9
- package/dist/src/expr/types.d.ts.map +1 -1
- package/dist/src/expr/variant.d.ts +108 -11
- package/dist/src/expr/variant.d.ts.map +1 -1
- package/dist/src/expr/variant.js +76 -38
- package/dist/src/expr/variant.js.map +1 -1
- package/dist/src/expr/vector.d.ts +102 -0
- package/dist/src/expr/vector.d.ts.map +1 -0
- package/dist/src/expr/vector.js +202 -0
- package/dist/src/expr/vector.js.map +1 -0
- package/dist/src/fuzz.d.ts +36 -2
- package/dist/src/fuzz.d.ts.map +1 -1
- package/dist/src/fuzz.js +409 -77
- package/dist/src/fuzz.js.map +1 -1
- package/dist/src/index.d.ts +4 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +4 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/internal.d.ts +12 -2
- package/dist/src/internal.d.ts.map +1 -1
- package/dist/src/internal.js +13 -2
- package/dist/src/internal.js.map +1 -1
- package/dist/src/ir.d.ts +1754 -1484
- package/dist/src/ir.d.ts.map +1 -1
- package/dist/src/ir.js +51 -34
- package/dist/src/ir.js.map +1 -1
- package/dist/src/ir.spec.d.ts +2 -0
- package/dist/src/ir.spec.d.ts.map +1 -0
- package/dist/src/ir.spec.js +35 -0
- package/dist/src/ir.spec.js.map +1 -0
- package/dist/src/location.d.ts +56 -17
- package/dist/src/location.d.ts.map +1 -1
- package/dist/src/location.js +226 -29
- package/dist/src/location.js.map +1 -1
- package/dist/src/location.spec.d.ts +2 -0
- package/dist/src/location.spec.d.ts.map +1 -0
- package/dist/src/location.spec.js +102 -0
- package/dist/src/location.spec.js.map +1 -0
- package/dist/src/patch/apply.d.ts +15 -0
- package/dist/src/patch/apply.d.ts.map +1 -0
- package/dist/src/patch/apply.js +352 -0
- package/dist/src/patch/apply.js.map +1 -0
- package/dist/src/patch/compose.d.ts +15 -0
- package/dist/src/patch/compose.d.ts.map +1 -0
- package/dist/src/patch/compose.js +448 -0
- package/dist/src/patch/compose.js.map +1 -0
- package/dist/src/patch/diff.d.ts +15 -0
- package/dist/src/patch/diff.d.ts.map +1 -0
- package/dist/src/patch/diff.js +347 -0
- package/dist/src/patch/diff.js.map +1 -0
- package/dist/src/patch/fuzz.d.ts +73 -0
- package/dist/src/patch/fuzz.d.ts.map +1 -0
- package/dist/src/patch/fuzz.js +159 -0
- package/dist/src/patch/fuzz.js.map +1 -0
- package/dist/src/patch/index.d.ts +32 -0
- package/dist/src/patch/index.d.ts.map +1 -0
- package/dist/src/patch/index.js +48 -0
- package/dist/src/patch/index.js.map +1 -0
- package/dist/src/patch/invert.d.ts +15 -0
- package/dist/src/patch/invert.d.ts.map +1 -0
- package/dist/src/patch/invert.js +284 -0
- package/dist/src/patch/invert.js.map +1 -0
- package/dist/src/patch/merge.d.ts +56 -0
- package/dist/src/patch/merge.d.ts.map +1 -0
- package/dist/src/patch/merge.js +586 -0
- package/dist/src/patch/merge.js.map +1 -0
- package/dist/src/patch/merge.spec.d.ts +2 -0
- package/dist/src/patch/merge.spec.d.ts.map +1 -0
- package/dist/src/patch/merge.spec.js +1139 -0
- package/dist/src/patch/merge.spec.js.map +1 -0
- package/dist/src/patch/patch.spec.d.ts +2 -0
- package/dist/src/patch/patch.spec.d.ts.map +1 -0
- package/dist/src/patch/patch.spec.js +452 -0
- package/dist/src/patch/patch.spec.js.map +1 -0
- package/dist/src/patch/path.d.ts +115 -0
- package/dist/src/patch/path.d.ts.map +1 -0
- package/dist/src/patch/path.js +192 -0
- package/dist/src/patch/path.js.map +1 -0
- package/dist/src/patch/path.spec.d.ts +6 -0
- package/dist/src/patch/path.spec.d.ts.map +1 -0
- package/dist/src/patch/path.spec.js +322 -0
- package/dist/src/patch/path.spec.js.map +1 -0
- package/dist/src/patch/prune.d.ts +77 -0
- package/dist/src/patch/prune.d.ts.map +1 -0
- package/dist/src/patch/prune.js +115 -0
- package/dist/src/patch/prune.js.map +1 -0
- package/dist/src/patch/prune.spec.d.ts +6 -0
- package/dist/src/patch/prune.spec.d.ts.map +1 -0
- package/dist/src/patch/prune.spec.js +473 -0
- package/dist/src/patch/prune.spec.js.map +1 -0
- package/dist/src/patch/type_of_patch.d.ts +25 -0
- package/dist/src/patch/type_of_patch.d.ts.map +1 -0
- package/dist/src/patch/type_of_patch.js +144 -0
- package/dist/src/patch/type_of_patch.js.map +1 -0
- package/dist/src/patch/types.d.ts +220 -0
- package/dist/src/patch/types.d.ts.map +1 -0
- package/dist/src/patch/types.js +62 -0
- package/dist/src/patch/types.js.map +1 -0
- package/dist/src/patch/validate.d.ts +44 -0
- package/dist/src/patch/validate.d.ts.map +1 -0
- package/dist/src/patch/validate.js +190 -0
- package/dist/src/patch/validate.js.map +1 -0
- package/dist/src/patch/validate.spec.d.ts +6 -0
- package/dist/src/patch/validate.spec.d.ts.map +1 -0
- package/dist/src/patch/validate.spec.js +225 -0
- package/dist/src/patch/validate.spec.js.map +1 -0
- package/dist/src/patch/walk.d.ts +121 -0
- package/dist/src/patch/walk.d.ts.map +1 -0
- package/dist/src/patch/walk.js +385 -0
- package/dist/src/patch/walk.js.map +1 -0
- package/dist/src/patch/walk.spec.d.ts +6 -0
- package/dist/src/patch/walk.spec.d.ts.map +1 -0
- package/dist/src/patch/walk.spec.js +621 -0
- package/dist/src/patch/walk.spec.js.map +1 -0
- package/dist/src/platform.d.ts +6 -0
- package/dist/src/platform.d.ts.map +1 -1
- package/dist/src/platform.spec.d.ts +2 -0
- package/dist/src/platform.spec.d.ts.map +1 -0
- package/dist/src/platform.spec.js +330 -0
- package/dist/src/platform.spec.js.map +1 -0
- package/dist/src/serialization/beast.d.ts.map +1 -1
- package/dist/src/serialization/beast.js +12 -0
- package/dist/src/serialization/beast.js.map +1 -1
- package/dist/src/serialization/beast.spec.d.ts +6 -0
- package/dist/src/serialization/beast.spec.d.ts.map +1 -0
- package/dist/src/serialization/beast.spec.js +406 -0
- package/dist/src/serialization/beast.spec.js.map +1 -0
- package/dist/src/serialization/beast2/index.d.ts +50 -0
- package/dist/src/serialization/beast2/index.d.ts.map +1 -0
- package/dist/src/serialization/beast2/index.js +756 -0
- package/dist/src/serialization/beast2/index.js.map +1 -0
- package/dist/src/serialization/beast2/index.spec.d.ts +6 -0
- package/dist/src/serialization/beast2/index.spec.d.ts.map +1 -0
- package/dist/src/serialization/beast2/index.spec.js +528 -0
- package/dist/src/serialization/beast2/index.spec.js.map +1 -0
- package/dist/src/serialization/beast2/sourcemap-table.d.ts +29 -0
- package/dist/src/serialization/beast2/sourcemap-table.d.ts.map +1 -0
- package/dist/src/serialization/beast2/sourcemap-table.js +82 -0
- package/dist/src/serialization/beast2/sourcemap-table.js.map +1 -0
- package/dist/src/serialization/beast2/string-table.d.ts +16 -0
- package/dist/src/serialization/beast2/string-table.d.ts.map +1 -0
- package/dist/src/serialization/beast2/string-table.js +38 -0
- package/dist/src/serialization/beast2/string-table.js.map +1 -0
- package/dist/src/serialization/beast2/type-table.d.ts +86 -0
- package/dist/src/serialization/beast2/type-table.d.ts.map +1 -0
- package/dist/src/serialization/beast2/type-table.js +618 -0
- package/dist/src/serialization/beast2/type-table.js.map +1 -0
- package/dist/src/serialization/beast2/value-table.d.ts +40 -0
- package/dist/src/serialization/beast2/value-table.d.ts.map +1 -0
- package/dist/src/serialization/beast2/value-table.js +157 -0
- package/dist/src/serialization/beast2/value-table.js.map +1 -0
- package/dist/src/serialization/binary-utils.d.ts +33 -0
- package/dist/src/serialization/binary-utils.d.ts.map +1 -1
- package/dist/src/serialization/binary-utils.js +157 -0
- package/dist/src/serialization/binary-utils.js.map +1 -1
- package/dist/src/serialization/csv.d.ts +17 -17
- package/dist/src/serialization/csv.d.ts.map +1 -1
- package/dist/src/serialization/csv.js +10 -8
- package/dist/src/serialization/csv.js.map +1 -1
- package/dist/src/serialization/csv.spec.d.ts +2 -0
- package/dist/src/serialization/csv.spec.d.ts.map +1 -0
- package/dist/src/serialization/csv.spec.js +556 -0
- package/dist/src/serialization/csv.spec.js.map +1 -0
- package/dist/src/serialization/east-inferred.spec.d.ts +2 -0
- package/dist/src/serialization/east-inferred.spec.d.ts.map +1 -0
- package/dist/src/serialization/east-inferred.spec.js +322 -0
- package/dist/src/serialization/east-inferred.spec.js.map +1 -0
- package/dist/src/serialization/east.d.ts +1 -1
- package/dist/src/serialization/east.d.ts.map +1 -1
- package/dist/src/serialization/east.js +178 -26
- package/dist/src/serialization/east.js.map +1 -1
- package/dist/src/serialization/east.spec.d.ts +2 -0
- package/dist/src/serialization/east.spec.d.ts.map +1 -0
- package/dist/src/serialization/east.spec.js +1548 -0
- package/dist/src/serialization/east.spec.js.map +1 -0
- package/dist/src/serialization/index.d.ts +1 -2
- package/dist/src/serialization/index.d.ts.map +1 -1
- package/dist/src/serialization/index.js +1 -2
- package/dist/src/serialization/index.js.map +1 -1
- package/dist/src/serialization/json.d.ts +1 -1
- package/dist/src/serialization/json.d.ts.map +1 -1
- package/dist/src/serialization/json.js +123 -24
- package/dist/src/serialization/json.js.map +1 -1
- package/dist/src/serialization/json.spec.d.ts +2 -0
- package/dist/src/serialization/json.spec.d.ts.map +1 -0
- package/dist/src/serialization/json.spec.js +1297 -0
- package/dist/src/serialization/json.spec.js.map +1 -0
- package/dist/src/type_of_type.d.ts +72 -35
- package/dist/src/type_of_type.d.ts.map +1 -1
- package/dist/src/type_of_type.is_data.spec.d.ts +6 -0
- package/dist/src/type_of_type.is_data.spec.d.ts.map +1 -0
- package/dist/src/type_of_type.is_data.spec.js +221 -0
- package/dist/src/type_of_type.is_data.spec.js.map +1 -0
- package/dist/src/type_of_type.js +355 -80
- package/dist/src/type_of_type.js.map +1 -1
- package/dist/src/type_of_type.to_etv.spec.d.ts +6 -0
- package/dist/src/type_of_type.to_etv.spec.d.ts.map +1 -0
- package/dist/src/type_of_type.to_etv.spec.js +263 -0
- package/dist/src/type_of_type.to_etv.spec.js.map +1 -0
- package/dist/src/types.d.ts +82 -12
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/types.error.spec.d.ts +2 -0
- package/dist/src/types.error.spec.d.ts.map +1 -0
- package/dist/src/types.error.spec.js +665 -0
- package/dist/src/types.error.spec.js.map +1 -0
- package/dist/src/types.js +663 -156
- package/dist/src/types.js.map +1 -1
- package/dist/src/types.spec.d.ts +2 -0
- package/dist/src/types.spec.d.ts.map +1 -0
- package/dist/src/types.spec.js +946 -0
- package/dist/src/types.spec.js.map +1 -0
- package/dist/src/walker.d.ts +65 -0
- package/dist/src/walker.d.ts.map +1 -0
- package/dist/src/walker.js +165 -0
- package/dist/src/walker.js.map +1 -0
- package/dist/src/walker.spec.d.ts +6 -0
- package/dist/src/walker.spec.d.ts.map +1 -0
- package/dist/src/walker.spec.js +109 -0
- package/dist/src/walker.spec.js.map +1 -0
- package/package.json +16 -38
- package/dist/src/serialization/beast2-stream.d.ts +0 -38
- package/dist/src/serialization/beast2-stream.d.ts.map +0 -1
- package/dist/src/serialization/beast2-stream.js +0 -670
- package/dist/src/serialization/beast2-stream.js.map +0 -1
- package/dist/src/serialization/beast2.d.ts +0 -41
- package/dist/src/serialization/beast2.d.ts.map +0 -1
- package/dist/src/serialization/beast2.js +0 -495
- package/dist/src/serialization/beast2.js.map +0 -1
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
import { get_location_id } from "../location.js";
|
|
2
|
+
import { IntegerType, VectorType, MatrixType, NullType, FunctionType, ArrayType, isSubtype, printType, isTypeEqual } from "../types.js";
|
|
3
|
+
import { valueOrExprToAst, valueOrExprToAstTyped } from "./ast.js";
|
|
4
|
+
import { AstSymbol, Expr, FactorySymbol, TypeSymbol } from "./expr.js";
|
|
5
|
+
/**
|
|
6
|
+
* Expression representing mutable vector (1D typed array) values and operations.
|
|
7
|
+
*
|
|
8
|
+
* VectorExpr provides methods for vector manipulation including element access,
|
|
9
|
+
* mutation, slicing, concatenation, conversion, and higher-order operations.
|
|
10
|
+
* Vectors are backed by contiguous typed arrays (Float64Array, BigInt64Array,
|
|
11
|
+
* or Uint8Array) for efficient numeric computation and zero-copy interop
|
|
12
|
+
* with ML libraries.
|
|
13
|
+
*/
|
|
14
|
+
export class VectorExpr extends Expr {
|
|
15
|
+
element_type;
|
|
16
|
+
constructor(element_type, ast, createExpr) {
|
|
17
|
+
super(ast.type, ast, createExpr);
|
|
18
|
+
this.element_type = element_type;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Returns the number of elements in the vector.
|
|
22
|
+
*
|
|
23
|
+
* @returns An IntegerExpr representing the length
|
|
24
|
+
*/
|
|
25
|
+
length() {
|
|
26
|
+
return this[FactorySymbol]({
|
|
27
|
+
ast_type: "Builtin",
|
|
28
|
+
type: IntegerType,
|
|
29
|
+
loc_id: get_location_id(),
|
|
30
|
+
builtin: "VectorLength",
|
|
31
|
+
type_parameters: [this.element_type],
|
|
32
|
+
arguments: [this[AstSymbol]],
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Gets the element at the specified index.
|
|
37
|
+
*
|
|
38
|
+
* @param index - The zero-based index to access
|
|
39
|
+
* @returns An expression of the element type
|
|
40
|
+
*
|
|
41
|
+
* @throws East runtime error if the index is out of bounds
|
|
42
|
+
*/
|
|
43
|
+
get(index) {
|
|
44
|
+
const idx = valueOrExprToAstTyped(index, IntegerType);
|
|
45
|
+
return this[FactorySymbol]({
|
|
46
|
+
ast_type: "Builtin",
|
|
47
|
+
type: this.element_type,
|
|
48
|
+
loc_id: get_location_id(),
|
|
49
|
+
builtin: "VectorGet",
|
|
50
|
+
type_parameters: [this.element_type],
|
|
51
|
+
arguments: [this[AstSymbol], idx],
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Sets the element at the specified index (mutates the vector).
|
|
56
|
+
*
|
|
57
|
+
* @param index - The zero-based index to set
|
|
58
|
+
* @param value - The new value to store at that index
|
|
59
|
+
* @returns NullExpr (operation performed for side effect)
|
|
60
|
+
*
|
|
61
|
+
* @throws East runtime error if the index is out of bounds
|
|
62
|
+
*/
|
|
63
|
+
set(index, value) {
|
|
64
|
+
const idx = valueOrExprToAstTyped(index, IntegerType);
|
|
65
|
+
const val = valueOrExprToAstTyped(value, this.element_type);
|
|
66
|
+
return this[FactorySymbol]({
|
|
67
|
+
ast_type: "Builtin",
|
|
68
|
+
type: NullType,
|
|
69
|
+
loc_id: get_location_id(),
|
|
70
|
+
builtin: "VectorSet",
|
|
71
|
+
type_parameters: [this.element_type],
|
|
72
|
+
arguments: [this[AstSymbol], idx, val],
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Returns a new vector containing elements from start (inclusive) to end (exclusive).
|
|
77
|
+
*
|
|
78
|
+
* @param start - The start index (inclusive)
|
|
79
|
+
* @param end - The end index (exclusive)
|
|
80
|
+
* @returns A new VectorExpr containing the sliced elements
|
|
81
|
+
*
|
|
82
|
+
* @throws East runtime error if indices are out of bounds
|
|
83
|
+
*/
|
|
84
|
+
slice(start, end) {
|
|
85
|
+
const s = valueOrExprToAstTyped(start, IntegerType);
|
|
86
|
+
const e = valueOrExprToAstTyped(end, IntegerType);
|
|
87
|
+
return this[FactorySymbol]({
|
|
88
|
+
ast_type: "Builtin",
|
|
89
|
+
type: VectorType(this.element_type),
|
|
90
|
+
loc_id: get_location_id(),
|
|
91
|
+
builtin: "VectorSlice",
|
|
92
|
+
type_parameters: [this.element_type],
|
|
93
|
+
arguments: [this[AstSymbol], s, e],
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Concatenates this vector with another vector of the same element type.
|
|
98
|
+
*
|
|
99
|
+
* @param other - The other vector to concatenate
|
|
100
|
+
* @returns A new VectorExpr containing elements from both vectors
|
|
101
|
+
*/
|
|
102
|
+
concat(other) {
|
|
103
|
+
return this[FactorySymbol]({
|
|
104
|
+
ast_type: "Builtin",
|
|
105
|
+
type: VectorType(this.element_type),
|
|
106
|
+
loc_id: get_location_id(),
|
|
107
|
+
builtin: "VectorConcat",
|
|
108
|
+
type_parameters: [this.element_type],
|
|
109
|
+
arguments: [this[AstSymbol], Expr.ast(other)],
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Converts this vector to an Array.
|
|
114
|
+
*
|
|
115
|
+
* @returns An ArrayExpr containing the same elements
|
|
116
|
+
*/
|
|
117
|
+
toArray() {
|
|
118
|
+
return this[FactorySymbol]({
|
|
119
|
+
ast_type: "Builtin",
|
|
120
|
+
type: ArrayType(this.element_type),
|
|
121
|
+
loc_id: get_location_id(),
|
|
122
|
+
builtin: "VectorToArray",
|
|
123
|
+
type_parameters: [this.element_type],
|
|
124
|
+
arguments: [this[AstSymbol]],
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Reshapes this vector into a matrix with the specified dimensions.
|
|
129
|
+
* Requires rows * cols == length of the vector.
|
|
130
|
+
*
|
|
131
|
+
* @param rows - The number of rows in the resulting matrix
|
|
132
|
+
* @param cols - The number of columns in the resulting matrix
|
|
133
|
+
* @returns A MatrixExpr with the specified shape
|
|
134
|
+
*
|
|
135
|
+
* @throws East runtime error if rows * cols does not equal the vector length
|
|
136
|
+
*/
|
|
137
|
+
toMatrix(rows, cols) {
|
|
138
|
+
const r = valueOrExprToAstTyped(rows, IntegerType);
|
|
139
|
+
const c = valueOrExprToAstTyped(cols, IntegerType);
|
|
140
|
+
return this[FactorySymbol]({
|
|
141
|
+
ast_type: "Builtin",
|
|
142
|
+
type: MatrixType(this.element_type),
|
|
143
|
+
loc_id: get_location_id(),
|
|
144
|
+
builtin: "VectorToMatrix",
|
|
145
|
+
type_parameters: [this.element_type],
|
|
146
|
+
arguments: [this[AstSymbol], r, c],
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
map(fn) {
|
|
150
|
+
if (fn instanceof Expr) {
|
|
151
|
+
if (!(fn[TypeSymbol] && fn[TypeSymbol].type === "Function")) {
|
|
152
|
+
throw new Error("Expected a Function expression");
|
|
153
|
+
}
|
|
154
|
+
const output_type = fn[TypeSymbol].output;
|
|
155
|
+
const n_inputs = fn[TypeSymbol].inputs.length;
|
|
156
|
+
if (n_inputs === 2) {
|
|
157
|
+
if (!isSubtype(this.element_type, fn[TypeSymbol].inputs[0])) {
|
|
158
|
+
throw new Error(`Expected Function input to be ${printType(this.element_type)}, got ${printType(fn[TypeSymbol].inputs[0])}`);
|
|
159
|
+
}
|
|
160
|
+
if (!isTypeEqual(IntegerType, fn[TypeSymbol].inputs[1])) {
|
|
161
|
+
throw new Error(`Expected Function second input to be ${printType(IntegerType)}, got ${printType(fn[TypeSymbol].inputs[1])}`);
|
|
162
|
+
}
|
|
163
|
+
return this[FactorySymbol]({
|
|
164
|
+
ast_type: "Builtin",
|
|
165
|
+
type: VectorType(output_type),
|
|
166
|
+
loc_id: get_location_id(),
|
|
167
|
+
builtin: "VectorMap",
|
|
168
|
+
type_parameters: [this.element_type, output_type],
|
|
169
|
+
arguments: [this[AstSymbol], fn[AstSymbol]],
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
else {
|
|
173
|
+
throw new Error(`Expected Function to have 2 inputs, got ${n_inputs} inputs`);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
else {
|
|
177
|
+
const functionExpr = Expr.function([this.element_type, IntegerType], undefined, fn);
|
|
178
|
+
return this.map(functionExpr);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Reduces the vector to a single value using an accumulator function and initial value.
|
|
183
|
+
*
|
|
184
|
+
* @param combineFn - Function taking (accumulator, element, index) and returning the new accumulator value
|
|
185
|
+
* @param init - Initial value for the reduction (determines output type)
|
|
186
|
+
* @returns The final accumulated value
|
|
187
|
+
*/
|
|
188
|
+
reduce(combineFn, init) {
|
|
189
|
+
const initAst = valueOrExprToAst(init);
|
|
190
|
+
const returnType = initAst.type;
|
|
191
|
+
const combineAst = valueOrExprToAstTyped(combineFn, FunctionType([returnType, this.element_type, IntegerType], returnType));
|
|
192
|
+
return this[FactorySymbol]({
|
|
193
|
+
ast_type: "Builtin",
|
|
194
|
+
type: returnType,
|
|
195
|
+
loc_id: get_location_id(),
|
|
196
|
+
builtin: "VectorFold",
|
|
197
|
+
type_parameters: [this.element_type, returnType],
|
|
198
|
+
arguments: [this[AstSymbol], initAst, combineAst],
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
//# sourceMappingURL=vector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vector.js","sourceRoot":"","sources":["../../../src/expr/vector.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,UAAU,EAAE,QAAQ,EAAE,YAAY,EAAE,SAAS,EAAiC,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AACvK,OAAO,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAGnE,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,aAAa,EAAE,UAAU,EAAe,MAAM,WAAW,CAAC;AAMpF;;;;;;;;GAQG;AACH,MAAM,OAAO,UAA0B,SAAQ,IAAmB;IAC5C;IAApB,YAAoB,YAAe,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CAAK,SAA6H,EAAE,IAAQ;QAChJ,MAAM,OAAO,GAAG,gBAAgB,CAAC,IAAI,CAAC,CAAC;QACvC,MAAM,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;QAEhC,MAAM,UAAU,GAAG,qBAAqB,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC,UAAU,EAAE,IAAI,CAAC,YAAY,EAAE,WAAW,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC;QAE5H,OAAO,IAAI,CAAC,aAAa,CAAC,CAAC;YACzB,QAAQ,EAAE,SAAS;YACnB,IAAI,EAAE,UAAsB;YAC5B,MAAM,EAAE,eAAe,EAAE;YACzB,OAAO,EAAE,YAAY;YACrB,eAAe,EAAE,CAAC,IAAI,CAAC,YAAwB,EAAE,UAAsB,CAAC;YACxE,SAAS,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,UAAU,CAAC;SAClD,CAAyB,CAAC;IAC7B,CAAC;CACF"}
|
package/dist/src/fuzz.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ import { type EastTypeValue } from "./type_of_type.js";
|
|
|
10
10
|
* Generates a random East type for fuzz testing.
|
|
11
11
|
*
|
|
12
12
|
* @param depth - Current nesting depth (used internally to limit recursion)
|
|
13
|
+
* @param options - Configuration options
|
|
13
14
|
* @returns A randomly generated {@link EastType}
|
|
14
15
|
*
|
|
15
16
|
* @remarks
|
|
@@ -19,8 +20,37 @@ import { type EastTypeValue } from "./type_of_type.js";
|
|
|
19
20
|
* - Sets and Dicts use {@link StringType} keys (immutability constraint)
|
|
20
21
|
* - Structs have 0-4 random fields
|
|
21
22
|
* - Variants have 1-3 random cases, with 30% chance of {@link OptionType}
|
|
23
|
+
* - Recursive types include linked lists, trees, and option-wrapped patterns
|
|
24
|
+
* - Function types have 0-3 arguments with random input/output types
|
|
22
25
|
*/
|
|
23
|
-
export declare function randomType(depth?: number
|
|
26
|
+
export declare function randomType(depth?: number, options?: {
|
|
27
|
+
includeRecursive?: boolean;
|
|
28
|
+
includeFunctions?: boolean;
|
|
29
|
+
}): EastType;
|
|
30
|
+
/**
|
|
31
|
+
* Generates a random recursive type pattern.
|
|
32
|
+
*
|
|
33
|
+
* @returns A randomly generated {@link RecursiveType}
|
|
34
|
+
*
|
|
35
|
+
* @remarks
|
|
36
|
+
* Generates common recursive patterns:
|
|
37
|
+
* - Linked list: `rec t. <nil: Null, cons: (head: T, tail: t)>`
|
|
38
|
+
* - Tree: `rec t. (value: T, children: Array<t>)`
|
|
39
|
+
* - Option chain: `rec t. (value: T, next: Option<t>)`
|
|
40
|
+
* - Binary tree: `rec t. <leaf: T, node: (left: t, right: t)>`
|
|
41
|
+
* - Nested variant: `rec t. <a: T, b: (inner: t)>`
|
|
42
|
+
*/
|
|
43
|
+
export declare function randomRecursiveType(): EastType;
|
|
44
|
+
/**
|
|
45
|
+
* Generates a random function type.
|
|
46
|
+
*
|
|
47
|
+
* @returns A randomly generated {@link FunctionType}
|
|
48
|
+
*
|
|
49
|
+
* @remarks
|
|
50
|
+
* Functions have 0-3 arguments with random primitive or simple types.
|
|
51
|
+
* Output types are also kept simple to avoid excessive nesting.
|
|
52
|
+
*/
|
|
53
|
+
export declare function randomFunctionType(): EastType;
|
|
24
54
|
/**
|
|
25
55
|
* Creates a function that generates random values of a given type.
|
|
26
56
|
*
|
|
@@ -37,6 +67,7 @@ export declare function randomType(depth?: number): EastType;
|
|
|
37
67
|
* - DateTimes are within one year of 2025-01-01
|
|
38
68
|
* - Collections have 0-4 elements (kept small for performance)
|
|
39
69
|
* - Variants randomly select one of their cases
|
|
70
|
+
* - Recursive types generate finite values with depth limiting
|
|
40
71
|
*/
|
|
41
72
|
export declare function randomValueFor(type: EastTypeValue): () => any;
|
|
42
73
|
export declare function randomValueFor<T extends EastType>(type: T): () => ValueTypeOf<T>;
|
|
@@ -76,5 +107,8 @@ export declare function randomValueFor<T extends EastType>(type: T): () => Value
|
|
|
76
107
|
* );
|
|
77
108
|
* ```
|
|
78
109
|
*/
|
|
79
|
-
export declare function fuzzerTest(fn: (type: EastType) => (value: any) => Promise<void>, n_types?: number, n_samples?: number
|
|
110
|
+
export declare function fuzzerTest(fn: (type: EastType) => (value: any) => Promise<void>, n_types?: number, n_samples?: number, options?: {
|
|
111
|
+
includeRecursive?: boolean;
|
|
112
|
+
includeFunctions?: boolean;
|
|
113
|
+
}): Promise<boolean>;
|
|
80
114
|
//# sourceMappingURL=fuzz.d.ts.map
|
package/dist/src/fuzz.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fuzz.d.ts","sourceRoot":"","sources":["../../src/fuzz.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,KAAK,QAAQ,EACb,KAAK,WAAW,
|
|
1
|
+
{"version":3,"file":"fuzz.d.ts","sourceRoot":"","sources":["../../src/fuzz.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,KAAK,QAAQ,EACb,KAAK,WAAW,EAmBjB,MAAM,YAAY,CAAC;AAKpB,OAAO,EAAmB,KAAK,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAiBxE;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,UAAU,CACxB,KAAK,GAAE,MAAU,EACjB,OAAO,GAAE;IAAE,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAAC,gBAAgB,CAAC,EAAE,OAAO,CAAA;CAAO,GACvE,QAAQ,CAkEV;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,mBAAmB,IAAI,QAAQ,CAmD9C;AAED;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,IAAI,QAAQ,CAqB7C;AAyTD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,aAAa,GAAG,MAAM,GAAG,CAAC;AAC/D,wBAAgB,cAAc,CAAC,CAAC,SAAS,QAAQ,EAAE,IAAI,EAAE,CAAC,GAAG,MAAM,WAAW,CAAC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