Getting Started with BHL

May 21, 2026 ยท View on GitHub

Language Overview

BHL is a strongly-typed programming language implemented in .NET, designed for both general-purpose programming and game development. It features:

  • Strong static typing
  • Object-oriented programming
  • First-class functions and lambdas
  • Modern array and collection handling
  • .NET interoperability

Your First BHL Program

Hello World

Create a file named hello.bhl:

import "std/io"

func main() {
    string message = "Hello, World!"
    std.io.WriteLine(message)
}
import "math"

class Calculator {
    func int Add(int a, int b) { return a + b }
}

func main() {
    var calc   = new Calculator
    var result = calc.Add(5, 3)
}

Basic Syntax

Variables

// Type declarations
int number = 42
string text = "Hello"
bool flag = true

// Type inference
var count = 0
var name = "BHL"

Control Flow

// If statement
if (condition) {
    // code
} else {
    // code
}

// For loop
for(int i = 0; i < 10; i++) {
    // code
}

// Array iteration
for(var item in array) {
    // code
}

Functions

// Basic function
func int Add(int a, int b) {
    return a + b
}

// Function with multiple parameters
func string FormatName(string first, string last) {
    return first + " " + last
}

Next Steps

  1. Explore the documentation

  2. Practice with examples

    • Try the sample code
    • Modify existing programs
    • Create your own projects
  3. Learn advanced features

    • Study error handling
    • Explore .NET interop
    • Understand memory management