Skip to content
orhunlangPublic

About

Turkish-first programming language runtime in C++17 — lexer, AST parser, tree-walk interpreter, bytecode compiler, stack VM, and standard library.

Topics

Resources

Contributing

Security policy

Stars

2 stars

Watchers

2 watching

Forks

Latest commit

 

History

405 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Orhun

Orhun CI

Orhun is an actively developed, Turkish-first programming language runtime. It is a stable 1.0 language contract with a working lexer, parser, interpreter, bytecode compiler, VM execution path, standard-library modules, package verification flows, and editor tooling.

The long-term goal is clear: Orhun starts with a C++ bootstrap core, then moves toward self-hosting so more of the compiler and tooling can be written in Orhun itself.

Repository: https://github.com/orhunlang/orhun

Status

Orhun is under active development.

  • Current version: 1.1.0
  • Stability: 1.0 stable language contract
  • Primary implementation language: C++17
  • Source extension: .oh
  • Default language identity: Turkish-first
  • Long-term direction: self-hosting compiler and independent toolchain

Do not treat Orhun as production-stable yet. The project is currently focused on language semantics, VM parity, reliability, developer experience, and the path toward self-hosting.

For a more concrete progress snapshot and the current estimate toward 1.0 / 2.1.0, see docs/PROJECT_STATUS.md.

Stability contracts: docs/COMPATIBILITY_POLICY.md, docs/KNOWN_ISSUES.md, docs/RELEASE_NOTES_1.1.0.md. Quick reference: docs/CHEATSHEET.md.

What Orhun Provides

  • Turkish-first syntax and diagnostics
  • UTF-8 identifiers and Turkish keywords
  • Interpreter and VM execution paths
  • Bytecode compiler and strict VM mode
  • Functions, default arguments, lambdas, lists, dictionaries, classes, and inheritance
  • Beginner-friendly loops including tekrarla, sürece, and her ... içinde
  • Error handling with deneme / yakala
  • Safe access with ?.
  • Async/task primitives and paralel yap
  • Standard modules for files, JSON, regex, date/time, simple database helpers, server helpers, FFI, and system policy controls
  • Orhun-source helper modules for language tooling, including token cursors, diagnostics, and AST records/traversal helpers for small compilers and DSLs
  • Package install and lock verification flows
  • Formatter, linter, LSP, and VS Code language tooling
  • Cross-platform CI for Windows, Linux, and macOS

Example

yaz "Merhaba Orhun"

tip Selamlayici:
    işlev selam(ad olsun "dünya"):
        döndür "Merhaba, " + ad

s olsun yeni Selamlayici()
yazdır s.selam()
yazdır s.selam("Orhun")

Expected output:

Merhaba Orhun
Merhaba, dünya
Merhaba, Orhun

Install

One-line installers (download v1.1.0 binaries from GitHub Releases):

# Linux / macOS
curl -fsSL https://raw.githubusercontent.com/orhunlang/orhun/v1.1.0/install.sh | bash
# Windows (PowerShell)
irm https://raw.githubusercontent.com/orhunlang/orhun/v1.1.0/install.ps1 | iex

The installed toolchain version is controlled by ORHUN_VERSION (default 1.1.0).

GitHub Actions:

- uses: orhunlang/orhun/[email protected]
  with:
    version: "1.1.0"

VS Code extension: tools/vscode-orhun (npm run package → .vsix).

Build From Source

Requirements:

  • C++17 compiler (g++ or clang++)
  • PowerShell on Windows for the default test script
  • Python 3 for smoke, benchmark, and tooling tests

Windows:

g++ -std=c++17 -O2 -DNDEBUG -Wall -Wextra main.cpp Lexer.cpp Parser.cpp Interpreter.cpp Chunk.cpp Compiler.cpp VM.cpp -o orhun.exe

Linux/macOS:

g++ -std=c++17 -O2 -DNDEBUG -Wall -Wextra main.cpp Lexer.cpp Parser.cpp Interpreter.cpp Chunk.cpp Compiler.cpp VM.cpp -o orhun

These commands produce the optimized runtime configuration used by release assets. The test runners keep an unoptimized development build by default so compiler warnings and diagnostics remain straightforward.

Quick Start

For a step-by-step Turkish beginner guide, see docs/BEGINNER_GUIDE.md.

Run a source file:

orhun examples/merhaba.oh

Read one line of input:

ad olsun oku("Adın? ")
yaz "Merhaba, " + ad

Create a simple range:

yaz aralik(5)
yaz aralık(5, 1, -2)
yaz ilk([3, 4])
yaz son([3, 4])

Loop over a list:

meyveler olsun ["elma", "armut", "kiraz"]
her meyve içinde meyveler:
    yaz meyve

Strict VM mode:

orhun vm-kati dosya.oh

Interpreter-only mode for runtime diagnostics:

orhun yorumla dosya.oh

Project health summary:

orhun doctor
orhun doctor --json

Useful commands:

orhun fmt dosya.oh
orhun lint dosya.oh
orhun lex dosya.oh --json
orhun parse dosya.oh --json
orhun orhun-lex dosya.oh
orhun orhun-parse dosya.oh
orhun baytkod dosya.oh --json
orhun baytkod-yurut derlenmis.bytecode.json
orhun obc-dogrula derlenmis.obc
orhun paketli-dogrula derlenmis.exe
orhun orhun-vm dosya.oh
orhun orhun-vm dosya.oh --obc-only
orhun orhun-derle dosya.oh cikti
orhun orhun-derle dosya.oh cikti --obc-only
orhun bootstrap-hazirla build/bootstrap
orhun bootstrap-dogrula build/bootstrap
orhun bootstrap-yeniden-uret build/bootstrap build/yeniden-uretilen
orhun bootstrap-yeniden-dogrula build/yeniden-uretilen
orhun bootstrap-derleyici-paketle build/bootstrap build/derleyici-paketi
orhun bootstrap-derleyici-dogrula build/derleyici-paketi
orhun bootstrap-derle build/bootstrap dosya.oh cikti
orhun bootstrap-calistir build/bootstrap dosya.oh
orhun hiz dosya.oh --json
orhun lsp --stdio
orhun paket dogrula
orhun paket kaldir paket_adi

Portable compiler bundles can emit JSON or complete artifacts:

build/derleyici-paketi/orhun-derleyici.exe dosya.oh
build/derleyici-paketi/orhun-derleyici.exe --derle dosya.oh cikti

For complete artifacts, the Orhun-written compiler CLI owns the output plan, including .obc, packaged executable, metadata paths, and metadata source name. Every compiler invocation uses the versioned orhun-compiler-cli-v1 result envelope and a pure-Orhun validation record; artifact mode embeds the orhun-artifact-plan-v1 plan. The C++ bootstrap host strictly validates both contracts, stages every artifact beside its destination, and publishes the complete set only after all writes succeed.

Releases

Version tags must exactly match VERSION, for example v0.8.0. Pushing a matching tag runs the full release gate on Windows, Linux, and macOS, rebuilds and tests an -O2 -DNDEBUG runtime, rebuilds the source-free compiler toolchain, and publishes deterministic compiler and runtime archives with SHA-256 verification files. Runtime archives include the orhun executable and sibling source StdLib, so they can run standard-library programs outside the source repository.

Release assets are published on GitHub Releases. Every asset gets a signed GitHub/Sigstore build-provenance attestation and SHA-256 verification data. Archives are not platform code-signed yet.

Verify a downloaded asset with GitHub CLI:

gh attestation verify orhun-compiler-0.8.0-linux-x64.tar.gz --repo orhunlang/orhun

Install a downloaded portable compiler archive after downloading its matching .sha256 sidecar and install_release.py release asset:

python install_release.py orhun-compiler-0.8.0-linux-x64.tar.gz
orhun-derleyici program.oh

The same verified installer installs runtime archives and creates the orhun command:

python install_release.py orhun-runtime-0.8.0-linux-x64.tar.gz
orhun program.oh

The installer requires a valid SHA-256 sidecar, rejects unsafe archive entries, and refuses cross-platform archives unless explicitly allowed. Use --install-root, --bin-dir, --no-shim, or --force to control the installation. The repository's tools/install_compiler.py remains as a compiler-only compatibility entry point.

Program arguments are available as sistem.argumanlar:

orhun dosya.oh ilk "iki kelime"

Test

Windows:

powershell -ExecutionPolicy Bypass -File tests\run_tests.ps1 -Compiler g++ -Output build/orhun_test.exe

Linux/macOS:

bash tests/run_tests.sh g++ build/orhun_test

To build and run the same optimized configuration used for releases:

.\tests\run_tests.ps1 -Output build/orhun_release.exe -BuildMode release
bash tests/run_tests.sh g++ build/orhun_release release

The test runner applies per-case timeouts so one broken fixture cannot hang the whole suite.

To measure the C++ interpreter against every guarded runtime output:

py -3 tests\interpreter_parity_sweep.py .\build\orhun_test.exe

The sweep requires every guarded output to match the VM/runtime contract within its fast budget. A larger timeout remains available for diagnosis on unusually slow development machines:

py -3 tests\interpreter_parity_sweep.py .\build\orhun_test.exe --timeout 30

Project Direction

Near-term priorities:

  1. Keep the VM path reliable and strict-mode compatible.
  2. Stabilize language semantics before adding large new syntax.
  3. Improve documentation and first-run developer experience.
  4. Move safe parts of the standard library into Orhun source.
  5. Grow Orhun-source language tooling so Orhun can be used to prototype other languages and DSLs.
  6. Build toward an Orhun-written lexer, parser, and compiler.

See docs/SELF_HOSTING_ROADMAP.md for the self-hosting plan.

Repository Guide

  • Core runtime and CLI: main.cpp, VM.cpp, Interpreter.cpp
  • Lexer/parser/AST: Lexer.cpp, Parser.cpp, AST.h
  • Bytecode compiler: Compiler.cpp
  • Standard library helpers: Yerlesik.h, StdLib/, StdLib/orhun/ (temel.oh, sonuc.oh, koleksiyon.oh, sozluk.oh, metin.oh, paket.oh, dil.oh, lexer.oh, parser.oh, derleyici.oh)
  • Examples: examples/
  • Small language example: examples/mini_dil.oh (tokenizer, parser, AST, recovery, and execution written in Orhun)
  • Tests and fixtures: tests/
  • Lexer parity fixtures: tests/lexer_parity/
  • Parser AST JSON fixtures: tests/ast_json/
  • Bytecode JSON contract smoke: tests/bytecode_json_smoke.py
  • Compiler prototype parity smoke: tests/compiler_prototype_smoke.py
  • Compiler bootstrap execution smoke: tests/compiler_bootstrap_smoke.py
  • Roadmap smoke aggregate: tests/roadmap_smoke.py
  • Parser prototype parity smoke: tests/parser_prototype_smoke.py
  • Closure capture analysis smoke: tests/closure_capture_analysis_smoke.py
  • Lambda capture analysis smoke: tests/lambda_capture_analysis_smoke.py
  • Interpreter closure smoke: tests/interpreter_closure_smoke.py
  • Full interpreter/runtime parity sweep: tests/interpreter_parity_sweep.py
  • VM closure extra smoke: tests/vm_closure_extra_smoke.py
  • LSP smoke: tests/lsp_smoke.py
  • Cross-platform workspace/file-URI LSP smoke: tests/lsp_workspace_smoke.py
  • VS Code tooling smoke: tests/vscode_syntax_smoke.py
  • VS Code tooling: tools/vscode-orhun
  • Deterministic release packager: tools/release_package.py
  • Migration notes: docs/MIGRATION_GUIDE.md
  • Beginner guide: docs/BEGINNER_GUIDE.md
  • Language specification: docs/SPEC.md
  • Closure/capture plan: docs/CLOSURE_CAPTURE_PLAN.md
  • Versioning policy: docs/VERSIONING.md
  • Release channels: docs/RELEASE_CHANNELS.md
  • Security policy: SECURITY.md

Contributing

Contributions are welcome, especially around tests, documentation, examples, language semantics, VM parity, and tooling. Because Orhun is pre-1.0, please keep changes small, tested, and aligned with the Turkish-first identity of the language. See CONTRIBUTING.md and docs/OPEN_SOURCE_POLICY.md for what belongs in the public repository.

Before opening a pull request:

bash tests/run_tests.sh g++ build/orhun_test

On Windows:

powershell -ExecutionPolicy Bypass -File tests\run_tests.ps1 -Compiler g++ -Output build/orhun_test.exe

Security

Please report security issues privately first:

See SECURITY.md for details.

License

Orhun is released under the MIT License. See LICENSE.

About

Turkish-first programming language runtime in C++17 — lexer, AST parser, tree-walk interpreter, bytecode compiler, stack VM, and standard library.

Topics

Resources

Contributing

Security policy

Stars

2 stars

Watchers

2 watching

Forks

Releases

Packages

Contributors

Languages