Skip to main content

단아(Danha) — 게임 개발 특화 프로그래밍 언어. Easy to Start, Hard to Master.

Project description

단아 (Danha)

게임 개발 특화 프로그래밍 언어 — Easy to Start, Hard to Master

단아는 C++/C# 대안을 목표로 하는 네이티브 컴파일 언어입니다. Jai, Odin, Zig처럼 데이터 지향적이면서 C#처럼 친숙한 문법을 가졌습니다.

특징

  • ECS 내장component, system, for each 문법으로 게임 로직 작성
  • 네이티브 컴파일 — LLVM 백엔드, 인터프리터 대비 ~120배 빠름
  • 벡터/행렬 일급 시민vec2, vec3, vec4, mat4 내장
  • parallel 키워드 — 한 줄로 멀티스레드 병렬 처리
  • 아레나 메모리 — 기본은 자동, 고급 사용자는 수동 제어
  • 안전한 설계unsafe 블록, Result + ? 연산자, 소유권 분석

빠른 시작

pip install danha-lang

hello.dh 파일을 만들고:

name = "세계"
print("안녕 {name}!")

실행:

danha run hello.dh

명령어

danha run <파일.dh>        # 인터프리터로 실행
danha compile <파일.dh>    # 네이티브 컴파일 (LLVM)
danha repl                 # 대화형 모드
danha check <파일.dh>      # 구문 검사
danha version              # 버전 정보

네이티브 컴파일을 사용하려면:

pip install danha-lang[compile]

코드 예시

기본 문법

fn fibonacci(n: i32) -> i32 {
    if n <= 1 { return n }
    return fibonacci(n - 1) + fibonacci(n - 2)
}

for i in 0..10 {
    print("fib({i}) = {fibonacci(i)}")
}

ECS 게임 로직

component Position { x: f64, y: f64 }
component Velocity { dx: f64, dy: f64 }

system move_entities(dt: f64) {
    for each (p: Position, v: Velocity) {
        p.x += v.dx * dt
        p.y += v.dy * dt
    }
}

parallel system update_physics(dt: f64) {
    for each (p: Position, v: Velocity) {
        p.x += v.dx * dt
        p.y += v.dy * dt
    }
}

에러 처리

enum Result {
    Ok(i32)
    Err(str)
}

fn safe_divide(a: i32, b: i32) -> Result {
    if b == 0 { return Result.Err("0으로 나눌 수 없어") }
    return Result.Ok(a / b)
}

fn compute() -> Result {
    val = safe_divide(100, 5)?
    return Result.Ok(val * 2)
}

현재 상태

알파 단계입니다. 26단계까지 구현 완료. 테스트 679개(인터프리터) + 409개(컴파일러) 통과.

라이센스

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

danha_lang-0.26.0.tar.gz (136.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

danha_lang-0.26.0-py3-none-any.whl (140.0 kB view details)

Uploaded Python 3

File details

Details for the file danha_lang-0.26.0.tar.gz.

File metadata

  • Download URL: danha_lang-0.26.0.tar.gz
  • Upload date:
  • Size: 136.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for danha_lang-0.26.0.tar.gz
Algorithm Hash digest
SHA256 44d162132b43468197ac77c919d8624d155281ddddf295be02e83414242fd0a1
MD5 c6be3b489d3d4462844f1eea560e91dd
BLAKE2b-256 5a54fc93018a2b632f46bf26b1670d636f6006a8b3f8e0d38fd61cf2d8c635f4

See more details on using hashes here.

File details

Details for the file danha_lang-0.26.0-py3-none-any.whl.

File metadata

  • Download URL: danha_lang-0.26.0-py3-none-any.whl
  • Upload date:
  • Size: 140.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for danha_lang-0.26.0-py3-none-any.whl
Algorithm Hash digest
SHA256 481c847a93e747ab8f6d1b21c87136c90c00f95ec13559406bba6631830d322d
MD5 8882ab7ce252d009c11f9df6473715bb
BLAKE2b-256 ac9afa125167c1ab519abaaeb8933eb9e3954f11e3241deca8c069b2e921281f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page