aura-language 0.1.0a1__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 (82) hide show
  1. aura_language-0.1.0a1/PKG-INFO +250 -0
  2. aura_language-0.1.0a1/README.md +234 -0
  3. aura_language-0.1.0a1/aura/__init__.py +3 -0
  4. aura_language-0.1.0a1/aura/cli.py +599 -0
  5. aura_language-0.1.0a1/aura/lsp/__init__.py +1 -0
  6. aura_language-0.1.0a1/aura/lsp/server.py +307 -0
  7. aura_language-0.1.0a1/aura/parser/README.md +6 -0
  8. aura_language-0.1.0a1/aura/parser/__init__.py +1 -0
  9. aura_language-0.1.0a1/aura/parser/aura.g4 +353 -0
  10. aura_language-0.1.0a1/aura/parser/generated/__init__.py +0 -0
  11. aura_language-0.1.0a1/aura/parser/generated/parser/__init__.py +0 -0
  12. aura_language-0.1.0a1/aura/parser/generated/parser/auraLexer.py +472 -0
  13. aura_language-0.1.0a1/aura/parser/generated/parser/auraListener.py +1101 -0
  14. aura_language-0.1.0a1/aura/parser/generated/parser/auraParser.py +9296 -0
  15. aura_language-0.1.0a1/aura/parser/generated/parser/auraVisitor.py +618 -0
  16. aura_language-0.1.0a1/aura/parser/to_ast.py +2078 -0
  17. aura_language-0.1.0a1/aura/repl/__init__.py +0 -0
  18. aura_language-0.1.0a1/aura/repl/engine.py +74 -0
  19. aura_language-0.1.0a1/aura/runtime.py +35 -0
  20. aura_language-0.1.0a1/aura/stdlib/README.md +264 -0
  21. aura_language-0.1.0a1/aura/stdlib/__init__.py +81 -0
  22. aura_language-0.1.0a1/aura/stdlib/collections.py +207 -0
  23. aura_language-0.1.0a1/aura/stdlib/http.py +142 -0
  24. aura_language-0.1.0a1/aura/stdlib/io.py +104 -0
  25. aura_language-0.1.0a1/aura/stdlib/itertools.py +94 -0
  26. aura_language-0.1.0a1/aura/stdlib/json.py +65 -0
  27. aura_language-0.1.0a1/aura/stdlib/math.py +185 -0
  28. aura_language-0.1.0a1/aura/stdlib/os.py +156 -0
  29. aura_language-0.1.0a1/aura/stdlib/regex.py +70 -0
  30. aura_language-0.1.0a1/aura/stdlib/string.py +198 -0
  31. aura_language-0.1.0a1/aura/stdlib/time.py +61 -0
  32. aura_language-0.1.0a1/aura/tools/__init__.py +0 -0
  33. aura_language-0.1.0a1/aura/tools/analyze_tests.py +186 -0
  34. aura_language-0.1.0a1/aura/tools/debugger.py +113 -0
  35. aura_language-0.1.0a1/aura/tools/deps.py +217 -0
  36. aura_language-0.1.0a1/aura/tools/formatter.py +187 -0
  37. aura_language-0.1.0a1/aura/tools/generate_aura_scenarios.py +91 -0
  38. aura_language-0.1.0a1/aura/tools/generate_diverse_tests.py +1191 -0
  39. aura_language-0.1.0a1/aura/tools/generate_enhanced_tests.py +296 -0
  40. aura_language-0.1.0a1/aura/tools/generate_massive_aura_v3.py +112 -0
  41. aura_language-0.1.0a1/aura/tools/generate_stress_scenarios.py +60 -0
  42. aura_language-0.1.0a1/aura/tools/migrate_mut.py +104 -0
  43. aura_language-0.1.0a1/aura/tools/release.py +73 -0
  44. aura_language-0.1.0a1/aura/tools/stochastic_aura_gen.py +204 -0
  45. aura_language-0.1.0a1/aura/transpiler/ast.py +514 -0
  46. aura_language-0.1.0a1/aura/transpiler/errors.py +181 -0
  47. aura_language-0.1.0a1/aura/transpiler/importer.py +145 -0
  48. aura_language-0.1.0a1/aura/transpiler/macros.py +154 -0
  49. aura_language-0.1.0a1/aura/transpiler/semantics.py +339 -0
  50. aura_language-0.1.0a1/aura/transpiler/transformer.py +149 -0
  51. aura_language-0.1.0a1/aura/transpiler/transformers/__init__.py +1 -0
  52. aura_language-0.1.0a1/aura/transpiler/transformers/expressions.py +822 -0
  53. aura_language-0.1.0a1/aura/transpiler/transformers/statements.py +772 -0
  54. aura_language-0.1.0a1/aura/transpiler/types.py +1068 -0
  55. aura_language-0.1.0a1/aura_language.egg-info/PKG-INFO +250 -0
  56. aura_language-0.1.0a1/aura_language.egg-info/SOURCES.txt +80 -0
  57. aura_language-0.1.0a1/aura_language.egg-info/dependency_links.txt +1 -0
  58. aura_language-0.1.0a1/aura_language.egg-info/entry_points.txt +2 -0
  59. aura_language-0.1.0a1/aura_language.egg-info/requires.txt +6 -0
  60. aura_language-0.1.0a1/aura_language.egg-info/top_level.txt +2 -0
  61. aura_language-0.1.0a1/main.py +16 -0
  62. aura_language-0.1.0a1/pyproject.toml +52 -0
  63. aura_language-0.1.0a1/setup.cfg +4 -0
  64. aura_language-0.1.0a1/tests/test_comprehensive.py +1302 -0
  65. aura_language-0.1.0a1/tests/test_errors.py +102 -0
  66. aura_language-0.1.0a1/tests/test_features.py +54 -0
  67. aura_language-0.1.0a1/tests/test_massive_aura_files.py +75 -0
  68. aura_language-0.1.0a1/tests/test_massive_aura_v2.py +59 -0
  69. aura_language-0.1.0a1/tests/test_massive_generated.py +77 -0
  70. aura_language-0.1.0a1/tests/test_massive_stress.py +64 -0
  71. aura_language-0.1.0a1/tests/test_parser_errors.py +32 -0
  72. aura_language-0.1.0a1/tests/test_parser_expressions.py +56 -0
  73. aura_language-0.1.0a1/tests/test_parser_statements.py +85 -0
  74. aura_language-0.1.0a1/tests/test_regressions.py +1126 -0
  75. aura_language-0.1.0a1/tests/test_repl.py +87 -0
  76. aura_language-0.1.0a1/tests/test_runtime.py +576 -0
  77. aura_language-0.1.0a1/tests/test_stdlib.py +368 -0
  78. aura_language-0.1.0a1/tests/test_tokenizer.py +71 -0
  79. aura_language-0.1.0a1/tests/test_tooling.py +206 -0
  80. aura_language-0.1.0a1/tests/test_transpiler.py +242 -0
  81. aura_language-0.1.0a1/tests/test_transpiler_transformers.py +80 -0
  82. aura_language-0.1.0a1/tests/test_typechecker.py +339 -0
@@ -0,0 +1,250 @@
1
+ Metadata-Version: 2.4
2
+ Name: aura-language
3
+ Version: 0.1.0a1
4
+ Summary: Aura: a gradually-typed language that transpiles to Python
5
+ Author: Aura Team
6
+ License-Expression: MIT
7
+ Keywords: transpiler,language,python,aura
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: Programming Language :: Python :: 3 :: Only
10
+ Classifier: Topic :: Software Development :: Compilers
11
+ Requires-Python: >=3.10
12
+ Description-Content-Type: text/markdown
13
+ Requires-Dist: tomli>=2.0; python_version < "3.11"
14
+ Provides-Extra: dev
15
+ Requires-Dist: pytest>=7.0; extra == "dev"
16
+
17
+ # Aura
18
+
19
+ A programming language that transpiles to Python.
20
+
21
+ ## Installation
22
+
23
+ Install the toolchain from a wheel or sdist; this provides the `aura` command:
24
+
25
+ ```bash
26
+ pip install aura-language # once published on PyPI
27
+ # or from a checkout:
28
+ pip install .
29
+ aura run examples/hello.aura
30
+ ```
31
+
32
+ Installed commands (`aura <cmd>`):
33
+
34
+ | Command | Description |
35
+ |---------|-------------|
36
+ | `aura run <file>` | Transpile and execute |
37
+ | `aura transpile <file> [-o out.py]` | Convert Aura to Python |
38
+ | `aura check <file>` | Type and mutability checks |
39
+ | `aura format <file>` | Format source |
40
+ | `aura lint <file>` | Style warnings |
41
+ | `aura test <dir>` | Run `.aura` files |
42
+ | `aura repl` | Interactive REPL |
43
+ | `aura init [name]` | Create `aura.toml` and `src/main.aura` |
44
+ | `aura add <pkg>` | Add and install a dependency |
45
+ | `aura install` | Install dependencies from `aura.toml` |
46
+ | `aura deps` | List declared dependencies |
47
+ | `aura version [bump]` | Show or bump the version |
48
+ | `aura debug <file> [-t]` | Run under the trace debugger |
49
+ | `aura lsp` | Start the language server (stdio) |
50
+
51
+ Aura programs can import any Python standard-library module or installed PyPI
52
+ package, plus local `.aura` modules and packages. The standard library also
53
+ ships `stdlib.regex`, `stdlib.os` and `stdlib.http`.
54
+
55
+ ## Quick Start (from source, no install)
56
+
57
+ ```bash
58
+ git clone https://github.com/JoaoValentimTheo/aura-lang.git
59
+ cd aura-lang
60
+ python3 main.py run examples/hello.aura
61
+ ```
62
+
63
+ ## Examples
64
+
65
+ ### Hello World
66
+
67
+ ```aura
68
+ print("Hello, Aura!")
69
+ ```
70
+
71
+ ### Fibonacci
72
+
73
+ ```aura
74
+ def fibonacci(n) -> int {
75
+ let mut a = 0
76
+ let mut b = 1
77
+ for i in range(n) {
78
+ let next = a + b
79
+ a = b
80
+ b = next
81
+ }
82
+ return a
83
+ }
84
+
85
+ print(fibonacci(10))
86
+ ```
87
+
88
+ ### Prime Checker
89
+
90
+ ```aura
91
+ def is_prime(n) -> bool {
92
+ if n < 2 { return false }
93
+ if n == 2 { return true }
94
+ if n % 2 == 0 { return false }
95
+
96
+ let i = 3
97
+ while i * i <= n {
98
+ if n % i == 0 { return false }
99
+ i += 2
100
+ }
101
+ return true
102
+ }
103
+
104
+ for n in [2, 3, 5, 7, 11, 13, 17, 19, 23, 29] {
105
+ print(f"{n} is prime: {is_prime(n)}")
106
+ }
107
+ ```
108
+
109
+ ### Classes
110
+
111
+ ```aura
112
+ class BankAccount {
113
+ let owner: str = ""
114
+ let balance: float = 0.0
115
+
116
+ def new(owner: str, balance: float = 0.0) {
117
+ self.owner = owner
118
+ self.balance = balance
119
+ }
120
+
121
+ def deposit(amount: float) {
122
+ if amount > 0.0 {
123
+ self.balance += amount
124
+ print(f"Deposited {amount}, balance: {self.balance}")
125
+ }
126
+ }
127
+
128
+ def withdraw(amount: float) -> bool {
129
+ if amount <= self.balance {
130
+ self.balance -= amount
131
+ print(f"Withdrew {amount}, balance: {self.balance}")
132
+ return true
133
+ }
134
+ print("Insufficient funds")
135
+ return false
136
+ }
137
+
138
+ @property
139
+ def is_empty() -> bool {
140
+ return self.balance == 0.0
141
+ }
142
+ }
143
+
144
+ let account = BankAccount("Alice", 1000.0)
145
+ account.deposit(500.0)
146
+ account.withdraw(200.0)
147
+ print(f"Empty? {account.is_empty}")
148
+ ```
149
+
150
+ ### Pattern Matching
151
+
152
+ ```aura
153
+ match value {
154
+ case 0 { print("zero") }
155
+ case 1 { print("one") }
156
+ case n if n > 100 { print("big") }
157
+ case _ { print("other") }
158
+ }
159
+ ```
160
+
161
+ ### Functional Pipelines
162
+
163
+ ```aura
164
+ let result = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
165
+ |> filter((x) => x % 2 == 0)
166
+ |> map((x) => x * x)
167
+ |> reduce((acc, x) => acc + x, 0)
168
+
169
+ print(f"Sum of even squares: {result}")
170
+ ```
171
+
172
+ ### Error Handling
173
+
174
+ ```aura
175
+ def safe_divide(a, b) -> float {
176
+ if b == 0 {
177
+ throw ValueError("division by zero")
178
+ }
179
+ return a / b
180
+ }
181
+
182
+ try {
183
+ print(safe_divide(10, 2))
184
+ print(safe_divide(1, 0))
185
+ } catch error {
186
+ print(f"Caught: {error}")
187
+ } finally {
188
+ print("cleanup complete")
189
+ }
190
+ ```
191
+
192
+ ### Macros
193
+
194
+ ```aura
195
+ @debug
196
+ def multiply(a, b) -> int {
197
+ return a * b
198
+ }
199
+
200
+ @timeit
201
+ def sum_to(n) -> int {
202
+ let mut total = 0
203
+ for i in range(n) {
204
+ total += i
205
+ }
206
+ return total
207
+ }
208
+
209
+ @memoize
210
+ def fib(n) -> int {
211
+ if n < 2 { return n }
212
+ return fib(n - 1) + fib(n - 2)
213
+ }
214
+ ```
215
+
216
+ ## CLI Commands
217
+
218
+ | Command | Description |
219
+ |---------|-------------|
220
+ | `python3 main.py transpile <file.aura>` | Transpile to Python (stdout) |
221
+ | `python3 main.py transpile <file.aura> -o <out.py>` | Transpile to file |
222
+ | `python3 main.py check <file.aura>` | Type check |
223
+ | `python3 main.py format <file.aura>` | Format code |
224
+ | `python3 main.py lint <file.aura>` | Lint code |
225
+ | `python3 main.py run <file.aura>` | Run Aura file |
226
+ | `python3 main.py run <file.aura> -v` | Run with Python output |
227
+ | `python3 main.py repl` | Interactive REPL |
228
+
229
+ ## Documentation
230
+
231
+ - [Language Reference](docs/LANGUAGE.md) / [Referencia da Linguagem](docs/LANGUAGE_PT.md)
232
+ - [Type System](docs/TYPES.md) / [Sistema de Tipos](docs/TYPES_PT.md)
233
+ - [Architecture](docs/DESIGN.md)
234
+ - [Audit Report](docs/AUDIT.md)
235
+ - [Documentation Index](docs/README.md)
236
+
237
+ ## Testing
238
+
239
+ ```bash
240
+ python3 -m pytest tests/ -v # full suite
241
+ python3 tests/test_runtime.py # transpile + execute programs
242
+ python3 tests/test_regressions.py # audit regression coverage
243
+ ```
244
+
245
+ Set `AURA_FUZZ_SEEDS=100000` to run the stochastic fuzzer beyond its
246
+ default sample of 200 seeds.
247
+
248
+ ## License
249
+
250
+ MIT
@@ -0,0 +1,234 @@
1
+ # Aura
2
+
3
+ A programming language that transpiles to Python.
4
+
5
+ ## Installation
6
+
7
+ Install the toolchain from a wheel or sdist; this provides the `aura` command:
8
+
9
+ ```bash
10
+ pip install aura-language # once published on PyPI
11
+ # or from a checkout:
12
+ pip install .
13
+ aura run examples/hello.aura
14
+ ```
15
+
16
+ Installed commands (`aura <cmd>`):
17
+
18
+ | Command | Description |
19
+ |---------|-------------|
20
+ | `aura run <file>` | Transpile and execute |
21
+ | `aura transpile <file> [-o out.py]` | Convert Aura to Python |
22
+ | `aura check <file>` | Type and mutability checks |
23
+ | `aura format <file>` | Format source |
24
+ | `aura lint <file>` | Style warnings |
25
+ | `aura test <dir>` | Run `.aura` files |
26
+ | `aura repl` | Interactive REPL |
27
+ | `aura init [name]` | Create `aura.toml` and `src/main.aura` |
28
+ | `aura add <pkg>` | Add and install a dependency |
29
+ | `aura install` | Install dependencies from `aura.toml` |
30
+ | `aura deps` | List declared dependencies |
31
+ | `aura version [bump]` | Show or bump the version |
32
+ | `aura debug <file> [-t]` | Run under the trace debugger |
33
+ | `aura lsp` | Start the language server (stdio) |
34
+
35
+ Aura programs can import any Python standard-library module or installed PyPI
36
+ package, plus local `.aura` modules and packages. The standard library also
37
+ ships `stdlib.regex`, `stdlib.os` and `stdlib.http`.
38
+
39
+ ## Quick Start (from source, no install)
40
+
41
+ ```bash
42
+ git clone https://github.com/JoaoValentimTheo/aura-lang.git
43
+ cd aura-lang
44
+ python3 main.py run examples/hello.aura
45
+ ```
46
+
47
+ ## Examples
48
+
49
+ ### Hello World
50
+
51
+ ```aura
52
+ print("Hello, Aura!")
53
+ ```
54
+
55
+ ### Fibonacci
56
+
57
+ ```aura
58
+ def fibonacci(n) -> int {
59
+ let mut a = 0
60
+ let mut b = 1
61
+ for i in range(n) {
62
+ let next = a + b
63
+ a = b
64
+ b = next
65
+ }
66
+ return a
67
+ }
68
+
69
+ print(fibonacci(10))
70
+ ```
71
+
72
+ ### Prime Checker
73
+
74
+ ```aura
75
+ def is_prime(n) -> bool {
76
+ if n < 2 { return false }
77
+ if n == 2 { return true }
78
+ if n % 2 == 0 { return false }
79
+
80
+ let i = 3
81
+ while i * i <= n {
82
+ if n % i == 0 { return false }
83
+ i += 2
84
+ }
85
+ return true
86
+ }
87
+
88
+ for n in [2, 3, 5, 7, 11, 13, 17, 19, 23, 29] {
89
+ print(f"{n} is prime: {is_prime(n)}")
90
+ }
91
+ ```
92
+
93
+ ### Classes
94
+
95
+ ```aura
96
+ class BankAccount {
97
+ let owner: str = ""
98
+ let balance: float = 0.0
99
+
100
+ def new(owner: str, balance: float = 0.0) {
101
+ self.owner = owner
102
+ self.balance = balance
103
+ }
104
+
105
+ def deposit(amount: float) {
106
+ if amount > 0.0 {
107
+ self.balance += amount
108
+ print(f"Deposited {amount}, balance: {self.balance}")
109
+ }
110
+ }
111
+
112
+ def withdraw(amount: float) -> bool {
113
+ if amount <= self.balance {
114
+ self.balance -= amount
115
+ print(f"Withdrew {amount}, balance: {self.balance}")
116
+ return true
117
+ }
118
+ print("Insufficient funds")
119
+ return false
120
+ }
121
+
122
+ @property
123
+ def is_empty() -> bool {
124
+ return self.balance == 0.0
125
+ }
126
+ }
127
+
128
+ let account = BankAccount("Alice", 1000.0)
129
+ account.deposit(500.0)
130
+ account.withdraw(200.0)
131
+ print(f"Empty? {account.is_empty}")
132
+ ```
133
+
134
+ ### Pattern Matching
135
+
136
+ ```aura
137
+ match value {
138
+ case 0 { print("zero") }
139
+ case 1 { print("one") }
140
+ case n if n > 100 { print("big") }
141
+ case _ { print("other") }
142
+ }
143
+ ```
144
+
145
+ ### Functional Pipelines
146
+
147
+ ```aura
148
+ let result = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
149
+ |> filter((x) => x % 2 == 0)
150
+ |> map((x) => x * x)
151
+ |> reduce((acc, x) => acc + x, 0)
152
+
153
+ print(f"Sum of even squares: {result}")
154
+ ```
155
+
156
+ ### Error Handling
157
+
158
+ ```aura
159
+ def safe_divide(a, b) -> float {
160
+ if b == 0 {
161
+ throw ValueError("division by zero")
162
+ }
163
+ return a / b
164
+ }
165
+
166
+ try {
167
+ print(safe_divide(10, 2))
168
+ print(safe_divide(1, 0))
169
+ } catch error {
170
+ print(f"Caught: {error}")
171
+ } finally {
172
+ print("cleanup complete")
173
+ }
174
+ ```
175
+
176
+ ### Macros
177
+
178
+ ```aura
179
+ @debug
180
+ def multiply(a, b) -> int {
181
+ return a * b
182
+ }
183
+
184
+ @timeit
185
+ def sum_to(n) -> int {
186
+ let mut total = 0
187
+ for i in range(n) {
188
+ total += i
189
+ }
190
+ return total
191
+ }
192
+
193
+ @memoize
194
+ def fib(n) -> int {
195
+ if n < 2 { return n }
196
+ return fib(n - 1) + fib(n - 2)
197
+ }
198
+ ```
199
+
200
+ ## CLI Commands
201
+
202
+ | Command | Description |
203
+ |---------|-------------|
204
+ | `python3 main.py transpile <file.aura>` | Transpile to Python (stdout) |
205
+ | `python3 main.py transpile <file.aura> -o <out.py>` | Transpile to file |
206
+ | `python3 main.py check <file.aura>` | Type check |
207
+ | `python3 main.py format <file.aura>` | Format code |
208
+ | `python3 main.py lint <file.aura>` | Lint code |
209
+ | `python3 main.py run <file.aura>` | Run Aura file |
210
+ | `python3 main.py run <file.aura> -v` | Run with Python output |
211
+ | `python3 main.py repl` | Interactive REPL |
212
+
213
+ ## Documentation
214
+
215
+ - [Language Reference](docs/LANGUAGE.md) / [Referencia da Linguagem](docs/LANGUAGE_PT.md)
216
+ - [Type System](docs/TYPES.md) / [Sistema de Tipos](docs/TYPES_PT.md)
217
+ - [Architecture](docs/DESIGN.md)
218
+ - [Audit Report](docs/AUDIT.md)
219
+ - [Documentation Index](docs/README.md)
220
+
221
+ ## Testing
222
+
223
+ ```bash
224
+ python3 -m pytest tests/ -v # full suite
225
+ python3 tests/test_runtime.py # transpile + execute programs
226
+ python3 tests/test_regressions.py # audit regression coverage
227
+ ```
228
+
229
+ Set `AURA_FUZZ_SEEDS=100000` to run the stochastic fuzzer beyond its
230
+ default sample of 200 seeds.
231
+
232
+ ## License
233
+
234
+ MIT
@@ -0,0 +1,3 @@
1
+ """Aura language toolchain."""
2
+
3
+ __version__ = "0.1.0a1"