How I Built a Full Functional Programming Language in Tunisian/Arabic – Part 2: Designing the…
Naftah Programming Language : Let’s write programs in Tunisian/Arabic
How I Built a Full Functional Programming Language in Tunisian/Arabic – Part 2: Designing the Keywords of Naftah
Naftah Programming Language : Let’s write programs in Tunisian/Arabic
*In the first part of this series, I explained why [Naftah](https://naftah.daiitech.org/) exists and the problem it attempts to solve: programming should not require translating your thoughts into a foreign language before they can become code.
In this part, we move from motivation to design.
Specifically, we’ll look at one of the most foundational aspects of any programming language: keywords.*
Why Keywords Matter More Than Syntax
*Keywords define the mental model of a language.
They are the words programmers see, type, and reason with every day. They describe:
- Control flow
- Definitions
- Truth and falsity
- Repetition
- Error handling
- Concurrency
- Time
Choosing keywords is not a cosmetic decision. It directly affects how easily programmers can read, write, and understand code.
For Naftah, this raised an immediate constraint:
Arabic is not a single rigid language — it is expressive, contextual, and rich in synonyms.
Naftah’s keyword system had to reflect that reality.*
Synonyms as a First-Class Language Feature
*One of the most deliberate design choices in Naftah is that keywords may have multiple valid forms.
These are not aliases added later. They are defined directly in the lexer.
This allows the language to:
- Accept variations such as
***إذا***and***اذا*** - Support common alternatives like
***صحيح***,***حقيقي***, and***صائب*** - Remain readable across different Arabic backgrounds
Internally, all synonyms map to the same token. Externally, programmers write in the form that feels most natural to them.*

Importing Code and Naming Intent
*Naftah supports modular programming through explicit import keywords:
***استيراد***,***جلب***,***إجلب***— brings an external unit into scope with a formal, declarative intent***تحت_إسم***,***مثل***— treats an imported unit as an equivalent name for readability or brevity
The goal here is clarity of intent.
Importing in Naftah reads as:
bring this external unit, and optionally give it a known name.
This avoids symbolic syntax and favors explicit phrasing, which is especially useful in educational contexts.*
Constants, Literals, and Fundamental Values
*Several keywords define fundamental runtime values:
- Boolean truth:
***صحيح***,***خطأ***and their synonyms - Invalid numeric results:
***ليس_رقم*** - Absence of value:
***فارغ*** - Absence of return:
***عدم*** - Unrestricted types:
***أي_نوع***
Each of these keywords exists because the concept already exists linguistically in Arabic.
Instead of introducing symbols or borrowed terms, Naftah uses descriptive phrases that align with how Tunisian/Arabic speakers explain these ideas verbally.*
[embed]
Declarations: Making Intent Explicit
*Naftah distinguishes declarations clearly:
***ثابت***— immutable values***متغير***— mutable values***دالة***— executable units
There are no implicit declarations.
Every binding clearly states:
- Whether it can change
- Whether it represents behavior or data
- Whether it returns a value
This design reduces ambiguity and makes code easier to reason about, especially for beginners.*
Conditional and Logical Flow
*Conditional logic in Naftah closely mirrors natural Arabic sentence structure:
***إذا***— starts a conditional statement***غير_ذلك_إذا***— checks another condition if the first fails***غير_ذلك***— runs when no condition is true***إذن***— introduces the resulting action
Logical operators use familiar connectors:
***و***— both conditions must be true***أو***— at least one condition must be true***ليس***— inverts a condition
The result is code that reads sequentially, rather than symbolically.
This is particularly important when teaching reasoning and branching logic.*
Looping and Repetition Constructs
*Naftah supports multiple loop constructs using clear Tunisian/Arabic verbs:
***كرر***— repeat a block of code a fixed or indefinite number of times (generic loop)***بينما***— repeat as long as a condition remains true***إفعل***— executes a block if condition matches***حتى***— continue looping until a condition becomes true (inverse condition loop)***إلى***— iterate from one value to another (index-based loop)
Loop control is explicit:
***كسر***— exit the current loop immediately***تابع***— skip the remainder of the current iteration and continue with the next one
Additional modifiers such as ***خطوة*** and ***تنازليا*** allow precise control over iteration without introducing separate syntactic forms.*
[embed]
Expressions, Selection, and Flow Control
*For selection and expression flow, Naftah introduces keywords such as:
***اختر***— begins a selection based on a value or expression***من_بين***— lists the possible options to choose from within a selection***ارجع***— returns a value from a function or expression***أنهي***— ends the current flow or block explicitly***من***— introduces the set or context for a choice or iteration***مثيل_من***— represents “each of” or “for every” item in a set***نوع***— inspects or declares a type (describing what category a value belongs to)***حجم***— retrieves the size or length of a collection or value (string length, number of object fields, number of items in a list…)
These keywords cover common execution patterns while remaining descriptive rather than symbolic.
Some keywords are intentionally reusable across contexts, allowing consistent mental mapping rather than fragmented syntax.*
Operators: Symbols with Linguistic Equivalents
*Naftah supports standard arithmetic, comparison, bitwise, and shift operators.
What makes this layer distinct is that many operators have Tunisian/Arabic keyword equivalents:
***+***and***زائد***— addition***==***and***يساوي***— equality comparison***<***and***أصغر_من***— less-than comparison
This allows programmers to choose between:
- Concise symbolic code
- Verbose, readable expressions
Both compile to the same underlying operations.*
Concurrency as a Core Language Feature
*Rather than treating concurrency as a library concern, **Naftah** introduces it at the language level:
***غير_متزامن***— declares code that runs asynchronously or non-blocking, allowing other work to proceed while waiting for results***تشغيل***— starts a concurrent task or activity***انتظار***— waits for a concurrent unit to complete, without blocking other work***نطاق***— defines a structured region where concurrent tasks are scoped and managed together***قناة***— creates a communication channel for passing messages or data between concurrent workers***ممثل***— represents an actor unit of concurrent computation that encapsulates its own state and interacts via message passing
These keywords expose modern concurrency models directly, while keeping their meaning explicit and discoverable in Arabic.*

Error Handling and Optional Values
*Error handling uses a structured, readable model:
***حاول***— begins a block of code that may succeed or fail***نجاح***— represents a successful result from a fallible operation***فشل***— represents a failed result needing explicit handling
Optional values are handled explicitly:
***بعض***— explicitly denotes the presence of a value***معدوم***— explicitly denotes the absence of a value
These constructs encourage safer code by making success, failure, presence, and absence explicit in the source.*
Time as a Native Concept
*Time-related keywords are deeply integrated:
- Units (
***ثانية***,***دقيقة***,***ساعة***, etc.) - Points in time (
***الآن***,***تاريخ***,***وقت***) - Ranges and durations (
***بين***,***مدة***,***فترة***) - Calendars and time zones
This allows time-based logic to be expressed without external libraries or opaque APIs.*
Keywords as a Reflection of Thought
*The keyword system in Naftah is not about novelty.
It is about reducing the mental distance between:
- How Tunisian/Arabic speakers think
- How programs are written
- How execution actually works
Every keyword is designed to carry meaning first, syntax second.*

What’s Next?
*Now that we’ve covered the vocabulary of Naftah, the next step is understanding what these words operate on.
The next article in this series will be:
Part 3: Primitives and Variables in Naftah
We’ll explore:
- Primitive values and their runtime representation
- Variable and constant declarations in practice
- Mutability rules and type behavior
- How Naftah models absence, invalid values, and optional data
At that point, we move from language design to writing real code.*
Have questions, feedback, or want to contribute? Visit the project on **GitHub***, or leave a comment below.
Let’s build the future of programming — in our language, on our terms.*
메타데이터
- post_id
- da8d066fece8
- slug
- how-i-built-a-full-functional-programming-language-in-tunisian-arabic-part-2-designing-the-da8d066fece8
- url
- https://medium.com/@chakibdaii/how-i-built-a-full-functional-programming-language-in-tunisian-arabic-part-2-designing-the-da8d066fece8
- canonical_url
- https://medium.com/@chakibdaii/how-i-built-a-full-functional-programming-language-in-tunisian-arabic-part-2-designing-the-da8d066fece8
- author_url
- https://medium.com/@chakibdaii
- status
- ok
- fetched_at
- 2026-06-22 12:55:45