@@ -18,90 +18,94 @@ To get started download the executables from the release page or follow the inst
18
18
19
19
### Linux
20
20
21
- - Download the binary:
21
+ - Download the binary:
22
22
23
23
```
24
24
curl -O -L https://github.com/NuruProgramming/Nuru/releases/download/v0.5.17/nuru_Linux_amd64.tar.gz
25
25
```
26
26
27
- - Extract the file to make global available:
27
+ - Extract the file to make global available:
28
28
29
29
```
30
30
sudo tar -C /usr/local/bin -xzvf nuru_Linux_amd64.tar.gz
31
31
```
32
32
33
- - Confirm installation with:
33
+ - Confirm installation with:
34
34
35
35
```
36
36
nuru -v
37
37
```
38
38
39
-
40
39
### MacOs ( Apple silicon Mac )
41
40
42
- - Download the binary:
41
+ - Download the binary:
43
42
44
- - For apple silicon mac use:
43
+ - For apple silicon mac use:
45
44
46
- ```
47
- curl -O -L https://github.com/NuruProgramming/Nuru/releases/download/v0.5.17/nuru_Darwin_arm64.tar.gz
48
- ```
45
+ ```
46
+ curl -O -L https://github.com/NuruProgramming/Nuru/releases/download/v0.5.17/nuru_Darwin_arm64.tar.gz
47
+ ```
49
48
50
- - For apple intel mac use:
49
+ - For apple intel mac use:
51
50
52
- ```
53
- curl -O -L https://github.com/NuruProgramming/Nuru/releases/download/v0.5.17/nuru_Darwin_amd64.tar.gz
54
- ```
51
+ ```
52
+ curl -O -L https://github.com/NuruProgramming/Nuru/releases/download/v0.5.17/nuru_Darwin_amd64.tar.gz
53
+ ```
55
54
56
55
- Extract the file to make global available:
57
- - For apple silicon mac use:
58
56
59
- ```
60
- sudo tar -C /usr/local/bin -xzvf nuru_Darwin_arm64.tar.gz
61
- ```
62
- - For apple intel mac use:
57
+ - For apple silicon mac use:
58
+
59
+ ```
60
+ sudo tar -C /usr/local/bin -xzvf nuru_Darwin_arm64.tar.gz
61
+ ```
62
+
63
+ - For apple intel mac use:
63
64
64
- ```
65
- sudo tar -C /usr/local/bin -xzvf nuru_Darwin_amd64.tar.gz
66
- ```
65
+ ```
66
+ sudo tar -C /usr/local/bin -xzvf nuru_Darwin_amd64.tar.gz
67
+ ```
67
68
68
69
- Confirm installation with:
69
70
70
71
```
71
72
nuru -v
72
73
```
73
74
74
-
75
-
76
-
77
75
### Android (Termux)
78
76
79
77
To install Nuru on your Android device using Termux, follow these steps:
80
78
81
79
1. **Ensure Termux is installed**:
80
+
82
81
- You can download and install [Termux](https://f-droid.org/en/packages/com.termux/).
83
82
84
83
2. **Create the target directory**:
84
+
85
85
```bash
86
86
mkdir -p /data/data/com.termux/files/usr/share/nuru
87
87
```
88
88
89
89
3 . ** Download the Nuru package** :
90
+
90
91
``` bash
91
92
curl -O -L https://github.com/NuruProgramming/Nuru/releases/download/v0.5.17/nuru_Android_arm64.tar.gz
92
93
```
93
94
94
95
4 . ** Extract the files to the target directory** :
96
+
95
97
``` bash
96
98
tar -xzvf nuru_Android_arm64.tar.gz -C /data/data/com.termux/files/usr/share/nuru
97
99
```
98
100
99
101
5 . ** Set up an alias for easy access** :
102
+
100
103
``` bash
101
104
echo " alias nuru='/data/data/com.termux/files/usr/share/nuru/nuru'" >> ~ /.bashrc
102
105
```
103
106
104
107
6 . ** Reload the .bashrc file to apply the alias** :
108
+
105
109
``` bash
106
110
source ~ /.bashrc
107
111
```
@@ -117,27 +121,33 @@ For a more streamlined installation, you can use the following one-liner:
117
121
curl -O -L https://github.com/NuruProgramming/Nuru/releases/download/v0.5.17/nuru_Android_arm64.tar.gz && mkdir -p /data/data/com.termux/files/usr/share/nuru && tar -xzvf nuru_Android_arm64.tar.gz -C /data/data/com.termux/files/usr/share/nuru && echo " alias nuru='/data/data/com.termux/files/usr/share/nuru/nuru'" >> ~ /.bashrc && source ~ /.bashrc && echo " Installation complete.."
118
122
```
119
123
120
-
121
124
### Windows
122
125
123
126
- Executable:
124
- - Download the Nuru zip file [ Here] ( https://github.com/NuruProgramming/Nuru/releases/download/v0.5.17/nuru_Windows_amd64.zip )
125
- - Unzip to get the executable
126
- - Double click the executable
127
+
128
+ - Download the Nuru zip file [ Here] ( https://github.com/NuruProgramming/Nuru/releases/download/v0.5.17/nuru_Windows_amd64.zip )
129
+ - Unzip to get the executable
130
+ - Double click the executable
127
131
128
132
- Nuru Installer
129
- > Coming Soon
133
+ > Coming Soon
130
134
131
135
### Building From Source
132
136
133
- - Make sure you have golang installed (atleast 1.19.0 and above)
134
- - Run the following command:
137
+ - Make sure you have golang installed (atleast 1.19.0 and above)
138
+ - Run the following command:
135
139
136
140
```
137
- go build -o nuru main.go
141
+ go build -o nuru .
138
142
```
139
- - You can optionally add the binary to $PATH as shown above
140
- - Confirm installtion with:
143
+
144
+ - Copy nuru binary to path destination ~ /go/bin
145
+
146
+ ```
147
+ cp nuru ~/go/bin
148
+ ```
149
+
150
+ - Confirm installtion with:
141
151
142
152
```
143
153
nuru -v
@@ -146,6 +156,7 @@ nuru -v
146
156
## Syntax At A Glance
147
157
148
158
** NOTE**
159
+
149
160
> There is a more detailed documentation of the language [ here] ( https://nuruprogramming.org ) .
150
161
151
162
Nuru, although still in its early stage, intends to be a fully functional programming language, and thus it has been baked with many features.
@@ -160,10 +171,13 @@ y = 3;
160
171
161
172
andika(x*y) // output is 6
162
173
```
174
+
163
175
You can also use the ` fanya ` keyword to define a variabe:
176
+
164
177
```
165
178
fanya x = 3
166
179
```
180
+
167
181
** Note that ` fanya ` keyword is OPTIONAL**
168
182
169
183
### Comments
@@ -194,15 +208,15 @@ For now Nuru supports `+`, `-`, `/`, `*` and `%`. Nuru also provides precedence
194
208
195
209
Nuru has the following types:
196
210
197
- Type | Syntax | Comments
198
- --------- | ----------------------------------------- | -----------------------
199
- BOOL | ` kweli sikweli ` | kweli == true, sikweli == false
200
- INT | ` 1, 100, 342, -4 ` | These are signed 64 bit integers
201
- FLOAT | ` 2.3, 4.5. 100.8094 ` | Signed 64 bit floats
202
- STRING | ` "" "mambo" "habari yako" ` | They can be in double ` " ` or single ` ' ` quotes
203
- ARRAY | ` [] [1, 2, 3] [1, "moja", kweli] ` | Arrays can hold any types
204
- DICT | ` {} {"a": 3, 1: "moja", kweli: 2} ` | Keys can be int, string or bool. Values can be anything
205
- NULL | ` tupu ` | These are nil objects
211
+ | Type | Syntax | Comments |
212
+ | ------ | ---------------------------------- | ------------------------------------------------------- |
213
+ | BOOL | ` kweli sikweli ` | kweli == true, sikweli == false |
214
+ | INT | ` 1, 100, 342, -4 ` | These are signed 64 bit integers |
215
+ | FLOAT | ` 2.3, 4.5. 100.8094 ` | Signed 64 bit floats |
216
+ | STRING | ` "" "mambo" "habari yako" ` | They can be in double ` " ` or single ` ' ` quotes |
217
+ | ARRAY | ` [] [1, 2, 3] [1, "moja", kweli] ` | Arrays can hold any types |
218
+ | DICT | ` {} {"a": 3, 1: "moja", kweli: 2} ` | Keys can be int, string or bool. Values can be anything |
219
+ | NULL | ` tupu ` | These are nil objects |
206
220
207
221
### Functions
208
222
@@ -260,6 +274,7 @@ wakati (i > 0) {
260
274
### Arrays
261
275
262
276
This is how you initiliaze and perform other array operations in Nuru:
277
+
263
278
```
264
279
arr = []
265
280
@@ -289,6 +304,7 @@ andika(arr[3]) // output = 3
289
304
### Dictionaries
290
305
291
306
Nuru also supports dictionaries and you can do a lot with them as follows:
307
+
292
308
```
293
309
mtu = {"jina": "Mojo", "kabila": "Mnyakusa"}
294
310
@@ -321,6 +337,7 @@ andika(mtu) // output = {"jina": "Avicenna", "kabila": "Mnyakusa", "anapoishi":
321
337
### For Loops
322
338
323
339
These can iterate over strings, arrays and dictionaries:
340
+
324
341
```
325
342
kwa i ktk "habari" {
326
343
andika(i)
338
355
### Getting Input From User
339
356
340
357
In Nuru you can get input from users using the ` jaza() ` keyword as follows:
358
+
341
359
```
342
360
jina = jaza("Unaitwa nani? ") // will prompt for input
343
361
@@ -349,17 +367,21 @@ andika("Habari yako " + jina)
349
367
### Using The Intepreter:
350
368
351
369
You can enter the intepreter by simply running the ` nuru ` command:
370
+
352
371
```
353
372
nuru
354
373
>>> andika("karibu")
355
374
karibu
356
375
>>> 2 + 2
357
376
4
358
377
```
378
+
359
379
Kindly Note that everything should be placed in a single line. Here's an example:
380
+
360
381
```
361
382
>>> kama (x > y) {andika("X ni kubwa")} sivyo {andika("Y ni kubwa")}
362
383
```
384
+
363
385
### Running From File
364
386
365
387
To run a Nuru script, write the ` nuru ` command followed by the name of the file with a ` .nr ` or ` .sw ` extension:
@@ -382,7 +404,7 @@ There are documentations for two languages, English and Kiswahili, which are bot
382
404
383
405
Clone the repo, hack it, make sure all tests are passing then submit a pull request.
384
406
385
- > Make sure ALL tests are passing before making a pull request. You can confirm with running ` make tests `
407
+ > Make sure ALL tests are passing before making a pull request. You can confirm with running ` make tests `
386
408
387
409
## Community
388
410
0 commit comments