ragul-lang 0.1.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 (45) hide show
  1. ragul_lang-0.1.0/LICENSE +182 -0
  2. ragul_lang-0.1.0/PKG-INFO +288 -0
  3. ragul_lang-0.1.0/README.md +254 -0
  4. ragul_lang-0.1.0/pyproject.toml +55 -0
  5. ragul_lang-0.1.0/ragul/__init__.py +0 -0
  6. ragul_lang-0.1.0/ragul/agents/__init__.py +14 -0
  7. ragul_lang-0.1.0/ragul/agents/base.py +22 -0
  8. ragul_lang-0.1.0/ragul/agents/docs_agent.py +110 -0
  9. ragul_lang-0.1.0/ragul/agents/interpreter_agent.py +29 -0
  10. ragul_lang-0.1.0/ragul/agents/lexer_agent.py +29 -0
  11. ragul_lang-0.1.0/ragul/agents/lsp_agent.py +22 -0
  12. ragul_lang-0.1.0/ragul/agents/orchestrator.py +237 -0
  13. ragul_lang-0.1.0/ragul/agents/parser_agent.py +29 -0
  14. ragul_lang-0.1.0/ragul/agents/repl_agent.py +19 -0
  15. ragul_lang-0.1.0/ragul/agents/task.py +60 -0
  16. ragul_lang-0.1.0/ragul/agents/typecheck_agent.py +31 -0
  17. ragul_lang-0.1.0/ragul/config.py +101 -0
  18. ragul_lang-0.1.0/ragul/errors.py +264 -0
  19. ragul_lang-0.1.0/ragul/interpreter.py +730 -0
  20. ragul_lang-0.1.0/ragul/lexer.py +262 -0
  21. ragul_lang-0.1.0/ragul/lsp/__init__.py +0 -0
  22. ragul_lang-0.1.0/ragul/lsp/completion.py +149 -0
  23. ragul_lang-0.1.0/ragul/lsp/diagnostics.py +86 -0
  24. ragul_lang-0.1.0/ragul/lsp/hover.py +108 -0
  25. ragul_lang-0.1.0/ragul/lsp/server.py +200 -0
  26. ragul_lang-0.1.0/ragul/main.py +152 -0
  27. ragul_lang-0.1.0/ragul/model.py +392 -0
  28. ragul_lang-0.1.0/ragul/parser.py +494 -0
  29. ragul_lang-0.1.0/ragul/repl/__init__.py +0 -0
  30. ragul_lang-0.1.0/ragul/repl/repl.py +146 -0
  31. ragul_lang-0.1.0/ragul/stdlib/__init__.py +0 -0
  32. ragul_lang-0.1.0/ragul/stdlib/core.py +75 -0
  33. ragul_lang-0.1.0/ragul/stdlib/modules.py +173 -0
  34. ragul_lang-0.1.0/ragul/tests/__init__.py +0 -0
  35. ragul_lang-0.1.0/ragul/tests/test_agents.py +240 -0
  36. ragul_lang-0.1.0/ragul/tests/test_lsp.py +115 -0
  37. ragul_lang-0.1.0/ragul/tests/test_ragul.py +443 -0
  38. ragul_lang-0.1.0/ragul/typechecker.py +433 -0
  39. ragul_lang-0.1.0/ragul_lang.egg-info/PKG-INFO +288 -0
  40. ragul_lang-0.1.0/ragul_lang.egg-info/SOURCES.txt +43 -0
  41. ragul_lang-0.1.0/ragul_lang.egg-info/dependency_links.txt +1 -0
  42. ragul_lang-0.1.0/ragul_lang.egg-info/entry_points.txt +2 -0
  43. ragul_lang-0.1.0/ragul_lang.egg-info/requires.txt +9 -0
  44. ragul_lang-0.1.0/ragul_lang.egg-info/top_level.txt +1 -0
  45. ragul_lang-0.1.0/setup.cfg +4 -0
@@ -0,0 +1,182 @@
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 made available under
36
+ the License, as indicated by a copyright notice that is included in
37
+ or attached to the work (an example is provided in the Appendix below).
38
+
39
+ "Derivative Works" shall mean any work, whether in Source or Object
40
+ form, that is based on (or derived from) the Work and for which the
41
+ editorial revisions, annotations, elaborations, or other modifications
42
+ represent, as a whole, an original work of authorship. For the purposes
43
+ of this License, Derivative Works shall not include works that remain
44
+ separable from, or merely link (or bind by name) to the interfaces of,
45
+ the Work and Derivative Works thereof.
46
+
47
+ "Contribution" shall mean, as submitted to the Licensor for inclusion
48
+ in the Work by the copyright owner or by an individual or Legal Entity
49
+ authorized to submit on behalf of the copyright owner. For the purposes
50
+ of this definition, "submitted" means any form of electronic, verbal,
51
+ or written communication sent to the Licensor or its representatives,
52
+ including but not limited to communication on electronic mailing lists,
53
+ source code control systems, and issue tracking systems that are managed
54
+ by, or on behalf of, the Licensor for the purpose of discussing and
55
+ improving the Work, but excluding communication that is conspicuously
56
+ marked or designated in writing by the copyright owner as "Not a
57
+ Contribution."
58
+
59
+ "Contributor" shall mean Licensor and any Legal Entity on behalf of
60
+ whom a Contribution has been received by the Licensor and included
61
+ within the Work.
62
+
63
+ 2. Grant of Copyright License. Subject to the terms and conditions of
64
+ this License, each Contributor hereby grants to You a perpetual,
65
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
66
+ copyright license to reproduce, prepare Derivative Works of,
67
+ publicly display, publicly perform, sublicense, and distribute the
68
+ Work and such Derivative Works in Source or Object form.
69
+
70
+ 3. Grant of Patent License. Subject to the terms and conditions of
71
+ this License, each Contributor hereby grants to You a perpetual,
72
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
73
+ (except as stated in this section) patent license to make, have made,
74
+ use, offer to sell, sell, import, and otherwise transfer the Work,
75
+ where such license applies only to those patent claims licensable
76
+ by such Contributor that are necessarily infringed by their
77
+ Contribution(s) alone or by the combination of their Contribution(s)
78
+ with the Work to which such Contribution(s) was submitted. If You
79
+ institute patent litigation against any entity (including a cross-claim
80
+ or counterclaim in a lawsuit) alleging that the Work or any Contribution
81
+ embodied within the Work constitutes direct or contributory patent
82
+ infringement, then any patent licenses granted to You under this License
83
+ for that Work shall terminate as of the date such litigation is filed.
84
+
85
+ 4. Redistribution. You may reproduce and distribute copies of the
86
+ Work or Derivative Works thereof in any medium, with or without
87
+ modifications, and in Source or Object form, provided that You
88
+ meet the following conditions:
89
+
90
+ (a) You must give any other recipients of the Work or Derivative Works
91
+ a copy of this License; and
92
+
93
+ (b) You must cause any modified files to carry prominent notices
94
+ stating that You changed the files; and
95
+
96
+ (c) You must retain, in the Source form of any Derivative Works
97
+ that You distribute, all copyright, patent, trademark, and
98
+ attribution notices from the Source form of the Work,
99
+ excluding those notices that do not pertain to any part of
100
+ the Derivative Works; and
101
+
102
+ (d) If the Work includes a "NOTICE" text file as part of its
103
+ distribution, You must include a readable copy of the
104
+ attribution notices contained within such NOTICE file, in
105
+ at least one of the following places: within a NOTICE text
106
+ file distributed as part of the Derivative Works; within
107
+ the Source form or documentation, if provided along with the
108
+ Derivative Works; or, within a display generated by the
109
+ Derivative Works, if and wherever such third-party notices
110
+ normally appear. The contents of the NOTICE file are for
111
+ informational purposes only and do not modify the License.
112
+ You may add Your own attribution notices within Derivative Works
113
+ that You distribute, alongside or in addition to the NOTICE text
114
+ from the Work, provided that such additional attribution notices
115
+ cannot be construed as modifying the License.
116
+
117
+ You may add Your own license statement for Your modifications and
118
+ may provide additional grant of rights to use, copy, modify, merge,
119
+ publish, distribute, sublicense, and/or sell copies of the
120
+ Contribution, either on an original or modified basis.
121
+
122
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
123
+ any Contribution intentionally submitted for inclusion in the Work
124
+ by You to the Licensor shall be under the terms and conditions of
125
+ this License, without any additional terms or conditions.
126
+ Notwithstanding the above, nothing herein shall supersede or modify
127
+ the terms of any separate license agreement you may have executed
128
+ with Licensor regarding such Contributions.
129
+
130
+ 6. Trademarks. This License does not grant permission to use the trade
131
+ names, trademarks, service marks, or product names of the Licensor,
132
+ except as required for reasonable and customary use in describing the
133
+ origin of the Work and reproducing the content of the NOTICE file.
134
+
135
+ 7. Disclaimer of Warranty. Unless required by applicable law or
136
+ agreed to in writing, Licensor provides the Work (and each
137
+ Contributor provides its Contributions) on an "AS IS" BASIS,
138
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
139
+ implied, including, without limitation, any warranties or conditions
140
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
141
+ PARTICULAR PURPOSE. You are solely responsible for determining the
142
+ appropriateness of using or reproducing the Work and assume any
143
+ risks associated with Your exercise of permissions under this License.
144
+
145
+ 8. Limitation of Liability. In no event and under no legal theory,
146
+ whether in tort (including negligence), contract, or otherwise,
147
+ unless required by applicable law (such as deliberate and grossly
148
+ negligent acts) or agreed to in writing, shall any Contributor be
149
+ liable to You for damages, including any direct, indirect, special,
150
+ incidental, or exemplary damages of any character arising as a
151
+ result of this License or out of the use or inability to use the
152
+ Work (including but not limited to damages for loss of goodwill,
153
+ work stoppage, computer failure or malfunction, or all other
154
+ commercial damages or losses), even if such Contributor has been
155
+ advised of the possibility of such damages.
156
+
157
+ 9. Accepting Warranty or Liability. While redistributing the Work or
158
+ Derivative Works thereof, You may choose to offer, and charge a fee
159
+ for, acceptance of support, warranty, indemnity, or other liability
160
+ obligations and/or rights consistent to this License. However, in
161
+ accepting such obligations, You may offer such obligations only on
162
+ Your own behalf and on Your sole responsibility, not on behalf of
163
+ any other Contributor, and only if You agree to indemnify, defend,
164
+ and hold each Contributor harmless for any liability incurred by,
165
+ or claims asserted against, such Contributor by reason of your
166
+ accepting any such warranty or additional liability.
167
+
168
+ END OF TERMS AND CONDITIONS
169
+
170
+ Copyright 2026 Kory
171
+
172
+ Licensed under the Apache License, Version 2.0 (the "License");
173
+ you may not use this file except in compliance with the License.
174
+ You may obtain a copy of the License at
175
+
176
+ http://www.apache.org/licenses/LICENSE-2.0
177
+
178
+ Unless required by applicable law or agreed to in writing, software
179
+ distributed under the License is distributed on an "AS IS" BASIS,
180
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
181
+ implied. See the License for the specific language governing
182
+ permissions and limitations under the License.
@@ -0,0 +1,288 @@
1
+ Metadata-Version: 2.4
2
+ Name: ragul-lang
3
+ Version: 0.1.0
4
+ Summary: Ragul — an agglutinative programming language
5
+ License: Apache-2.0
6
+ Project-URL: Homepage, https://github.com/kory75/ragul
7
+ Project-URL: Documentation, https://kory75.github.io/ragul
8
+ Project-URL: Repository, https://github.com/kory75/ragul
9
+ Project-URL: Bug Tracker, https://github.com/kory75/ragul/issues
10
+ Keywords: programming-language,interpreter,hungarian,agglutinative
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Intended Audience :: Education
14
+ Classifier: Topic :: Software Development :: Compilers
15
+ Classifier: Topic :: Software Development :: Interpreters
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Programming Language :: Python :: 3.13
20
+ Classifier: License :: OSI Approved :: Apache Software License
21
+ Classifier: Operating System :: OS Independent
22
+ Requires-Python: >=3.11
23
+ Description-Content-Type: text/markdown
24
+ License-File: LICENSE
25
+ Requires-Dist: rich>=13.0
26
+ Requires-Dist: pygls>=1.3
27
+ Requires-Dist: prompt_toolkit>=3.0
28
+ Requires-Dist: anthropic>=0.40
29
+ Provides-Extra: dev
30
+ Requires-Dist: pytest>=8.0; extra == "dev"
31
+ Requires-Dist: pytest-json-report; extra == "dev"
32
+ Requires-Dist: mypy; extra == "dev"
33
+ Dynamic: license-file
34
+
35
+ # Ragul
36
+
37
+ > *Ragul* — from Hungarian *rag* (suffix/affix) + *-ul* (in the manner of a language).
38
+ > An experimental programming language whose core logic is modelled on agglutinative grammar.
39
+
40
+ **Meaning is built by stacking suffixes onto a root — a suffix chain is a pipeline.**
41
+
42
+ ```ragul
43
+ adatok-szűrve-rendezve-ból 5-felett-val kimenet-ba másol-va.
44
+ // FROM data→filter(>5)→sort, INTO output, AS copy
45
+ ```
46
+
47
+ 📖 **[Full documentation →](https://kory75.github.io/ragul/)**
48
+
49
+ ---
50
+
51
+ ## Install
52
+
53
+ Ragul is not yet on PyPI. Install from source:
54
+
55
+ ```bash
56
+ git clone https://github.com/kory75/ragul.git
57
+ cd ragul
58
+ pip install -e ".[dev]"
59
+ ```
60
+
61
+ Requires **Python 3.11+**.
62
+
63
+ ---
64
+
65
+ ## Quick Start
66
+
67
+ ```bash
68
+ # Run a program
69
+ ragul futtat hello.ragul
70
+
71
+ # Type-check without running
72
+ ragul ellenőriz hello.ragul
73
+
74
+ # Interactive REPL
75
+ ragul repl
76
+
77
+ # Start the LSP server (for editor integration)
78
+ ragul lsp
79
+ ```
80
+
81
+ ---
82
+
83
+ ## Examples
84
+
85
+ ### Hello World
86
+
87
+ ```ragul
88
+ program-nk-hatás
89
+ üdvözlet-be "helló világ"-t.
90
+ üdvözlet-képernyőre-va.
91
+ ```
92
+
93
+ ### Arithmetic pipeline
94
+
95
+ ```ragul
96
+ program-nk-hatás
97
+ x-be 10-t.
98
+ y-be x-3-össze-2-szoroz-t. // (10 + 3) × 2 = 26
99
+ y-képernyőre-va.
100
+ ```
101
+
102
+ ### Filter and sort a list
103
+
104
+ ```ragul
105
+ program-nk-hatás
106
+ adatok-be [7, 2, 15, 3, 9, 1, 12, 4]-t.
107
+ eredmény-be adatok-szűrve-rendezve-ból 5-felett-val t.
108
+ eredmény-képernyőre-va.
109
+ // [7, 9, 12, 15]
110
+ ```
111
+
112
+ ### Define and call a custom suffix
113
+
114
+ ```ragul
115
+ // Define -kétszeres as a reusable suffix
116
+ kétszeres-unk
117
+ szám-d.
118
+ szám-szám-össze-t.
119
+
120
+ program-nk-hatás
121
+ x-be 7-t.
122
+ y-be x-kétszeres-t. // 14
123
+ y-képernyőre-va.
124
+ ```
125
+
126
+ ### Conditionals
127
+
128
+ ```ragul
129
+ besoroló-nk-ha
130
+ szám-d.
131
+ szám-100-felett-ha
132
+ "nagy"-t.
133
+ -különben-ha szám-50-felett-ha
134
+ "közepes"-t.
135
+ -hanem
136
+ "kicsi"-t.
137
+
138
+ program-nk-hatás
139
+ kategória-be 75-besoroló-ha-t.
140
+ kategória-képernyőre-va.
141
+ // közepes
142
+ ```
143
+
144
+ ### Loops
145
+
146
+ ```ragul
147
+ // Sum a list using fold
148
+ összesítő-nk-gyűjt
149
+ elem-d.
150
+ összeg-d.
151
+ összeg-elem-össze-t.
152
+
153
+ program-nk-hatás
154
+ lista-be [1, 2, 3, 4, 5]-t.
155
+ összeg-be lista-összesítő-gyűjt-t 0-val.
156
+ összeg-képernyőre-va.
157
+ // 15
158
+ ```
159
+
160
+ ### Error handling
161
+
162
+ ```ragul
163
+ program-nk-hatás
164
+ tartalom-be "adat.txt"-fájlolvasó-va-e.
165
+ tartalom-képernyőre-va.
166
+ -hibára
167
+ hiba-képernyőre-va.
168
+ ```
169
+
170
+ ---
171
+
172
+ ## What's in v0.1.0
173
+
174
+ | Feature | Status |
175
+ |---|---|
176
+ | Lexer with full alias normalisation | ✅ |
177
+ | Parser → Scope tree (indentation-based) | ✅ |
178
+ | Static type checker (E001–E009, W001) | ✅ |
179
+ | Interpreter — assignment, arithmetic, pipelines | ✅ |
180
+ | All loop kinds: `-míg`, `-ig`, `-mindegyik`, `-gyűjt` | ✅ |
181
+ | Conditionals: `-ha` / `-hanem` / `-különben-ha` | ✅ |
182
+ | Error propagation: `-e` and `-hibára` | ✅ |
183
+ | Effect scopes (`-nk-hatás`) + I/O channels | ✅ |
184
+ | Stdlib: arithmetic, comparison, logical, string, list, math | ✅ |
185
+ | CLI: `futtat`, `ellenőriz`, `fordít`, `repl`, `lsp` | ✅ |
186
+ | Interactive REPL with persistent environment | ✅ |
187
+ | LSP server: diagnostics, hover, completion, go-to-def | ✅ |
188
+ | Agent architecture with Claude AI error analysis | ✅ |
189
+ | GitHub Actions CI (pytest + mypy on every push) | ✅ |
190
+ | Documentation site (GitHub Pages) | ✅ |
191
+
192
+ ---
193
+
194
+ ## Architecture
195
+
196
+ ```
197
+ ragul/
198
+ ├── model.py # Word, Sentence, Scope, RagulType + alias table
199
+ ├── lexer.py # Tokeniser with alias normalisation at lex time
200
+ ├── parser.py # Two-pass: word construction + scope tree assembly
201
+ ├── typechecker.py # Static type checker, E001–E009, W001
202
+ ├── interpreter.py # Tree-walking interpreter
203
+ ├── errors.py # Structured error types and formatters
204
+ ├── config.py # ragul.config TOML loader
205
+ ├── main.py # CLI entry point
206
+ ├── stdlib/
207
+ │ ├── core.py # Arithmetic, comparison, logical, string concat
208
+ │ └── modules.py # matematika, szöveg, lista modules
209
+ ├── agents/
210
+ │ ├── orchestrator.py # Coordinates the pipeline; Claude AI error analysis
211
+ │ ├── task.py # Task / TaskResult message protocol
212
+ │ └── ... # LexerAgent, ParserAgent, TypeAgent, InterpAgent, ...
213
+ ├── repl/
214
+ │ └── repl.py # Interactive REPL
215
+ └── lsp/
216
+ └── server.py # pygls LSP server
217
+ ```
218
+
219
+ ---
220
+
221
+ ## Running Tests
222
+
223
+ ```bash
224
+ pytest ragul/tests/ -v
225
+ ```
226
+
227
+ With type checking:
228
+
229
+ ```bash
230
+ python -m mypy ragul/ --ignore-missing-imports
231
+ ```
232
+
233
+ ---
234
+
235
+ ## Suffix Alias Quick Reference
236
+
237
+ Each suffix has a canonical Hungarian form plus English and symbolic aliases:
238
+
239
+ | Role | Canonical | English | Symbol |
240
+ |---|---|---|---|
241
+ | Source (from) | `-ból` / `-ből` | `-from` | `-<` |
242
+ | Target (into) | `-ba` / `-be` | `-into` | `->` |
243
+ | Instrument (with) | `-val` / `-vel` | `-with` | `-&` |
244
+ | Object (acted on) | `-t` | `-obj` | `-*` |
245
+ | Action (execute) | `-va` / `-ve` | `-doing` | `-!` |
246
+ | Error propagation | `-e` | `-else-fail` | `-?` |
247
+
248
+ ---
249
+
250
+ ## REPL
251
+
252
+ ```bash
253
+ ragul repl
254
+ ```
255
+
256
+ ```
257
+ >>> x-be 3-t.
258
+ >>> y-be x-kétszeres-t.
259
+ >>> y-képernyőre-va.
260
+ 6
261
+ >>> :mutat
262
+ x = 3 (Szám)
263
+ y = 6 (Szám)
264
+ >>> :kilep
265
+ ```
266
+
267
+ ---
268
+
269
+ ## `ragul.config`
270
+
271
+ Place at your project root:
272
+
273
+ ```toml
274
+ [projekt]
275
+ nev = "my-project"
276
+ verzio = "0.1.0"
277
+ belepes = "main.ragul"
278
+
279
+ [ellenorzes]
280
+ harmonia = "warn" # "warn" | "strict" | "off"
281
+ tipus = "warn" # "warn" | "strict" | "off"
282
+ ```
283
+
284
+ ---
285
+
286
+ ## License
287
+
288
+ Apache 2.0 — see [LICENSE](LICENSE) for the full text.