Coder Social home page Coder Social logo

nuruprogramming / nuru Goto Github PK

View Code? Open in Web Editor NEW
185.0 9.0 31.0 12.41 MB

A Swahili Programming Language built from the ground up

Home Page: https://nuruprogramming.org

License: GNU General Public License v2.0

Go 98.61% Makefile 0.69% Vim Script 0.70%
nuru programing-language swahili hacktoberfest

nuru's People

Contributors

avicennajr avatar baharajr avatar borwe avatar farajael avatar gabriel-dee avatar gekkowrld avatar hopertz avatar isaka-james avatar karimnyumba avatar kdaxh avatar lupyana avatar victorkariuki avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nuru's Issues

Incorrect Installation Guide for Nuru on Termux

Issue Description:

The current installation guide for Nuru on Termux contains incorrect instructions that do not align with Termux's environment and file structure. The following issues have been identified:

  1. Incorrect .bashrc File Path:

    • The guide suggests adding the nuru alias to ~/.bashrc, which is not valid for Termux. Instead, the correct file to edit is /data/data/com.termux/files/usr/etc/bash.bashrc.
  2. Inappropriate Installation Directory:

    • The guide places the Nuru binary in the home directory (~/nuru), which is not recommended for Termux. It is better to place executable files in /data/data/com.termux/files/usr/share to adhere to Termux's file system standards.

Steps to Reproduce:

  1. Follow the current installation instructions in the guide:
    curl -O -L https://github.com/AvicennaJr/Nuru/releases/download/v0.5.16/nuru_Android_arm64.tar.gz
    tar -xzvf nuru_Android_arm64.tar.gz
    echo "alias nuru='~/nuru'" >> .bashrc
    nuru -v
  2. Attempt to run nuru -v to confirm the installation.

Expected Behavior:

The nuru command should work and display the version information.

Actual Behavior:

The nuru command is not found because the alias is not set correctly in Termux.

Suggested Fix:

  1. Download and extract the binary:
    curl -O -L https://github.com/AvicennaJr/Nuru/releases/download/v0.5.16/nuru_Android_arm64.tar.gz
    tar -xzvf nuru_Android_arm64.tar.gz
  2. Move the extracted binary to the appropriate directory:
    mv nuru /data/data/com.termux/files/usr/share/
  3. Add the alias to the correct bash configuration file:
    echo "alias nuru='/data/data/com.termux/files/usr/share/nuru'" >> /data/data/com.termux/files/usr/etc/bash.bashrc
    source /data/data/com.termux/files/usr/etc/bash.bashrc
  4. Confirm the installation with:
    nuru -v

These changes ensure that the Nuru binary is correctly added to the environment variables in Termux and that the executable is placed in a recommended directory.

Thank you for your attention to this matter.

Add support for shebang in nuru

Describe the feature

shebang is a unix feature that is most of the scripting languages:

https://en.wikipedia.org//wiki/Shebang_(Unix)

Use Case

It will be nice to just execute the scripts without explicitly invoking the nuru interpreter every time.

Proposed Solution

Look at the first line and ignore if it starts with '#!' specifically, look at how it works as explained in the question on StackOverflow about shebang and its implementation in the linux kernel.

If the 'shebang' appears on any other line, then throw an error.

Other Information

No response

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

Version used

v0.5.1 (commit id f0fe309)

Environment details (OS name and version, etc.)

Linux 6.9.3-hardened1-1-hardened
go version go1.22.3 linux/amd64

To Do:

Add/Fix these modules before next release:

  • Time module
  • OS module
  • File module
  • JSON module
  • Net module
  • English documentation

Support for various numeral systems

Describe the feature

Currently, we only have support for the base 10 numeral system but it would be cool to support other systems like Hexadecimal numbers for example.

Use Case

Low-Level Programming
In systems programming or when working with hardware, hexadecimal and binary representations are often used to specify memory addresses, bit patterns, and control registers.

Data Encoding and Decoding:
When dealing with data formats like binary, hexadecimal, or base64, the ability to convert between numeral systems is crucial for tasks such as data serialization, deserialization, and encoding/decoding.

Cryptography:
Cryptographic algorithms often require working with binary data and performing bitwise operations.

Network Programming:
Network protocols like IP addresses and MAC addresses are often represented in hexadecimal notation.

Mathematics Applications:
In mathematical applications, different numeral systems might be used to represent numbers or perform specific calculations.

Educational Purposes:
Teaching programming and computer science concepts can benefit from exposing students to different numeral systems. It helps in understanding how computers store and manipulate data.

Custom Base Number Systems:
Some specialized applications may require custom base number systems.

Proposed Solution

A function for converting string to a number that will take a string and a radix and return a number and if the one of the parameters are incorrect, throw an errora

Other Information

No response

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

Version used

v0.2.0

Environment details (OS name and version, etc.)

    OS: Linux 6.1 Manjaro Linux
    CPU: (8) x64 11th Gen Intel(R) Core(TM) i5-1135G7 @ 2.40GHz
    Memory: 6.19 GB / 15.31 GB
    Container: Yes
    Shell: 5.1.16 - /bin/bash

Identifiers starting with numbers allowed, but can't be used in functions

Describe the bug

image

As you can see I can create 4ft = "yolo" but I can't use it after that.

Expected Behavior

Either it shouldn't be allowed from the get go when declaring such a variable. Or if allowed then should be usable everywhere.

Current Behavior

variable is not parsed

Reproduction Steps

image

Possible Solution

Refuse to allow variables starting with numbers.

Additional Information/Context

No response

Nuru version

latest develop branch

Environment details (OS name and version, etc.)

Pop_Os(Ubuntu 22.04 LTS)

(feature request summary)

Describe the feature

The string "ni" could be used to represent the comparison operator "==" while the string "si" could be used to represent "!=".

This is similar to python's use of "is" and "is not" respectively

Use Case

This is not urgent nor is it terribly important but more swahili in my editor is better :)

Proposed Solution

No response

Other Information

No response

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

Version used

version 0.5.1

Environment details (OS name and version, etc.)

Arch Linux

Introduce a Numpy-like computational library for the Nuru programming language, tailored specifically for use in Swahili.

Describe the feature

The proposed feature is a robust and efficient numerical computation library similar to Numpy, but designed for the Nuru programming language with support for Swahili language commands and documentation. This library should include functionalities for handling arrays, matrices, linear algebra, statistical functions, and random number generation, all while providing an intuitive API for Swahili-speaking users.

Use Case

Many Swahili-speaking programmers face challenges when using existing computational libraries due to language barriers. This feature will empower users to perform advanced numerical computations without having to switch to English-based tools, fostering inclusivity and enhancing productivity.

Example:
"I'm always frustrated when I have to translate computational tasks into English while working on projects. Having a library that allows me to code in Swahili would save time and reduce errors."

Proposed Solution

API Design:

Create Swahili equivalents for common Numpy functions.
Ensure the function names and parameters are in Swahili.
Core Functionalities:

Arrays: Creation, manipulation, and operations on multi-dimensional arrays.
Linear Algebra: Matrix operations, decompositions, eigenvalues, etc.
Statistics: Mean, median, variance, standard deviation, etc.
Random Number Generation: Functions to generate random numbers, arrays, and distributions.
Documentation and Examples:

Provide comprehensive documentation in Swahili.
Include examples and tutorials to demonstrate usage.
Performance:

Optimize the library for performance to handle large datasets efficiently.
Compatibility:

Ensure compatibility with the Nuru programming environment.

Other Information

No response

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

Version used

Nuru Programming Language version v0.5.16

Environment details (OS name and version, etc.)

Operating System: Linux (Ubuntu 20.04)

Kwa loop should have a range function

Describe the feature

I have noticed that kwa loop works similarly to for loop in Python. The for loop in Python has a range function that enables you to loop through a set of code a number of times. It would also be beneficial to have this feature in Nuru to make the kwa loop even more versatile.

Use Case

To loop through a set of code a specified number of times

Proposed Solution

Kiswahili keywords could be masafa au umbali

Other Information

No response

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

Version used

v0.2.0

Environment details (OS name and version, etc.)

    OS: Linux 6.1 Manjaro Linux
    CPU: (8) x64 11th Gen Intel(R) Core(TM) i5-1135G7 @ 2.40GHz
    Memory: 6.19 GB / 15.31 GB
    Container: Yes
    Shell: 5.1.16 - /bin/bash

Sanitize input before sending it to go parser (for arithmetic parser)

Describe the bug

When I tried to do arithmetic operations with non int values, it panics and exits with SIGSEGV error.
This is the expected behaviour when using go directly, can this behaviour be mitigated.
It works with alphabets ([a-zA-Z]) and some punctuations but panics on encountering others and UTF-8 characters.

Expected Behavior

1+.
Mstari 1: Tumeshindwa kuparse .

Current Behavior

1+.
Mstari 1: Tumeshindwa kuparse .
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x20 pc=0x6f8fc7]

goroutine 1 [running]:
github.com/AvicennaJr/Nuru/evaluator.evalInfixExpression({0xc0003ee2d4, 0x1}, {0xfdb2a0, 0xc0003ee2e8}, {0x0, 0x0}, 0x1)
/tmp/nuru/evaluator/infix.go:68 +0x867
github.com/AvicennaJr/Nuru/evaluator.Eval({0xfdb548?, 0xc00058e120}, 0xc00041b000)
/tmp/nuru/evaluator/evaluator.go:51 +0x157a
github.com/AvicennaJr/Nuru/evaluator.Eval({0xfdb480?, 0xc000404080}, 0xc00041b000)
/tmp/nuru/evaluator/evaluator.go:24 +0x865
github.com/AvicennaJr/Nuru/evaluator.evalProgram(0x32?, 0xc00041b000)
/tmp/nuru/evaluator/evaluator.go:212 +0x85
github.com/AvicennaJr/Nuru/evaluator.Eval({0xfdb040?, 0xc00043a030}, 0xc00041b000)
/tmp/nuru/evaluator/evaluator.go:21 +0x209
github.com/AvicennaJr/Nuru/repl.(*dummy).executor(0xc000056530, {0xc0003ee248, 0x3})
/tmp/nuru/repl/repl.go:113 +0x217
github.com/AvicennaJr/GoPrompt.(*Prompt).Run(0xc00017a5a0)
/home/gekkowrld/go/pkg/mod/github.com/!avicenna!jr/!go![email protected]/prompt.go:84 +0x73f
github.com/AvicennaJr/Nuru/repl.Start()
/tmp/nuru/repl/repl.go:90 +0x15f
main.main()
/tmp/nuru/main.go:40 +0x752

Reproduction Steps

Type nuru into the terminal or open a file for editing.
Write a simple line like 1+. or any puntuation marks except [ and [a-zA-Z].
If on the terminal, press ENTER.
If in file, execute the file with nuru filename.nr
The panic happens and exits (in both file and terminal)
Repeat with another puntuation or UTF-8 or any other characters of your choice except ones from the list:

  • a-z
  • A-Z
  • [SPACES] (except NULL or NOTHING)
  • 0-9
  • [, -

All the other characters can reproduce the error(s)

Adding one more operation, - is removed from the 'safe' panic list.

Possible Solution

Catch the errors and produce custom errors as done with ASCII alphabet as now.

Additional Information/Context

No response

Nuru version

v0.5.1 (compiled from source)

Environment details (OS name and version, etc.)

GO VERSION: go version go1.22.0 linux/amd64
Kernel: 6.7.5-arch1-1 x86_64
Shell: Bash
OS: Arch Linux x86_64

Allow % formating like in C like languages or fstring like python

Describe the feature

C like languages allow the user to "manipulate" strings using '%' e.g "%s" for strings, "%d" for decimals and so on. Python also has the same feature using .format() and f-strings.

Use Case

andika() currently only supports arbitrary number of arguments but no way of organizing them as per user needs.

Adding this will enable the user to do like:

fanya i = 0

fanya jina = jaza("Unaitwa nani rafiki? ")

wakati (i <= 5) {
		andika("Rafiki %s hii ni %d", jina, i)
		i++
}

(the same case with f-strings)

Proposed Solution

The golang and or python implementation details can be of use:

This are previous implementation details, not all the formatting will be copied over.

Other Information

No response

Acknowledgements

  • This feature might incur a breaking change
  • I may be able to implement this feature request

Version used

v0.5.1 (compiled from source with modifications from #80)

Environment details (OS name and version, etc.)

GO VERSION: go version go1.22.1 linux/amd64
Kernel: 6.8.1-arch1-1
Shell: Bash
OS: Arch Linux x86_64

Background/ Why Nuru programming language?

Please can you include more information in the readme file to explain what triggered the establishment of this language. I am really interested to know.

I speak Swahili, this programming language will bring big impact in my country.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.