October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix NowOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk9 min

How to Build a Programming Language With Arabic Keywords and Unicode Identifiers

A practical guide to Arabic reserved words and Unicode identifiers, covering lexer rules, NFC normalization, bidi display, security, parsing, and testing.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

You can write a language with Arabic reserved words and Unicode names by treating them as explicit parts of the language specification—not as a font or translation layer. Define the exact keyword spellings, choose identifier and normalization rules, then make the lexer, parser, diagnostics, and editor display follow those rules. The example below uses Arabic keywords with a broad Unicode identifier profile; you can narrow that profile if your language is intended to accept only a selected set of scripts.

Choose the language’s words and syntax first

Arabic keywords are ordinary source text until your lexer recognizes them as reserved tokens. Pick exact spellings and meanings, and document punctuation, comments, literals, and whitespace alongside them. The following spellings are an example vocabulary, not a standard shared by Arabic-language programming languages:

  • متغير declares a variable.
  • اطبع prints a value.
  • إذا begins a conditional.
  • وإلا begins its alternative branch.
  • صحيح and خطأ are Boolean literals.

Choose a source encoding as well. A practical specification can require UTF-8 and reject malformed input rather than trying to guess an encoding. Keep operators and delimiters unambiguous; for example, this design uses ASCII =, ==, +, parentheses, braces, and semicolons even when the words around them are Arabic.

Here is a small program using that proposed syntax:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Elebase USB to USB C Adapter for iPhone 18 Pro Max,USBC Car Charger Adapter
  • Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
  • Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
  • Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
  • Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
  • 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.
متغير العدد = 2;
إذا (العدد == 2) {
    اطبع "مرحبا";
} وإلا {
    اطبع "أهلا";
}

Give every keyword one exact spelling and make keyword matching case-sensitive if the language has no case distinction. Do not accept loosely similar spellings as aliases unless the specification explicitly lists them; otherwise users cannot know which forms are reserved.

Specify which Unicode characters can appear in names

Do not implement “Arabic identifiers” as a hand-written range of Arabic code points. That approach can miss combining marks and other valid characters, and it does not say what to do with digits, underscores, or names from other scripts. Unicode Standard Annex #31 (UAX #31, Unicode 18.0.0, Revision 45, dated 2026-09-01) recommends the XID_Start and XID_Continue properties as a basis for most identifiers and allows languages to tailor the rules through profiles.

A straightforward broad profile is XID_Start XID_Continue*, optionally allowing underscore as an additional start character. In that profile, Arabic letters can start names, while combining marks and permitted digits can continue them. It also permits characters from other scripts, so a variable name may be mixed-script unless you add a restriction. Use a Unicode-aware library or generated Unicode property tables; do not substitute tests such as “is alphabetic” or a fixed Arabic block range.

Identifier profile What it accepts Main trade-off
Broad XID profile Characters permitted by XID_Start and XID_Continue, subject to documented additions or restrictions Supports names across scripts, but needs clear mixed-script and spoofing diagnostics
Arabic-focused profile A documented subset chosen for the language’s intended Arabic orthography, with explicit rules for marks, digits, underscore, and any other scripts Can reduce unwanted forms, but may exclude legitimate names or language-specific needs if the subset is too narrow

UAX #31 provides guidance, not a mandatory profile. State the actual profile in your language specification, including whether names may begin with underscore, which digits may continue a name, and whether names from non-Arabic scripts are allowed.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
Anker USB-C Hub, 5-in-1 USB Hub for Laptops, 4K HDMI Multiport Adapter
  • 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
  • 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
  • Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
  • 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
  • What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.

Decide how normalization affects names and keywords

Unicode text can have canonically equivalent sequences with different underlying code-point sequences. Your language must say whether those spellings identify the same name. NFC normalization is one established choice: Rust’s language reference, for example, specifies NFC-normalized identifiers and treats identifiers as equal when their NFC forms are equal. That is an example, not a Unicode requirement.

For a small language, a workable policy is to preserve the original source for display, compute an NFC form for each identifier token, and use that normalized form for symbol-table comparison. Apply the same policy consistently when recognizing keywords; otherwise a spelling could behave differently as a variable or reserved word depending on its composition. An alternative is to reject identifiers that are not already NFC. Document whichever choice you make and report the original source spelling in errors.

Avoid silently choosing NFKC as a shortcut. Compatibility normalization can fold distinctions that NFC preserves, changing which names compare equal. Also document the Unicode data version your implementation uses: updating Unicode tables can change which characters satisfy identifier properties, so compiler upgrades should not quietly alter the language profile.

Tokenize identifiers before deciding whether they are keywords

The scanner should consume an entire identifier according to the chosen Unicode profile, normalize it according to the language’s policy, and only then check the normalized spelling against a keyword table. This makes the boundary between a keyword and a longer name explicit: إذا is a keyword, but إذاكان is one identifier unless the language specification says otherwise.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Sale
Anker USB C Hub, 7in1 Multi-Port USB Adapter, 4K@60Hz USBC to HDMI Splitter
  • Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
  • Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
  • Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
  • Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
  • What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.
  1. Decode the source as the required encoding; reject malformed sequences with a location-aware error.
  2. Skip documented whitespace and comments. Do not treat arbitrary invisible or directional formatting characters as whitespace.
  3. When the next code point can start an identifier, consume code points while they satisfy the continuation rule.
  4. Retain the exact source span, compute the specified normalized form, and check that form against the reserved-word table.
  5. If no identifier starts there, scan a number, quoted literal, delimiter, or operator, or report an error naming the unexpected character.

In language-neutral pseudocode, the core identifier path looks like this:

if is_xid_start(current) or (current == "_" and underscore_may_start):
    start = position
    consume_one()
    while not at_end() and is_allowed_identifier_continue(current):
        consume_one()

    source_spelling = text_from(start, position)
    key = normalize_nfc(source_spelling)

    if key in keyword_table:
        emit(keyword_table[key], source_span=start..position)
    else:
        emit(IDENTIFIER, value=key, original=source_spelling,
             source_span=start..position)

is_xid_start and is_allowed_identifier_continue stand for lookups against the Unicode properties and any documented language profile; they are not built-in functions in every programming language. The scanner should operate on decoded Unicode characters while keeping offsets that can map back to the original source for highlighting and diagnostics.

Define what happens when a name is also a keyword

There are two common choices. Reserving the Arabic spellings everywhere is simpler: users cannot use a reserved word as a variable or function name. An escape syntax preserves those names at the cost of another lexical rule. For example, this language could reserve r# as a raw-name prefix, making r#إذا an identifier rather than the conditional keyword. That prefix is only a proposed design choice; document its exact syntax and how it interacts with normalization before implementing it.

Whichever choice you make, test the collision behavior directly. Do not resolve collisions by checking whether the parser “expects a keyword” at that point: context-dependent keyword recognition makes the grammar and error messages harder to reason about.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #4
Sale
UGREEN USB to USB C Adapter Combo 4-Pack, 10Gbps USB C Converter Space Gray
  • Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
  • Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
  • Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
  • Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
  • Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft

Keep logical token order separate from visual text direction

Arabic is written right-to-left, while many programming symbols and Latin text are left-to-right. Unicode bidirectional rendering can make a mixed-direction line look different from its underlying character order. UAX #31 warns that without higher-level protocols, bidi reordering may make tokens appear in a visual order that conveys a different logical intent. The compiler should tokenize the logical source sequence; the editor and diagnostics must make that sequence understandable to a person.

  • Specify whether bidi control characters are rejected. A conservative starting policy is to reject them in identifiers and code outside string literals and comments.
  • If the language permits any directional controls, specify exactly where and how they are allowed; do not accept them accidentally as identifier continuations.
  • Show source locations and error excerpts in a way that exposes logical order. For suspicious characters, report a Unicode code point or escaped form in addition to the rendered glyph.
  • Test source in the actual editor, terminal, and plain-text diagnostic views your users are likely to encounter. A correct lexer cannot by itself make every display safe.

Apply separate, explicit rules to comments and string literals. A language may permit ordinary Arabic prose in either, but accepting bidi controls there still has display and review implications. Do not assume that a rule designed for identifiers automatically settles the policy for every kind of source text.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Build the parser and execution path in stages

Once the scanner emits stable tokens, the rest of the implementation can follow a conventional language pipeline. For a first version, a tree-walking interpreter is often the smallest route from tokens to a working program; code generation or bytecode can come later if the language needs it. The Phoenix paper’s abstract describes an Arabic-language compiled object-oriented language with a preprocessor, scanner, parser, semantic analyzer, code generator, and linker. That is an architectural precedent, not evidence that any particular Unicode or bidi policy is handled by its design.

1. Parse tokens into a syntax tree

Write a grammar for declarations, expressions, blocks, and statements, then parse token kinds rather than inspecting Arabic text again. A minimal grammar for the example might be:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
Anker USB C Hub, 5-in-1 USBC to HDMI Splitter with 4K Display
  • 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
  • Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
  • Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
  • HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
  • What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.
program     := statement* EOF
statement   := declaration | conditional | print_statement
 declaration := VAR IDENTIFIER "=" expression ";"
conditional := IF "(" expression ")" block (ELSE block)?
print_statement := PRINT expression ";"
block       := "{" statement* "}"
expression  := equality
 equality    := additive ("==" additive)*
 additive    := primary ("+" primary)*
primary     := IDENTIFIER | NUMBER | STRING | TRUE | FALSE | "(" expression ")"

In this sketch, VAR, IF, ELSE, PRINT, TRUE, and FALSE are token kinds associated with the chosen Arabic spellings. The spaces before declaration and equality are typographical only; remove them in a formal grammar if they are not part of your notation.

2. Check names and types

Walk the syntax tree to check that names are declared before use, declarations do not violate your scope rules, and operators receive supported operand types. Store names under the same normalized key the scanner produced, but keep source spans and original spellings attached for messages such as “unknown name” or “duplicate declaration.”

3. Interpret or compile

A small tree-walking interpreter can evaluate expressions and execute statements directly from the syntax tree. If you later add bytecode or native code generation, preserve the same token, normalization, and diagnostic rules rather than creating a second interpretation of identifiers downstream.

Test Unicode, security, and display behavior

Testing only a short Arabic demo can miss the failures that matter most. Add lexer, parser, and diagnostic tests for both accepted and rejected cases, and retain source spellings in test fixtures so normalization and display behavior are checked rather than assumed.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • Arabic keywords, ordinary Arabic identifiers, and an identifier that begins with a keyword’s spelling but continues with more characters.
  • Arabic letters followed by combining marks that are permitted by the selected profile.
  • Canonically equivalent spellings, verifying the documented NFC equality or rejection policy.
  • Invalid identifier starts, disallowed continuation characters, underscore behavior, and the language’s chosen digit rules.
  • Keyword collisions, including the raw-identifier escape if one is implemented.
  • Mixed Arabic and Latin names, and names that look similar but contain different scripts or code points.
  • Bidi controls in identifiers, comments, strings, and code, with the specified allow-or-reject result for each context.
  • Malformed source encoding, comment boundaries, quoted strings, and error excerpts shown in an editor or terminal.

Unicode Technical Standard #39 (UTS #39) describes a General Security Profile for identifiers, including restrictions intended to manage visual confusion. Consider its approach alongside the language’s orthographic requirements. Mixed-script warnings, confusable-name checks, and restrictions on invisible or default-ignorable characters can help users notice suspicious names, but syntax restrictions alone cannot eliminate every spoofing risk. Treat any joining controls needed for the intended Arabic orthography as a deliberate, context-sensitive design decision, not as characters to accept or reject by accident.

Write down the profile so implementations agree

Before calling the language usable, publish a compact specification that answers these questions:

  • Which exact Arabic spellings are reserved, and are keyword comparisons case-sensitive?
  • Which Unicode version and identifier properties define valid starts and continuations? What does the language add or exclude?
  • Are identifiers normalized to NFC for comparison, or rejected unless already NFC? Are keywords treated the same way?
  • Can reserved spellings be escaped as names, and what exact syntax does the escape use?
  • Which bidi controls, default-ignorable characters, mixed-script names, and joining controls are allowed in identifiers, comments, and strings?
  • How will diagnostics expose original spelling, logical character order, source location, and unusual code points?

UAX #31 and UTS #39 give useful foundations for identifier and security decisions, but neither chooses the profile for your language. A concise, testable specification is what makes separate scanners, parsers, editors, and compiler versions behave consistently.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. Shenzhen desk3 min
    HONOR Expands Beyond Smartphones With Humanoid Robot RevealHONOR said it unveiled its first humanoid robot at MWC 2026 and named shopping assistance, workplace inspections, and supportive companionship as intended uses. Later Robotics D1 claims and a reported…
  2. Cupertino desk5 min
    Apple Unveils AirPods Max 2: The Upgrade That Should Have Happened Years AgoAirPods Max 2 adds H2-powered audio features and Apple claims up to 1.5× more effective ANC, but its design, Smart Case, and 20-hour battery rating are unchanged. Wired lossless audio…
  3. Cupertino desk4 min
    Apple’s OLED Touch MacBooks Are Coming—but the Dynamic Island Is the Real GambleApple has not announced an OLED touchscreen MacBook, but reports point to high-end models arriving in late 2026 or early 2027. The reported Mac Dynamic Island could be useful, but…
Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
Windows Errors? Fix Them Before They SpreadFree repair scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.