• Stars
    star
    172
  • Rank 221,201 (Top 5 %)
  • Language
    Go
  • License
    GNU General Publi...
  • Created almost 2 years ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A Swahili Programming Language built from the ground up

NURUπŸ”₯PROGRAMMINGπŸ”₯LANGUAGE

Nuru Programming Language Nuru Programming Language Nuru Programming Language
Nuru Programming Language Nuru Programming Language Nuru Programming Language
Nuru Programming Language

A Swahili Programming Language of its kind built from the ground up.

Installation

To get started download the executables from the release page or follow the instructions for your device below:

Linux

  • Download the binary:
curl -O -L https://github.com/AvicennaJr/Nuru/releases/download/v0.5.0-alpha/nuru_linux_amd64_v0.5.0-alpha.tar.gz
  • Extract the file to make global available:
sudo tar -C /usr/local/bin -xzvf nuru_linux_amd64_v0.5.0-alpha.tar.gz
  • Confirm installation with:
nuru -v

Android (Termux)

  • Make sure you have Termux installed.
  • Download the binary with this command:
curl -O -L https://github.com/AvicennaJr/Nuru/releases/download/v0.5.0-alpha/nuru_android_arm64_v0.5.0-alpha.tar.gz
  • Extract the file:
tar -xzvf nuru_android_arm64_v0.5.0-alpha.tar.gz
  • Add it to path:
echo "alias nuru='~/nuru'" >> .bashrc
  • Confirm installation with:
nuru -v 

Windows

  • Executable:

    • Download the Nuru executable Here
    • Double click the executable
  • Nuru Installer

    Coming Soon

Building From Source

  • Make sure you have golang installed
  • Run the following command:
go build -o nuru main.go
  • You can optionally add the binary to $PATH as shown above
  • Confirm installtion with:
nuru -v

Syntax At A Glance

NOTE

There is a more detailed documentation of the language here.

Nuru, although still in its early stage, intends to be a fully functional programming language, and thus it has been baked with many features.

Defining A Variable

You can define variables like this:

x = 2;
y = 3;

andika(x*y) // output is 6

You can also use the fanya keyword to define a variabe:

fanya x = 3

Note that fanya keyword is OPTIONAL

Comments

Nuru supports both single line and multiple line comments as shown below:

// Single line comment

/*
Multiple
Line
Comment 
*/ 

Arithmetic Operations

For now Nuru supports +, -, /, * and %. Nuru also provides precedence of operations using the BODMAS rule:

2 + 2 * 3 // output = 8

2 * (2 + 3) // output = 10

Types

Nuru has the following types:

Type Syntax Comments
BOOL kweli sikweli kweli == true, sikweli == false
INT 1, 100, 342, -4 These are signed 64 bit integers
FLOAT 2.3, 4.5. 100.8094 Signed 64 bit floats
STRING "" "mambo" "habari yako" They can be in double " or single ' quotes
ARRAY [] [1, 2, 3] [1, "moja", kweli] Arrays can hold any types
DICT {} {"a": 3, 1: "moja", kweli: 2} Keys can be int, string or bool. Values can be anything
NULL tupu These are nil objects

Functions

This is how you define a function in Nuru:

jumlisha = unda(x, y) {
        rudisha x + y
    }

andika(jumlisha(3,4))

Nuru also supports recursion:

fibo = unda(x) {
	kama (x == 0) {
		rudisha 0;
	} au kama (x == 1) {
			rudisha 1;
	} sivyo {
			rudisha fibo(x - 1) + fibo(x - 2);
	}
}

If Statements

Nuru supports if, elif and else statements with keywords kama, au kama and sivyo respectively:

kama (2<1) {
    andika("Mbili ni ndogo kuliko moja")
} au kama (3 < 1) {
    andika ("Tatu ni ndogo kuliko moja")
} sivyo {
    andika("Moja ni ndogo")
}

While Loops

Nuru's while loop syntax is as follows:

i = 10

wakati (i > 0) {
	andika(i)
	i--
}

Arrays

This is how you initiliaze and perform other array operations in Nuru:

arr = []

// To add elements

sukuma(arr, 2)
andika(arr) // output = [2]
// Add two Arrays

arr2 = [1,2,3,4]

arr3 = arr1 + arr2

andika(arr3) // output = [2,1,2,3,4]

// reassign value

arr3[0] = 0

andika[arr3] // output = [0,1,2,3,4]

// get specific item

andika(arr[3]) // output = 3

Dictionaries

Nuru also supports dictionaries and you can do a lot with them as follows:

mtu = {"jina": "Mojo", "kabila": "Mnyakusa"}

// get value from key 
andika(mtu["jina"]) // output = Mojo

andika(mtu["kabila"]); // output = Mnyakusa

// You can reassign values

mtu["jina"] = "Avicenna"

andika(mtu["jina"]) // output = Avicenna

// You can also add new values like this:

mtu["anapoishi"] = "Dar Es Salaam"

andika(mtu) // output = {"jina": "Avicenna", "kabila": "Mnyakusa", "anapoishi": "Dar Es Salaam"}

// You can also add two Dictionaries

kazi = {"kazi": "jambazi"}

mtu = mtu + kazi

andika(mtu) // output = {"jina": "Avicenna", "kabila": "Mnyakusa", "anapoishi": "Dar Es Salaam", "kazi": "jambazi"}

For Loops

These can iterate over strings, arrays and dictionaries:

kwa i ktk "habari" {
    andika(i)
}
/* //output
h
a
b
a
r
i
*/

Getting Input From User

In Nuru you can get input from users using the jaza() keyword as follows:

jina = jaza("Unaitwa nani? ") // will prompt for input

andika("Habari yako " + jina)

How To Run

Using The Intepreter:

You can enter the intepreter by simply running the nuru command:

nuru
>>> andika("karibu")
karibu
>>> 2 + 2
4

Kindly Note that everything should be placed in a single line. Here's an example:

>>> kama (x > y) {andika("X ni kubwa")} sivyo {andika("Y ni kubwa")}

Running From File

To run a Nuru script, write the nuru command followed by the name of the file with a .nr or .sw extension:

nuru myFile.nr

Issues

Kindly open an Issue to make suggestions and anything else.

Contributions

Documentation

There are documentations for two languages, English and Kiswahili, which are both under the docs folder. All files are written in markdown. Feel free to contribute by making a pull request.

Code

Clone the repo, hack it, make sure all tests are passing then submit a pull request.

Community

Nuru has a passionate community, join us on Telegram

License

MIT

Authors

Nuru Programming Language has been authored and being actively maintained by Avicenna

More Repositories

1

ShellMate

Your very own terminal AI assisstant πŸ€–
Go
21
star
2

themuslimbot

A Telegram Bot made for Muslims ❀️
Python
10
star
3

Not-Paid-Django

Client did not pay? No problem. Add opacity to the body tag and decrease it every day until their site completely fades away.
Python
5
star
4

NuruDocs

Documentation for Nuru programming language
5
star
5

Nuru-VSCode

VS Code Extension For Nuru
4
star
6

GolangTZBot

A Telegram Bot for the Golang Tanzania Groupchat
Go
3
star
7

Telegram2Drive

Python
3
star
8

simple_tcp_chat

A simple chat app made with python
Python
3
star
9

APITestingBot

A Telegram bot to help devs test API endpoints
Python
3
star
10

tiktok_downloader

Python
3
star
11

Snippity

Reading the book Let's Go
Go
2
star
12

flappy_farax

GDScript
2
star
13

isEven

A golang package that checks whether a number is even or odd
Go
2
star
14

Golang-Learning

Documenting Our Journey on Learning Go
Go
2
star
15

twitter_for_chads

Twitter app made for Real Men
Python
2
star
16

chatApp

A simple chat app made with Go
Go
2
star
17

AvicennaJr

2
star
18

Golang-Exercism-Solutions

A collection of my attempts to solve different golang exercies
Go
2
star
19

youtube_downloader_bot

Python
2
star
20

MardownMapper

A script to generate to generate table of contents from markdown files
Go
2
star
21

simple_screen_recorder

A Screen Recorder made with Python
Python
2
star
22

khat_man

GDScript
2
star
23

Puzzle-Bot

A Telegram Puzzle Bot
Python
1
star
24

Maneno

A Swahili CLI wordle game
Go
1
star
25

eLearningPlatform

Practicing advanced django concepts by creating an eLearning Platform
Python
1
star
26

hello_c

First C program
C
1
star
27

prime_c

A C program that determines whether a positive interger is a prime number or not
C
1
star
28

PyFDISMS

A python wrapper for interacting with FDI SMS API
Python
1
star
29

my_configs

Lua
1
star
30

jopher

A simple go tool that prints jokes
Go
1
star
31

simple-go-bot

Go
1
star
32

echo-bot-nim

Nim
1
star
33

hello_julia

Got a bit interested in this language
Julia
1
star
34

hello_go

Hello Golang
Go
1
star
35

diskUsage

A simple program to determine folder and file sizes
Go
1
star
36

simple_banking_function

A banking function written in Julia that can calculate Interest (Haaram I know) and service charge.
Julia
1
star
37

Ze-Buttler

An AI Notification System
Go
1
star
38

hello_world

Python
1
star
39

CLI-Todo

A blazingly fast command line ToDo app built with Go
Go
1
star
40

random_number_generator

A simple mobile app made with Python (Kivy) that generates random numbers
kvlang
1
star
41

Quick-MP4-Downloader

A simple script to download mp4 files from the internet
Python
1
star
42

Giggity

Reading the book Let's Go Further
Go
1
star
43

Go-Word-Counter

A tool to count the number of words in a file. Made with Go.
Go
1
star
44

party-invite

A simple web app made with golang
HTML
1
star
45

hello_java

Hello Java
Java
1
star
46

hacking_prank

A credit card prank I made to scare a friend
Python
1
star
47

hello-zig

A hello world program in Zig
Zig
1
star
48

Ultimate-Engineering-Bot

A telegram bot that can solve various mathematical and engineering problems
Python
1
star
49

echo_number_c

Simply displays the number you enter
C
1
star
50

simple_api

A simple API made with FastAPI
Python
1
star
51

Blinky

A simple LED blinking program that can be used in microcontrollers
Go
1
star
52

MKBSD

Download all the wallpapers in MKBHD's "Panels" app
Go
1
star