السلطان
  1. الرئيسية

تثبيت السلطان

يُثبَّت السلطان ببنائه من المصدر. اختر نظامك.

Linux

مُتحقَّق منه على x86_64. البناء من بذرة WebAssembly يحتاج مترجم C وCMake فقط.

  1. المتطلبات

    Debian, Ubuntu

    sudo apt install git cmake build-essential

    Fedora

    sudo dnf install git cmake gcc make

    Arch

    sudo pacman -S git cmake base-devel
  2. ابنِ المترجم

    git clone https://github.com/sultan-language/sultanc.git cd sultanc ./build.sh --bootstrap=wasm
  3. ثبّته في PATH مع سوباكس

    cd .. git clone https://github.com/sultan-language/supax.git cd supax tools/install.sh ../sultanc

    يضع sultanc ومكتبته القياسية وسوباكس في ~/.supax ويضيفه إلى PATH. افتح نافذة طرفية جديدة بعدها.

  4. تأكد

    sultanc --version

macOS

مُتحقَّق منه على Apple Silicon (arm64). البناء من بذرة WebAssembly يحتاج مترجم C وCMake فقط.

  1. المتطلبات

    أدوات سطر الأوامر من Xcode، وCMake (هنا من Homebrew):

    xcode-select --install
    brew install cmake
  2. ابنِ المترجم

    git clone https://github.com/sultan-language/sultanc.git cd sultanc ./build.sh --bootstrap=wasm
  3. ثبّته في PATH مع سوباكس

    cd .. git clone https://github.com/sultan-language/supax.git cd supax tools/install.sh ../sultanc

    يضع sultanc ومكتبته القياسية وسوباكس في ~/.supax ويضيفه إلى PATH. افتح نافذة طرفية جديدة بعدها.

  4. تأكد

    sultanc --version

Windows

لا خلفية أصلية على Windows بعد، فالبناء هناك يمر عبر LLVM.

  1. المتطلبات

    مترجم C، وCMake 3.21 أو أحدث، وصدفة تشغّل build.sh، وحزمة LLVM من 19 إلى 23 فيها LLVM-C.lib وLLVM-C.dll. وإن لم يجدها البناء، فحدد مكانها بـ SULTANC_LLVM_ROOT.

  2. ابنِ المترجم

    git clone https://github.com/sultan-language/sultanc.git cd sultanc ./build.sh --bootstrap=c --enable-llvm --backend=llvm
  3. ثبّته في PATH مع سوباكس

    cd .. git clone https://github.com/sultan-language/supax.git cd supax powershell -ExecutionPolicy Bypass -File tools\install.ps1
  4. تأكد

    sultanc --version

FreeBSD

لا يُبنى المترجم على الجهاز نفسه: ابنِه أولا على Linux (x86_64)، ثم ترجم منه مترجما لهذا النظام.

  1. ابنِ المترجم (Linux)

    git clone https://github.com/sultan-language/sultanc.git cd sultanc ./build.sh --bootstrap=wasm
  2. ترجم مترجما لهذا النظام

    x86_64-freebsd

    ./build/sultanc --target=x86_64-freebsd \ --module-source=compiler.backend.provider.llvm.llvm_codegen=compiler/backend/provider/llvm/unavailable.sn \ compiler/main.sn -o sultanc

    aarch64-freebsd

    ./build/sultanc --target=aarch64-freebsd \ --module-source=compiler.backend.provider.llvm.llvm_codegen=compiler/backend/provider/llvm/unavailable.sn \ compiler/main.sn -o sultanc
  3. تأكد

    انقل sultanc إلى الجهاز وشغّله من مجلد فيه compiler/ وlibrary/ (أو حدد SULTANC_STD). يترجم لنظامه افتراضيا، ويترجم نفسه أيضا. ولا يتوفر sultanc run هناك: ترجم البرنامج وشغّل الملف التنفيذي.

Android

لا يُبنى المترجم على الجهاز نفسه: ابنِه أولا على Linux (x86_64)، ثم ترجم منه مترجما لهذا النظام.

  1. ابنِ المترجم (Linux)

    git clone https://github.com/sultan-language/sultanc.git cd sultanc ./build.sh --bootstrap=wasm
  2. ترجم مترجما لهذا النظام

    aarch64-android

    ./build/sultanc --target=aarch64-android \ --module-source=compiler.backend.provider.llvm.llvm_codegen=compiler/backend/provider/llvm/unavailable.sn \ compiler/main.sn -o sultanc

    x86_64-android

    ./build/sultanc --target=x86_64-android \ --module-source=compiler.backend.provider.llvm.llvm_codegen=compiler/backend/provider/llvm/unavailable.sn \ compiler/main.sn -o sultanc
  3. تأكد

    انقل sultanc إلى الجهاز وشغّله من مجلد فيه compiler/ وlibrary/ (أو حدد SULTANC_STD). يترجم لنظامه افتراضيا، ويترجم نفسه أيضا. ولا يتوفر sultanc run هناك: ترجم البرنامج وشغّل الملف التنفيذي.

طرق البناء

يبدأ البناء من بذرة صغيرة ثم يبني المترجم نفسه على مراحل. تختار البذرة بـ --bootstrap:

--bootstrap=wasmبذرة WebAssembly: مترجم C وCMake فقط
--bootstrap=cبذرة C (الافتراضية): مترجم C وCMake وLLVM من 19 إلى 23
--bootstrap=existingمترجم مبني مسبقا: خطوة واحدة، نحو دقيقة. للتطوير

أضف --enable-llvm لتضمين خلفية LLVM في المترجم. يجد البناء LLVM بنفسه في مواقعه المعتادة، ومنها Homebrew، أو حدده بـ LLVM_CONFIG=/path/to/llvm-config.

التالي: دليل البدء، أو جولة في اللغة.