sutra-dev 0.2.0__tar.gz

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.
Files changed (57) hide show
  1. sutra_dev-0.2.0/LICENSE +201 -0
  2. sutra_dev-0.2.0/PKG-INFO +80 -0
  3. sutra_dev-0.2.0/README.md +50 -0
  4. sutra_dev-0.2.0/pyproject.toml +69 -0
  5. sutra_dev-0.2.0/setup.cfg +4 -0
  6. sutra_dev-0.2.0/sutra_compiler/__init__.py +49 -0
  7. sutra_dev-0.2.0/sutra_compiler/__main__.py +514 -0
  8. sutra_dev-0.2.0/sutra_compiler/ast_nodes.py +553 -0
  9. sutra_dev-0.2.0/sutra_compiler/codegen.py +1811 -0
  10. sutra_dev-0.2.0/sutra_compiler/codegen_base.py +2436 -0
  11. sutra_dev-0.2.0/sutra_compiler/codegen_pytorch.py +1472 -0
  12. sutra_dev-0.2.0/sutra_compiler/diagnostics.py +145 -0
  13. sutra_dev-0.2.0/sutra_compiler/inliner.py +581 -0
  14. sutra_dev-0.2.0/sutra_compiler/lexer.py +821 -0
  15. sutra_dev-0.2.0/sutra_compiler/parser.py +2112 -0
  16. sutra_dev-0.2.0/sutra_compiler/review.py +322 -0
  17. sutra_dev-0.2.0/sutra_compiler/simplify.py +1046 -0
  18. sutra_dev-0.2.0/sutra_compiler/simplify_egglog.py +674 -0
  19. sutra_dev-0.2.0/sutra_compiler/stdlib/axons.su +53 -0
  20. sutra_dev-0.2.0/sutra_compiler/stdlib/embed.su +48 -0
  21. sutra_dev-0.2.0/sutra_compiler/stdlib/javascript_object.su +18 -0
  22. sutra_dev-0.2.0/sutra_compiler/stdlib/logic.su +202 -0
  23. sutra_dev-0.2.0/sutra_compiler/stdlib/math.su +12 -0
  24. sutra_dev-0.2.0/sutra_compiler/stdlib/memory.su +82 -0
  25. sutra_dev-0.2.0/sutra_compiler/stdlib/numbers.su +99 -0
  26. sutra_dev-0.2.0/sutra_compiler/stdlib/rotation.su +83 -0
  27. sutra_dev-0.2.0/sutra_compiler/stdlib/similarity.su +97 -0
  28. sutra_dev-0.2.0/sutra_compiler/stdlib/strings.su +56 -0
  29. sutra_dev-0.2.0/sutra_compiler/stdlib/tensor.su +82 -0
  30. sutra_dev-0.2.0/sutra_compiler/stdlib/vectors.su +119 -0
  31. sutra_dev-0.2.0/sutra_compiler/stdlib_loader.py +219 -0
  32. sutra_dev-0.2.0/sutra_compiler/sutradb_embedded.py +273 -0
  33. sutra_dev-0.2.0/sutra_compiler/trace.py +135 -0
  34. sutra_dev-0.2.0/sutra_compiler/validator.py +552 -0
  35. sutra_dev-0.2.0/sutra_compiler/workspace.py +655 -0
  36. sutra_dev-0.2.0/sutra_dev.egg-info/PKG-INFO +80 -0
  37. sutra_dev-0.2.0/sutra_dev.egg-info/SOURCES.txt +55 -0
  38. sutra_dev-0.2.0/sutra_dev.egg-info/dependency_links.txt +1 -0
  39. sutra_dev-0.2.0/sutra_dev.egg-info/entry_points.txt +2 -0
  40. sutra_dev-0.2.0/sutra_dev.egg-info/requires.txt +8 -0
  41. sutra_dev-0.2.0/sutra_dev.egg-info/top_level.txt +1 -0
  42. sutra_dev-0.2.0/tests/test_branchless_loop.py +257 -0
  43. sutra_dev-0.2.0/tests/test_codegen.py +862 -0
  44. sutra_dev-0.2.0/tests/test_codegen_pytorch.py +168 -0
  45. sutra_dev-0.2.0/tests/test_corpus.py +88 -0
  46. sutra_dev-0.2.0/tests/test_inliner.py +494 -0
  47. sutra_dev-0.2.0/tests/test_lexer.py +215 -0
  48. sutra_dev-0.2.0/tests/test_loop_function_decl.py +392 -0
  49. sutra_dev-0.2.0/tests/test_parser.py +395 -0
  50. sutra_dev-0.2.0/tests/test_rotation_prewarm.py +78 -0
  51. sutra_dev-0.2.0/tests/test_simplify.py +450 -0
  52. sutra_dev-0.2.0/tests/test_simplify_egglog.py +408 -0
  53. sutra_dev-0.2.0/tests/test_stdlib_loader.py +176 -0
  54. sutra_dev-0.2.0/tests/test_sutradb_embedded.py +222 -0
  55. sutra_dev-0.2.0/tests/test_torch_compile_wrap.py +88 -0
  56. sutra_dev-0.2.0/tests/test_transcendentals_disabled.py +106 -0
  57. sutra_dev-0.2.0/tests/test_workspace.py +365 -0
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for describing the origin of the Work and
141
+ reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Support. While redistributing the Work or
166
+ Derivative Works thereof, You may choose to offer, and charge a
167
+ fee for, acceptance of support, warranty, indemnity, or other
168
+ liability obligations and/or rights consistent with this License.
169
+ However, in accepting such obligations, You may act only on Your
170
+ own behalf and on Your sole responsibility, not on behalf of any
171
+ other Contributor, and only if You agree to indemnify, defend,
172
+ and hold each Contributor harmless for any liability incurred by,
173
+ or claims asserted against, such Contributor by reason of your
174
+ accepting any such warranty or support.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 Emma Leonhart
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
200
+ implied. See the License for the specific permissions and
201
+ limitations under the License.
@@ -0,0 +1,80 @@
1
+ Metadata-Version: 2.4
2
+ Name: sutra-dev
3
+ Version: 0.2.0
4
+ Summary: Compiler for the Sutra programming language — tensor ops on frozen-LLM embedding vectors.
5
+ Author: Emma Leonhart
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Homepage, https://sutralang.dev
8
+ Project-URL: Repository, https://github.com/EmmaLeonhart/Sutra
9
+ Project-URL: Issues, https://github.com/EmmaLeonhart/Sutra/issues
10
+ Keywords: compiler,embeddings,vector-symbolic,vsa,hyperdimensional,pytorch,rotation-binding,sutra
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Intended Audience :: Science/Research
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Programming Language :: Python :: 3.13
18
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
19
+ Classifier: Topic :: Software Development :: Compilers
20
+ Requires-Python: >=3.11
21
+ Description-Content-Type: text/markdown
22
+ License-File: LICENSE
23
+ Requires-Dist: numpy>=1.26
24
+ Provides-Extra: runtime
25
+ Requires-Dist: torch>=2.1; extra == "runtime"
26
+ Provides-Extra: dev
27
+ Requires-Dist: pytest>=7; extra == "dev"
28
+ Requires-Dist: pytest-cov; extra == "dev"
29
+ Dynamic: license-file
30
+
31
+ # sutra-compiler
32
+
33
+ The compiler for the [Sutra programming language](https://sutralang.dev) — a purely functional language whose primitives are tensor operations on frozen-LLM embedding vectors.
34
+
35
+ ## Install
36
+
37
+ ```bash
38
+ pip install sutra-compiler # validator + codegen only
39
+ pip install sutra-compiler[runtime] # adds torch so --emit / --run can execute the generated module
40
+ ```
41
+
42
+ Requires Python 3.11+.
43
+
44
+ ## Use
45
+
46
+ After install, the `sutrac` command is on your `$PATH`.
47
+
48
+ ```bash
49
+ # Validate a .su source file.
50
+ sutrac path/to/program.su
51
+
52
+ # Validate every .su file under a directory.
53
+ sutrac path/to/directory
54
+
55
+ # Compile to self-contained PyTorch Python and print to stdout.
56
+ sutrac --emit path/to/program.su
57
+
58
+ # Compile and execute in one step (requires the [runtime] extra installed).
59
+ sutrac --run path/to/program.su
60
+
61
+ # Step-by-step compilation review (source → AST → inline → simplify → emit).
62
+ sutrac --review path/to/program.su
63
+
64
+ # Cross-file class-name casing check.
65
+ sutrac --consistency path/to/directory
66
+ ```
67
+
68
+ `sutrac --help` lists every flag.
69
+
70
+ ## What is Sutra
71
+
72
+ A `.su` source file looks like TypeScript — functions, classes, `&&` / `||`, string and numeric literals — but every value is a vector in a frozen LLM embedding space, and every operation is a tensor op on those vectors. The compiler emits self-contained Python that calls a small runtime; chains of `bind` / `unbind` / `bundle` / `similarity` reduce to chains of matrix multiplies that the simplifier folds into cached matrices at compile time.
73
+
74
+ The result is a program where there are no Python branches, no host-side `if` / `while` on data values, and no JIT — just one straight-line tensor expression.
75
+
76
+ For a full introduction, see [sutralang.dev](https://sutralang.dev). For the language specification and design rationale, see the [Sutra repository](https://github.com/EmmaLeonhart/Sutra).
77
+
78
+ ## Status
79
+
80
+ Research-grade. Versions before 1.0 may break source compatibility. The grammar is stable; the codegen and the standard library still move.
@@ -0,0 +1,50 @@
1
+ # sutra-compiler
2
+
3
+ The compiler for the [Sutra programming language](https://sutralang.dev) — a purely functional language whose primitives are tensor operations on frozen-LLM embedding vectors.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ pip install sutra-compiler # validator + codegen only
9
+ pip install sutra-compiler[runtime] # adds torch so --emit / --run can execute the generated module
10
+ ```
11
+
12
+ Requires Python 3.11+.
13
+
14
+ ## Use
15
+
16
+ After install, the `sutrac` command is on your `$PATH`.
17
+
18
+ ```bash
19
+ # Validate a .su source file.
20
+ sutrac path/to/program.su
21
+
22
+ # Validate every .su file under a directory.
23
+ sutrac path/to/directory
24
+
25
+ # Compile to self-contained PyTorch Python and print to stdout.
26
+ sutrac --emit path/to/program.su
27
+
28
+ # Compile and execute in one step (requires the [runtime] extra installed).
29
+ sutrac --run path/to/program.su
30
+
31
+ # Step-by-step compilation review (source → AST → inline → simplify → emit).
32
+ sutrac --review path/to/program.su
33
+
34
+ # Cross-file class-name casing check.
35
+ sutrac --consistency path/to/directory
36
+ ```
37
+
38
+ `sutrac --help` lists every flag.
39
+
40
+ ## What is Sutra
41
+
42
+ A `.su` source file looks like TypeScript — functions, classes, `&&` / `||`, string and numeric literals — but every value is a vector in a frozen LLM embedding space, and every operation is a tensor op on those vectors. The compiler emits self-contained Python that calls a small runtime; chains of `bind` / `unbind` / `bundle` / `similarity` reduce to chains of matrix multiplies that the simplifier folds into cached matrices at compile time.
43
+
44
+ The result is a program where there are no Python branches, no host-side `if` / `while` on data values, and no JIT — just one straight-line tensor expression.
45
+
46
+ For a full introduction, see [sutralang.dev](https://sutralang.dev). For the language specification and design rationale, see the [Sutra repository](https://github.com/EmmaLeonhart/Sutra).
47
+
48
+ ## Status
49
+
50
+ Research-grade. Versions before 1.0 may break source compatibility. The grammar is stable; the codegen and the standard library still move.
@@ -0,0 +1,69 @@
1
+ [build-system]
2
+ requires = ["setuptools>=77", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "sutra-dev"
7
+ version = "0.2.0"
8
+ description = "Compiler for the Sutra programming language — tensor ops on frozen-LLM embedding vectors."
9
+ readme = "README.md"
10
+ requires-python = ">=3.11"
11
+ license = "Apache-2.0"
12
+ license-files = ["LICENSE"]
13
+ authors = [
14
+ { name = "Emma Leonhart" },
15
+ ]
16
+ keywords = [
17
+ "compiler",
18
+ "embeddings",
19
+ "vector-symbolic",
20
+ "vsa",
21
+ "hyperdimensional",
22
+ "pytorch",
23
+ "rotation-binding",
24
+ "sutra",
25
+ ]
26
+ classifiers = [
27
+ "Development Status :: 3 - Alpha",
28
+ "Intended Audience :: Developers",
29
+ "Intended Audience :: Science/Research",
30
+ "Programming Language :: Python :: 3",
31
+ "Programming Language :: Python :: 3.11",
32
+ "Programming Language :: Python :: 3.12",
33
+ "Programming Language :: Python :: 3.13",
34
+ "Topic :: Scientific/Engineering :: Artificial Intelligence",
35
+ "Topic :: Software Development :: Compilers",
36
+ ]
37
+ dependencies = [
38
+ "numpy>=1.26",
39
+ ]
40
+
41
+ [project.optional-dependencies]
42
+ # torch is needed for --emit, --run, and --run-viz (the codegen produces
43
+ # self-contained PyTorch source). Install with: pip install sutra-compiler[runtime]
44
+ runtime = [
45
+ "torch>=2.1",
46
+ ]
47
+ # Dev tools for working on the compiler itself.
48
+ dev = [
49
+ "pytest>=7",
50
+ "pytest-cov",
51
+ ]
52
+
53
+ [project.scripts]
54
+ sutrac = "sutra_compiler.__main__:main"
55
+
56
+ [project.urls]
57
+ Homepage = "https://sutralang.dev"
58
+ Repository = "https://github.com/EmmaLeonhart/Sutra"
59
+ Issues = "https://github.com/EmmaLeonhart/Sutra/issues"
60
+
61
+ [tool.setuptools]
62
+ include-package-data = true
63
+
64
+ [tool.setuptools.packages.find]
65
+ include = ["sutra_compiler*"]
66
+
67
+ [tool.setuptools.package-data]
68
+ # Ship the .su standard-library source so the inliner can find it after install.
69
+ sutra_compiler = ["stdlib/*.su"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,49 @@
1
+ """Sutra language compiler / validator.
2
+
3
+ This package implements the first pass of the Sutra SDK: a lexer,
4
+ parser, and syntactic validator for `.su` source files.
5
+
6
+ Scope (v0.1):
7
+ - Full tokenization of Sutra source (all comment forms, string
8
+ interpolation, numeric literals, identifiers, operators).
9
+ - Recursive-descent parser that recognizes the declaration and
10
+ statement grammar described in planning/sutra-spec/. The
11
+ historical predecessor — sutra-syntax-decisions.md, the
12
+ rolling decisions log that preceded the formal spec — lives
13
+ under planning/sutra-spec-deprecated/ as read-only reference.
14
+ - Structural validation: balanced brackets, semicolons where the
15
+ grammar requires them, well-formed declarations and control flow.
16
+ - A small set of rule checks that the syntax-decisions doc makes
17
+ explicit (e.g. `var TYPE x` is forbidden, `if (...)` requires
18
+ parentheses, a bare identifier cannot be used as a condition).
19
+
20
+ Out of scope for v0.1:
21
+ - Type checking
22
+ - Name resolution across files
23
+ - Code generation / runtime lowering
24
+ - Cross-file workspace analysis
25
+
26
+ The compiler is intentionally liberal where the spec is still open
27
+ (anonymous functions, pipe operator, etc.) - it accepts the documented
28
+ forms and flags the clearly-forbidden ones.
29
+ """
30
+
31
+ __version__ = "0.2.0"
32
+
33
+ from .diagnostics import Diagnostic, DiagnosticLevel, DiagnosticBag
34
+ from .lexer import Lexer, Token, TokenKind
35
+ from .parser import Parser
36
+ from .validator import validate_source, validate_file
37
+
38
+ __all__ = [
39
+ "Diagnostic",
40
+ "DiagnosticLevel",
41
+ "DiagnosticBag",
42
+ "Lexer",
43
+ "Token",
44
+ "TokenKind",
45
+ "Parser",
46
+ "validate_source",
47
+ "validate_file",
48
+ "__version__",
49
+ ]