neuron-lang 1.0.1__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.
- neuron_lang-1.0.1/PKG-INFO +252 -0
- neuron_lang-1.0.1/README.md +240 -0
- neuron_lang-1.0.1/neuron/__init__.py +18 -0
- neuron_lang-1.0.1/neuron/ast_nodes.py +432 -0
- neuron_lang-1.0.1/neuron/compiler.py +198 -0
- neuron_lang-1.0.1/neuron/environment.py +179 -0
- neuron_lang-1.0.1/neuron/errors.py +185 -0
- neuron_lang-1.0.1/neuron/interpreter.py +648 -0
- neuron_lang-1.0.1/neuron/lexer.py +417 -0
- neuron_lang-1.0.1/neuron/main.py +176 -0
- neuron_lang-1.0.1/neuron/package_manager.py +122 -0
- neuron_lang-1.0.1/neuron/parser.py +627 -0
- neuron_lang-1.0.1/neuron/repl.py +121 -0
- neuron_lang-1.0.1/neuron/semantic.py +145 -0
- neuron_lang-1.0.1/neuron/stdlib/__init__.py +164 -0
- neuron_lang-1.0.1/neuron/stdlib/data.py +72 -0
- neuron_lang-1.0.1/neuron/stdlib/io_lib.py +30 -0
- neuron_lang-1.0.1/neuron/stdlib/math_lib.py +35 -0
- neuron_lang-1.0.1/neuron/stdlib/metrics.py +79 -0
- neuron_lang-1.0.1/neuron/stdlib/neural.py +220 -0
- neuron_lang-1.0.1/neuron/stdlib/nlp.py +72 -0
- neuron_lang-1.0.1/neuron/stdlib/optim.py +102 -0
- neuron_lang-1.0.1/neuron/stdlib/plot.py +40 -0
- neuron_lang-1.0.1/neuron/stdlib/preprocess.py +67 -0
- neuron_lang-1.0.1/neuron/stdlib/tensor.py +210 -0
- neuron_lang-1.0.1/neuron/stdlib/vision.py +67 -0
- neuron_lang-1.0.1/neuron/tokens.py +165 -0
- neuron_lang-1.0.1/neuron/utils/__init__.py +1 -0
- neuron_lang-1.0.1/neuron/utils/colors.py +138 -0
- neuron_lang-1.0.1/neuron_lang.egg-info/PKG-INFO +252 -0
- neuron_lang-1.0.1/neuron_lang.egg-info/SOURCES.txt +36 -0
- neuron_lang-1.0.1/neuron_lang.egg-info/dependency_links.txt +1 -0
- neuron_lang-1.0.1/neuron_lang.egg-info/entry_points.txt +2 -0
- neuron_lang-1.0.1/neuron_lang.egg-info/requires.txt +5 -0
- neuron_lang-1.0.1/neuron_lang.egg-info/top_level.txt +1 -0
- neuron_lang-1.0.1/pyproject.toml +21 -0
- neuron_lang-1.0.1/setup.cfg +4 -0
- neuron_lang-1.0.1/tests/test_semantic.py +56 -0
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: neuron-lang
|
|
3
|
+
Version: 1.0.1
|
|
4
|
+
Summary: AI-First Programming Language
|
|
5
|
+
License: MIT
|
|
6
|
+
Requires-Python: >=3.8
|
|
7
|
+
Description-Content-Type: text/markdown
|
|
8
|
+
Requires-Dist: numpy>=1.21.0
|
|
9
|
+
Provides-Extra: full
|
|
10
|
+
Requires-Dist: matplotlib>=3.5.0; extra == "full"
|
|
11
|
+
Requires-Dist: Pillow>=9.0.0; extra == "full"
|
|
12
|
+
|
|
13
|
+
# Neuron Language
|
|
14
|
+
|
|
15
|
+
> The AI-First Programming Language. Built for humans, designed for Machine Learning.
|
|
16
|
+
|
|
17
|
+
Neuron (`.nl`) is a high-level, Python-like, OOP-based programming language built from the ground up for Artificial Intelligence training, tensors, and neural networks. It features a clean, English-like syntax that replaces traditional programming keywords with intuitive verbs.
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## Installation
|
|
22
|
+
|
|
23
|
+
You can install Neuron directly from PyPI on any Windows, Mac, or Linux machine:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
pip install neuron-lang
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## Running Code
|
|
32
|
+
|
|
33
|
+
Once installed, you can use the `neuron` command to run files, compile them, or start the interactive REPL.
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
# Start the interactive coding environment
|
|
37
|
+
neuron
|
|
38
|
+
|
|
39
|
+
# Run a Neuron script
|
|
40
|
+
neuron run my_script.nl
|
|
41
|
+
|
|
42
|
+
# Compile for faster future execution
|
|
43
|
+
neuron compile my_script.nl
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## Package Manager (Auto-Install!)
|
|
49
|
+
|
|
50
|
+
Neuron has built-in integration with the entire Python ecosystem. Any Python library (NumPy, Pandas, TensorFlow, PyTorch) can be used in Neuron!
|
|
51
|
+
|
|
52
|
+
If you `grab` a library that isn't installed, **Neuron will automatically install it for you in the background!**
|
|
53
|
+
|
|
54
|
+
```neuron
|
|
55
|
+
## If pandas isn't installed, Neuron auto-installs it and imports it!
|
|
56
|
+
grab pandas
|
|
57
|
+
|
|
58
|
+
## You can also explicitly manage packages via the CLI:
|
|
59
|
+
# neuron get scikit-learn
|
|
60
|
+
# neuron packages
|
|
61
|
+
# neuron remove pandas
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
## Language Syntax & Features
|
|
67
|
+
|
|
68
|
+
Neuron uses natural language keywords to make coding more intuitive.
|
|
69
|
+
|
|
70
|
+
### Variables & Printing
|
|
71
|
+
```neuron
|
|
72
|
+
## Variables don't need type declarations
|
|
73
|
+
name = "AI Builder"
|
|
74
|
+
version = 1.0
|
|
75
|
+
|
|
76
|
+
## String interpolation uses {brackets}
|
|
77
|
+
show("Welcome {name} to Neuron v{version}!")
|
|
78
|
+
|
|
79
|
+
## Ask for user input
|
|
80
|
+
user = ask("What is your name? ")
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### Functions
|
|
84
|
+
Use `do` to define a function, and `give` to return a value.
|
|
85
|
+
|
|
86
|
+
```neuron
|
|
87
|
+
do add_numbers(x, y):
|
|
88
|
+
result = x + y
|
|
89
|
+
give result
|
|
90
|
+
|
|
91
|
+
show(add_numbers(10, 5)) ## Output: 15
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### Conditions
|
|
95
|
+
Neuron replaces `if/elif/else` with `when/orwhen/otherwise`.
|
|
96
|
+
|
|
97
|
+
```neuron
|
|
98
|
+
age = 20
|
|
99
|
+
|
|
100
|
+
when age < 18:
|
|
101
|
+
show("Too young!")
|
|
102
|
+
orwhen age == 18:
|
|
103
|
+
show("Just right!")
|
|
104
|
+
otherwise:
|
|
105
|
+
show("Welcome!")
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### Loops
|
|
109
|
+
Neuron features a powerful `each ... within` loop construct.
|
|
110
|
+
|
|
111
|
+
```neuron
|
|
112
|
+
## Loop through a list
|
|
113
|
+
each item within [1, 2, 3]:
|
|
114
|
+
show(item)
|
|
115
|
+
|
|
116
|
+
## Loop through a range using upto()
|
|
117
|
+
each i within upto(5):
|
|
118
|
+
show(i) ## Outputs 0, 1, 2, 3, 4
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### The Pipeline Operator `|>`
|
|
122
|
+
Easily chain function calls together reading left-to-right!
|
|
123
|
+
|
|
124
|
+
```neuron
|
|
125
|
+
do double(x):
|
|
126
|
+
give x * 2
|
|
127
|
+
|
|
128
|
+
do add_ten(x):
|
|
129
|
+
give x + 10
|
|
130
|
+
|
|
131
|
+
## Passes 5 into double(), then passes the result into add_ten()
|
|
132
|
+
result = 5 |> double |> add_ten
|
|
133
|
+
show(result) ## Output: 20
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
---
|
|
137
|
+
|
|
138
|
+
## Object-Oriented Programming (OOP)
|
|
139
|
+
|
|
140
|
+
Neuron uses `entity` instead of `class`, and `me` instead of `self` or `this`.
|
|
141
|
+
|
|
142
|
+
```neuron
|
|
143
|
+
entity Animal:
|
|
144
|
+
do create(me, name):
|
|
145
|
+
me.name = name
|
|
146
|
+
|
|
147
|
+
do speak(me):
|
|
148
|
+
show("{me.name} makes a sound.")
|
|
149
|
+
|
|
150
|
+
## Inheritance using 'from'
|
|
151
|
+
entity Dog from Animal:
|
|
152
|
+
do speak(me):
|
|
153
|
+
show("{me.name} says Woof!")
|
|
154
|
+
|
|
155
|
+
buddy = Dog("Buddy")
|
|
156
|
+
buddy.speak() ## Output: Buddy says Woof!
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
---
|
|
160
|
+
|
|
161
|
+
## AI-Native Features (`brain`)
|
|
162
|
+
|
|
163
|
+
Neuron has a special class type called `brain` specifically for AI models. Brains automatically have `train()`, `predict()`, and `save()` functionalities built-in.
|
|
164
|
+
|
|
165
|
+
```neuron
|
|
166
|
+
grab neural
|
|
167
|
+
|
|
168
|
+
brain MyNet:
|
|
169
|
+
do create(me):
|
|
170
|
+
me.add_layer(neural.Dense(128))
|
|
171
|
+
me.add_layer(neural.ReLU())
|
|
172
|
+
me.add_layer(neural.Dense(10))
|
|
173
|
+
|
|
174
|
+
model = MyNet()
|
|
175
|
+
show(model.status) ## Output: NOT TRAINED
|
|
176
|
+
model.train(data)
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
---
|
|
180
|
+
|
|
181
|
+
## Tensors and Deep Learning
|
|
182
|
+
|
|
183
|
+
Neuron ships with a built-in standard library for tensors (`tensor`) with automatic differentiation (Autograd) for building neural networks from scratch.
|
|
184
|
+
|
|
185
|
+
### Compile-Time Shape Checks
|
|
186
|
+
|
|
187
|
+
The compiler and interpreter check statically known tensor shapes before running a program. Use a typed tensor declaration to declare an expected shape:
|
|
188
|
+
|
|
189
|
+
```neuron
|
|
190
|
+
grab tensor
|
|
191
|
+
|
|
192
|
+
tensor[100, 784] x = tensor.random(100, 784)
|
|
193
|
+
tensor[784, 10] w = tensor.random(784, 10)
|
|
194
|
+
tensor[100, 10] y = x.matmul(w)
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
The current analysis infers shapes from `tensor.random`, `tensor.rand`, `tensor.zeros`, and `tensor.ones`, propagates them through assignments, and checks rank-2 `matmul` and elementwise broadcasting. It reports a compile error when a known result conflicts with a declaration or matrix dimensions do not align. Shapes that cannot be inferred statically are left for runtime validation.
|
|
198
|
+
|
|
199
|
+
### Linear Regression Example
|
|
200
|
+
```neuron
|
|
201
|
+
grab tensor
|
|
202
|
+
|
|
203
|
+
## Generate Data
|
|
204
|
+
x = tensor.random(100, 1)
|
|
205
|
+
y = x * 3.0 + 2.0
|
|
206
|
+
|
|
207
|
+
## Weights
|
|
208
|
+
w = tensor.random(1, 1)
|
|
209
|
+
b = tensor.zeros(1, 1)
|
|
210
|
+
lr = 0.01
|
|
211
|
+
|
|
212
|
+
## Training Loop
|
|
213
|
+
each epoch within upto(100):
|
|
214
|
+
## Forward pass
|
|
215
|
+
y_pred = x.matmul(w) + b
|
|
216
|
+
|
|
217
|
+
## MSE Loss
|
|
218
|
+
diff = y_pred - y
|
|
219
|
+
loss = (diff * diff).mean()
|
|
220
|
+
|
|
221
|
+
## Manual Gradients
|
|
222
|
+
grad_w = x.transpose().matmul(diff) * 0.02
|
|
223
|
+
grad_b = diff.mean() * 2.0
|
|
224
|
+
|
|
225
|
+
## Update
|
|
226
|
+
w = w - grad_w * lr
|
|
227
|
+
b = b - grad_b * lr
|
|
228
|
+
|
|
229
|
+
show("Learned w: {w}, b: {b}")
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
---
|
|
233
|
+
|
|
234
|
+
## Built-In Standard Libraries
|
|
235
|
+
|
|
236
|
+
Neuron comes batteries-included with AI primitives:
|
|
237
|
+
* `tensor` - Tensors and math operations
|
|
238
|
+
* `neural` - Neural network layers (Dense, Conv2d, ReLU, Softmax)
|
|
239
|
+
* `optim` - Optimizers (SGD, Adam)
|
|
240
|
+
* `data` - Data loading and batching
|
|
241
|
+
* `vision` / `nlp` - Image processing and text tokenization
|
|
242
|
+
* `metrics` - Accuracy, MSE, MAE
|
|
243
|
+
* `plot` - Easy data visualization
|
|
244
|
+
|
|
245
|
+
## Compiler and Runtime Status
|
|
246
|
+
|
|
247
|
+
Neuron currently uses a Python interpreter and a Python bytecode compiler. `.nlc` files are Python-pickled bytecode chunks; they are not yet a standalone executable format or a native VM. The shape-analysis pass is an initial compiler foundation, not a native tensor type system.
|
|
248
|
+
|
|
249
|
+
Native CPU/CUDA memory management and GIL-free execution, a linear quantum type checker, hybrid parameter-shift training, OpenQASM 3 code generation, and IBM Quantum Runtime submission are not implemented yet. They require separate compiler/runtime modules and explicit circuit syntax and ownership rules; no claim of hardware support is made by this release.
|
|
250
|
+
|
|
251
|
+
---
|
|
252
|
+
*Created by the Neuron Developer Community*
|
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
# Neuron Language
|
|
2
|
+
|
|
3
|
+
> The AI-First Programming Language. Built for humans, designed for Machine Learning.
|
|
4
|
+
|
|
5
|
+
Neuron (`.nl`) is a high-level, Python-like, OOP-based programming language built from the ground up for Artificial Intelligence training, tensors, and neural networks. It features a clean, English-like syntax that replaces traditional programming keywords with intuitive verbs.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
You can install Neuron directly from PyPI on any Windows, Mac, or Linux machine:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
pip install neuron-lang
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## Running Code
|
|
20
|
+
|
|
21
|
+
Once installed, you can use the `neuron` command to run files, compile them, or start the interactive REPL.
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
# Start the interactive coding environment
|
|
25
|
+
neuron
|
|
26
|
+
|
|
27
|
+
# Run a Neuron script
|
|
28
|
+
neuron run my_script.nl
|
|
29
|
+
|
|
30
|
+
# Compile for faster future execution
|
|
31
|
+
neuron compile my_script.nl
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
## Package Manager (Auto-Install!)
|
|
37
|
+
|
|
38
|
+
Neuron has built-in integration with the entire Python ecosystem. Any Python library (NumPy, Pandas, TensorFlow, PyTorch) can be used in Neuron!
|
|
39
|
+
|
|
40
|
+
If you `grab` a library that isn't installed, **Neuron will automatically install it for you in the background!**
|
|
41
|
+
|
|
42
|
+
```neuron
|
|
43
|
+
## If pandas isn't installed, Neuron auto-installs it and imports it!
|
|
44
|
+
grab pandas
|
|
45
|
+
|
|
46
|
+
## You can also explicitly manage packages via the CLI:
|
|
47
|
+
# neuron get scikit-learn
|
|
48
|
+
# neuron packages
|
|
49
|
+
# neuron remove pandas
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
## Language Syntax & Features
|
|
55
|
+
|
|
56
|
+
Neuron uses natural language keywords to make coding more intuitive.
|
|
57
|
+
|
|
58
|
+
### Variables & Printing
|
|
59
|
+
```neuron
|
|
60
|
+
## Variables don't need type declarations
|
|
61
|
+
name = "AI Builder"
|
|
62
|
+
version = 1.0
|
|
63
|
+
|
|
64
|
+
## String interpolation uses {brackets}
|
|
65
|
+
show("Welcome {name} to Neuron v{version}!")
|
|
66
|
+
|
|
67
|
+
## Ask for user input
|
|
68
|
+
user = ask("What is your name? ")
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### Functions
|
|
72
|
+
Use `do` to define a function, and `give` to return a value.
|
|
73
|
+
|
|
74
|
+
```neuron
|
|
75
|
+
do add_numbers(x, y):
|
|
76
|
+
result = x + y
|
|
77
|
+
give result
|
|
78
|
+
|
|
79
|
+
show(add_numbers(10, 5)) ## Output: 15
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Conditions
|
|
83
|
+
Neuron replaces `if/elif/else` with `when/orwhen/otherwise`.
|
|
84
|
+
|
|
85
|
+
```neuron
|
|
86
|
+
age = 20
|
|
87
|
+
|
|
88
|
+
when age < 18:
|
|
89
|
+
show("Too young!")
|
|
90
|
+
orwhen age == 18:
|
|
91
|
+
show("Just right!")
|
|
92
|
+
otherwise:
|
|
93
|
+
show("Welcome!")
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### Loops
|
|
97
|
+
Neuron features a powerful `each ... within` loop construct.
|
|
98
|
+
|
|
99
|
+
```neuron
|
|
100
|
+
## Loop through a list
|
|
101
|
+
each item within [1, 2, 3]:
|
|
102
|
+
show(item)
|
|
103
|
+
|
|
104
|
+
## Loop through a range using upto()
|
|
105
|
+
each i within upto(5):
|
|
106
|
+
show(i) ## Outputs 0, 1, 2, 3, 4
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### The Pipeline Operator `|>`
|
|
110
|
+
Easily chain function calls together reading left-to-right!
|
|
111
|
+
|
|
112
|
+
```neuron
|
|
113
|
+
do double(x):
|
|
114
|
+
give x * 2
|
|
115
|
+
|
|
116
|
+
do add_ten(x):
|
|
117
|
+
give x + 10
|
|
118
|
+
|
|
119
|
+
## Passes 5 into double(), then passes the result into add_ten()
|
|
120
|
+
result = 5 |> double |> add_ten
|
|
121
|
+
show(result) ## Output: 20
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
---
|
|
125
|
+
|
|
126
|
+
## Object-Oriented Programming (OOP)
|
|
127
|
+
|
|
128
|
+
Neuron uses `entity` instead of `class`, and `me` instead of `self` or `this`.
|
|
129
|
+
|
|
130
|
+
```neuron
|
|
131
|
+
entity Animal:
|
|
132
|
+
do create(me, name):
|
|
133
|
+
me.name = name
|
|
134
|
+
|
|
135
|
+
do speak(me):
|
|
136
|
+
show("{me.name} makes a sound.")
|
|
137
|
+
|
|
138
|
+
## Inheritance using 'from'
|
|
139
|
+
entity Dog from Animal:
|
|
140
|
+
do speak(me):
|
|
141
|
+
show("{me.name} says Woof!")
|
|
142
|
+
|
|
143
|
+
buddy = Dog("Buddy")
|
|
144
|
+
buddy.speak() ## Output: Buddy says Woof!
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
---
|
|
148
|
+
|
|
149
|
+
## AI-Native Features (`brain`)
|
|
150
|
+
|
|
151
|
+
Neuron has a special class type called `brain` specifically for AI models. Brains automatically have `train()`, `predict()`, and `save()` functionalities built-in.
|
|
152
|
+
|
|
153
|
+
```neuron
|
|
154
|
+
grab neural
|
|
155
|
+
|
|
156
|
+
brain MyNet:
|
|
157
|
+
do create(me):
|
|
158
|
+
me.add_layer(neural.Dense(128))
|
|
159
|
+
me.add_layer(neural.ReLU())
|
|
160
|
+
me.add_layer(neural.Dense(10))
|
|
161
|
+
|
|
162
|
+
model = MyNet()
|
|
163
|
+
show(model.status) ## Output: NOT TRAINED
|
|
164
|
+
model.train(data)
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
---
|
|
168
|
+
|
|
169
|
+
## Tensors and Deep Learning
|
|
170
|
+
|
|
171
|
+
Neuron ships with a built-in standard library for tensors (`tensor`) with automatic differentiation (Autograd) for building neural networks from scratch.
|
|
172
|
+
|
|
173
|
+
### Compile-Time Shape Checks
|
|
174
|
+
|
|
175
|
+
The compiler and interpreter check statically known tensor shapes before running a program. Use a typed tensor declaration to declare an expected shape:
|
|
176
|
+
|
|
177
|
+
```neuron
|
|
178
|
+
grab tensor
|
|
179
|
+
|
|
180
|
+
tensor[100, 784] x = tensor.random(100, 784)
|
|
181
|
+
tensor[784, 10] w = tensor.random(784, 10)
|
|
182
|
+
tensor[100, 10] y = x.matmul(w)
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
The current analysis infers shapes from `tensor.random`, `tensor.rand`, `tensor.zeros`, and `tensor.ones`, propagates them through assignments, and checks rank-2 `matmul` and elementwise broadcasting. It reports a compile error when a known result conflicts with a declaration or matrix dimensions do not align. Shapes that cannot be inferred statically are left for runtime validation.
|
|
186
|
+
|
|
187
|
+
### Linear Regression Example
|
|
188
|
+
```neuron
|
|
189
|
+
grab tensor
|
|
190
|
+
|
|
191
|
+
## Generate Data
|
|
192
|
+
x = tensor.random(100, 1)
|
|
193
|
+
y = x * 3.0 + 2.0
|
|
194
|
+
|
|
195
|
+
## Weights
|
|
196
|
+
w = tensor.random(1, 1)
|
|
197
|
+
b = tensor.zeros(1, 1)
|
|
198
|
+
lr = 0.01
|
|
199
|
+
|
|
200
|
+
## Training Loop
|
|
201
|
+
each epoch within upto(100):
|
|
202
|
+
## Forward pass
|
|
203
|
+
y_pred = x.matmul(w) + b
|
|
204
|
+
|
|
205
|
+
## MSE Loss
|
|
206
|
+
diff = y_pred - y
|
|
207
|
+
loss = (diff * diff).mean()
|
|
208
|
+
|
|
209
|
+
## Manual Gradients
|
|
210
|
+
grad_w = x.transpose().matmul(diff) * 0.02
|
|
211
|
+
grad_b = diff.mean() * 2.0
|
|
212
|
+
|
|
213
|
+
## Update
|
|
214
|
+
w = w - grad_w * lr
|
|
215
|
+
b = b - grad_b * lr
|
|
216
|
+
|
|
217
|
+
show("Learned w: {w}, b: {b}")
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
---
|
|
221
|
+
|
|
222
|
+
## Built-In Standard Libraries
|
|
223
|
+
|
|
224
|
+
Neuron comes batteries-included with AI primitives:
|
|
225
|
+
* `tensor` - Tensors and math operations
|
|
226
|
+
* `neural` - Neural network layers (Dense, Conv2d, ReLU, Softmax)
|
|
227
|
+
* `optim` - Optimizers (SGD, Adam)
|
|
228
|
+
* `data` - Data loading and batching
|
|
229
|
+
* `vision` / `nlp` - Image processing and text tokenization
|
|
230
|
+
* `metrics` - Accuracy, MSE, MAE
|
|
231
|
+
* `plot` - Easy data visualization
|
|
232
|
+
|
|
233
|
+
## Compiler and Runtime Status
|
|
234
|
+
|
|
235
|
+
Neuron currently uses a Python interpreter and a Python bytecode compiler. `.nlc` files are Python-pickled bytecode chunks; they are not yet a standalone executable format or a native VM. The shape-analysis pass is an initial compiler foundation, not a native tensor type system.
|
|
236
|
+
|
|
237
|
+
Native CPU/CUDA memory management and GIL-free execution, a linear quantum type checker, hybrid parameter-shift training, OpenQASM 3 code generation, and IBM Quantum Runtime submission are not implemented yet. They require separate compiler/runtime modules and explicit circuit syntax and ownership rules; no claim of hardware support is made by this release.
|
|
238
|
+
|
|
239
|
+
---
|
|
240
|
+
*Created by the Neuron Developer Community*
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Neuron Programming Language
|
|
3
|
+
===========================
|
|
4
|
+
A Python-like, OOP-based programming language purpose-built for
|
|
5
|
+
Artificial Intelligence development.
|
|
6
|
+
|
|
7
|
+
File extension: .nl
|
|
8
|
+
Website: https://neuron-lang.org (coming soon)
|
|
9
|
+
|
|
10
|
+
Keywords: do, give, show, ask, when, orwhen, otherwise, each,
|
|
11
|
+
repeat, grab, entity, brain, me, create, yes, no,
|
|
12
|
+
nothing, also, either, nah, safe, rescue, stop, skip,
|
|
13
|
+
quick, within, drop, ensure, emit, shared, from, upto
|
|
14
|
+
"""
|
|
15
|
+
|
|
16
|
+
__version__ = "1.0.1"
|
|
17
|
+
__author__ = "Neuron Language Team"
|
|
18
|
+
__license__ = "MIT"
|