Share your Programming Language Jam submissions here!

← Back to all posts
Swahili Lang
kshncodes (10)

Swahili is a programming language that is designed to be written entirely in the Swahili language. This is to aid in helping native Swahili speakers (primarily in East Africa) learn to code without the language barrier - in more ways than one!

Team

Design

Its syntax is a lot like JavaScript (which is what my teammate and I are best at), and is even built in JavaScript (on Node). We built everything (lexer, parser and interpreter) from scratch and are continuing to add more functionality to the language.

Source Code

See the project repl or GitHub

Examples

We've written a few examples to illustrate the syntax, and tried our best to add comments in both Swahili and English. Here's links to a few:

// Tumia "Dunia" mtumizi asipoandika chochote
// (Use "Dunia" if the user doesn't input anything)
wacha jina = soma("Jina lako? ") || "Dunia"

// Onyesha ujumbe kwenye skrini
// (Write the message to the screen)
andika("Jambo, " + jina + "!")
shughuli fibonacci(nambari){
  kama (nambari <= 1) {
    rudisha 1;
  }

  rudisha fibonacci(nambari - 1) + fibonacci(nambari - 2);
}

// Mtumizi ataandika nambari ya vifaa anavyotaka kuonyeshwa
// The user enters the number of Fibonacci numbers to output
wacha nambari = somaNambari("Nambari? ")
kwa i = 0 mpaka nambari {
  andika(fibonacci(i))
}
shughuli chupa(nambari, ukutani) {
  wacha mwisho = kama (niTupu(ukutani)) { " ukutani" } sivyo { "" }
  kama (nambari > 1) {
    andika("Vyupa " + Jina(nambari) + " vya pombe" + mwisho)
  } au (nambari == 1) {
    andika("Chupa " + Jina(nambari) + " cha pombe" + mwisho)
  } sivyo {
    andika("Pombe imemalizika :(")
  }
}

shughuli ondoa() {
  andika("Ondoa kimoja, pitisha karibu")
}

shughuli aya(nambari) {
  kama (nambari == 0) { rudisha }
  
  chupa(nambari)
  chupa(nambari, kweli)
  ondoa()
  chupa(nambari - 1)

  andika("")
  aya(nambari - 1)
}

aya(99)

You can try out Swahili here

Commentshotnewtop
jakbellamy (3)

As a Swahili speaker, this could be life-changing

apuck003 (1)

Halo, nazungumza Kiswahili mucho nzuri. Sina anwani ya IP kwa hivyo usiangalie tafadhali. Ninafanya Kiswahili kizuri. Itatumia. Asante.

julienmalard (8)

Ninapenda lugha yako sana! Sisi pia tumefanya lugha kama hii, jina lako ni Lassi.
Labda tunaweza kufanya kazi pamoja? :)

kshncodes (10)

@julienmalard thanks! I've looked at Lassi and would love to speak more. Please connect with me on LinkedIn here and let's chat

julienmalard (8)

@kshncodes Thank you! I don't have LinkedIn, but would email do? [email protected]
Looking forward to speaking more,
Julien

TheDrone7 (1406)

Could I ask you to include a link to the source code for the language in the post description?
Thank you.