Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Geliştirme Ortamı Kurulumu

BERK Programlama Dili'nin kaynak koduna katkıda bulunmak için gerekli geliştirme ortamının kurulumu.

📋 Gereksinimler

Temel Araçlar

  • Git - Versiyon kontrolü
  • Rust (1.70+) - Derleyici geliştirme için
  • LLVM (16.0+) - Code generation backend
  • CMake (3.20+) - Build sistem
  • Python (3.8+) - Test scriptleri için

Platform Bazlı

🪟 Windows

# Visual Studio 2022 (C++ Desktop Development)
# LLVM kurulumu
winget install LLVM.LLVM

# Rust kurulumu
winget install Rustlang.Rustup
rustup default stable

# Git
winget install Git.Git

🐧 Linux (Ubuntu/Debian)

sudo apt update
sudo apt install -y build-essential cmake git python3 python3-pip

# LLVM
sudo apt install -y llvm-16 llvm-16-dev clang-16

# Rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source $HOME/.cargo/env

🍎 macOS

# Homebrew ile
brew install llvm cmake git python3 rust

🔧 Repository Kurulumu

1. Repository'yi Klonlama

git clone https://github.com/ArslantasM/berk.git
cd berk/berk-lang

2. Bağımlılıkları Yükleme

# Rust bağımlılıkları
cargo fetch

# Python test araçları
pip install pytest pytest-cov

3. Build Yapma

# Debug build (geliştirme için)
cargo build

# Release build (performans testleri için)
cargo build --release

# Test çalıştırma
cargo test

🛠️ IDE Kurulumu

VS Code (Önerilen)

Gerekli eklentiler:

  • rust-analyzer - Rust IntelliSense
  • CodeLLDB - Debug desteği
  • Better TOML - Cargo.toml editörü
  • Error Lens - Hata gösterimi
# VS Code settings.json
{
    "rust-analyzer.checkOnSave.command": "clippy",
    "rust-analyzer.cargo.features": "all",
    "[rust]": {
        "editor.defaultFormatter": "rust-lang.rust-analyzer",
        "editor.formatOnSave": true
    }
}

IntelliJ IDEA / CLion

  • Rust Plugin yükleyin
  • Project'i Cargo projesi olarak açın

📁 Proje Yapısı

berk/
├── berk-lang/              # Ana derleyici kodu
│   ├── src/
│   │   ├── lexer/         # Lexical analysis
│   │   ├── parser/        # Syntax parsing
│   │   ├── ast/           # Abstract Syntax Tree
│   │   ├── semantic/      # Semantic analysis
│   │   ├── codegen/       # LLVM code generation
│   │   ├── stdlib/        # Standard library (Rust tarafı)
│   │   └── main.rs        # Entry point
│   ├── tests/             # Integration testler
│   └── Cargo.toml
├── stdlib/                 # BERK stdlib kaynak kodları
│   ├── io.berk
│   ├── math.berk
│   └── ...
├── examples/              # Örnek programlar
└── docs/                  # Dokümantasyon

🔍 Geliştirme Workflow

1. Feature Branch Oluşturma

git checkout -b feature/yeni-ozellik
# veya
git checkout -b fix/hata-duzeltmesi

2. Kod Yazma ve Test

# Kod değişikliği yaptıktan sonra
cargo build
cargo test
cargo clippy  # Lint kontrolü
cargo fmt     # Format düzeltme

3. Commit ve Push

git add .
git commit -m "feat: yeni özellik eklendi"
git push origin feature/yeni-ozellik

🧪 Test Çalıştırma

# Tüm testler
cargo test

# Belirli bir test
cargo test test_parser

# Integration testler
cargo test --test integration

# Coverage raporu
cargo tarpaulin --out Html

🐛 Debug Yapma

VS Code ile

.vscode/launch.json:

{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "lldb",
            "request": "launch",
            "name": "Debug BERK",
            "cargo": {
                "args": ["build", "--bin=berk-lang"]
            },
            "args": ["run", "test.berk"],
            "cwd": "${workspaceFolder}/berk-lang"
        }
    ]
}

LLDB ile Terminal

lldb target/debug/berk-lang
(lldb) run test.berk
(lldb) breakpoint set -n parse_function
(lldb) continue

📊 Performans Profiling

# Flamegraph
cargo install flamegraph
cargo flamegraph --bin berk-lang -- compile large.berk

# Perf (Linux)
perf record --call-graph dwarf target/release/berk-lang compile test.berk
perf report

💡 İpuçları

  • cargo watch kullanarak otomatik rebuild yapın
  • cargo expand ile macro expansion görün
  • RUST_LOG=debug ile detaylı log alın
  • Büyük değişiklikler öncesi issue açın

🆘 Yardım

  • Discord: [BERK Community Server]
  • GitHub Issues: Sorularınızı issue olarak açın
  • Email: arslantas.mustafa@gmail.com