Skip to content

godieGH/SwaziLang

Repository files navigation

SwaziLang

Release

SwaziLang is a scripting language written in C++ that lets you write programs using natural Swahili keywords and syntax.

Want to learn SwaziLang? Get started here →


Build Instructions

mkdir build && cd build
cmake ..
cmake --build .

To create an installable package for your OS:

make package
# Packages are output to build/packages/

Installing the package (recommended — tracked by your package manager):

sudo apt install ./packages/<package-name>.deb   # Debian/Ubuntu

Or install directly without package tracking:

sudo make install
# Note: uninstallation requires manual removal

Running SwaziLang

After building, run the executable from the build directory:

./swazi

Or install and add to your system PATH to run from anywhere.


Dependencies

Most dependencies are managed automatically by CMake via FetchContent or bundled with the build. You do not need Conan to build or use SwaziLang.

Contributors only: If you prefer using Conan for third-party dependency management during development, install it with:

pip install conan
conan --version  # verify installation

mkdir build && cd build
conan install .. --build=missing --output-folder=.

Keywords

Keyword Meaning / Usage
data Declare a variable
thabiti Declare a constant or a const getter method
kazi Define a function
tabia Define a method inside an object or class
rudisha Return a value from a function or method
chapisha Print with newline
andika Print without newline
kweli Boolean literal: true
sikweli Boolean literal: false
kama if statement / as alias in imports
vinginevyo / sivyo else / else if branch
kwa for loop
wakati while loop
fanya do-while loop
sawa Equality operator (==)
sisawa Inequality operator (!=)
na Logical AND (keyword form of &&)
au Logical OR (keyword form of ||)
unda Create a new object/class instance (new)
muundo Define a class
rithi Inherit from a class
futa Manually destroy an object instance
subiri Await an async operation
tumia Import a module
kutoka Specify module source in tumia statements
ruhusu Export from a module
jaribu try block
makosa catch block
kisha finally block
onesha Throw an error or exception
ainaya Unary: returns the type of a value
NINAMBA Unary: check if value is a number
NINENO Unary: check if value is a string
NIBOOL Unary: check if value is a boolean
NIKAZI Unary: check if value is a function
NIORODHA Unary: check if value is a list/array
NIOBJECT Unary: check if value is an object (alias: ob)

Operators & Symbols

  • Arithmetic: +, -, *, **, /, %
  • Bitwise: standard C bitwise operators
  • Parentheses ( ) are used for calling functions and methods — not for declaring them.

Example

kazi sum(a, b, c):
    rudisha a + b + c;

# This is a comment
data x = 20;
chapisha sum(3, 9, x);  # prints 32

Comments

Use # for single-line comments.


Documentation

Full language documentation and learning resources are available at swazilang.netlify.app.


Contributing

Issues and pull requests are welcome. Feel free to open one if you find a bug or want to improve something.


License

See LICENSE for details.

About

A scripting language written in C++ that lets you program using natural Swahili keywords and syntax.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages