DEV Community

DZ-RED
DZ-RED

Posted on Edited on

From a Minecraft Server to My Own Programming Language: Building Wind

Wind

Some time ago, I was running my own Minecraft server. Eventually, I decided to shut it down and start working on something completely different.

Around that time, I came across a few YouTube videos explaining how compilers and programming languages work.

After watching them, understanding probably half of what was being explained, and downloading a book about C, I decided to build my own programming language.

Was I qualified to do that? Probably not.

Without Claude, I wouldn't have written a single line of the original compiler. My knowledge of C was nowhere near sufficient for a project like this. However, as development progressed, I became increasingly interested in understanding how the compiler actually worked.

That's how Wind was born.

Development, burnout, and coming back

The first development phase lasted approximately two months. Wind was a primitive language capable of performing arithmetic operations, working with arrays, and executing relatively simple programs.

In September, I downloaded my own source code again, made a few changes, pushed some commits, and eventually abandoned the project once more.

Meanwhile, I was developing a geopolitical sandbox game and coming up with various startup ideas. The classic "ChatGPT, make me rich" phase.

Eventually, I realized that game development wasn't really my thing.

Writing code is one thing. Creating sprites, designing textures, writing scenarios, finding sound effects, and managing every other aspect of a game is something entirely different.

I enjoyed programming itself much more.

In November, I returned to Wind with a clearer understanding of what I wanted the language to become.

Why another programming language?

Wind is named after, well, the wind.

I wanted to create a language that would be lightweight, reasonably fast, and easy to learn.

One of my main frustrations with programming education is the amount of information beginners are expected to absorb before they can build something useful.

Python is an excellent example of an accessible programming language. Its educational value was one of my main inspirations.

However, I also wanted Wind to offer static typing and native compilation.

Wind is primarily intended to be an educational programming language. My long-term goal is to make it suitable for computer science classes, tutoring, and independent learning.

At the same time, I don't want students to outgrow the language immediately after learning the basics.

Wind can already be used to build small utilities, automation scripts, simple backend applications, and programs that interact with native C libraries.

Syntax and questionable design decisions

Simple Wind program

Here's the traditional Hello World program:

terminal.paste -> "Hello, world!"
Enter fullscreen mode Exit fullscreen mode

Variable declarations look like this:

int.count = 42
str.name = "Wind"
bool.ready = true
frac.pi = 3,14
Enter fullscreen mode Exit fullscreen mode

Why the dot between the type and the variable name?

I wanted to visually connect the two. To me, int.count clearly communicates that count is associated with the integer type.

Type inference is also available:

var number = 42
Enter fullscreen mode Exit fullscreen mode

Functions use the following syntax:

func square(int.x) -> int
    return x * x
end

terminal.paste -> "${square(5)}"
Enter fullscreen mode Exit fullscreen mode

Instead of curly braces, Wind uses the end keyword to close blocks. The arrow in a function declaration indicates its return type.

Typed collections are supported as well:

int.list.numbers = [10, 20, 30]

dict[str,str].config = [
    "host": "localhost",
    "port": "8080"
]
Enter fullscreen mode Exit fullscreen mode

And then there's probably my most controversial syntax decision:

frac.pi = 3,14
Enter fullscreen mode Exit fullscreen mode

Yes, Wind uses a decimal comma.

I'm developing a language with an emphasis on logical syntax while simultaneously introducing additional parsing rules because of decimal separators.

The irony isn't lost on me.

I don't consider the current syntax final. If students, teachers, or other developers find certain features inconvenient, I'm willing to reconsider them.

How the compiler works

Wind is implemented in C and uses C as its compilation target.

Instead of developing a custom machine code backend, I decided to generate C source code and delegate native compilation and optimization to GCC.

The compilation pipeline looks approximately like this:

Wind source (.wnd)
        |
        v
      Lexer
        |
        v
      Parser
        |
        v
       AST
        |
        v
    C Codegen
        |
        v
       GCC
        |
        v
Native executable
Enter fullscreen mode Exit fullscreen mode

The lexer converts source code into tokens. The parser constructs an abstract syntax tree, which is subsequently processed by the C code generator.

GCC handles the remaining compilation stages.

This approach allows me to focus on language semantics, diagnostics, memory management, and standard functionality without reinventing an existing compiler backend.

Of course, generating C introduces its own problems. The compiler needs to account for C semantics and avoid introducing undefined behavior into generated programs.

My relatively limited experience with C has been one of the biggest challenges throughout the development process.

Building Wind has effectively become my own programming course.

WGC: Wind's garbage collector

WGC

Initially, Wind relied on the Boehm garbage collector for automatic memory management.

Eventually, I wanted more control over the runtime and fewer external dependencies. That led to the development of WGC, the Wind Garbage Collector.

WGC implements a mark-and-sweep algorithm.

Its current implementation includes:

  • Explicit root tracking.
  • A hash-based index for locating managed objects.
  • Non-recursive object graph traversal.
  • Dedicated allocation pools for certain small objects.

Boehm remains available as an alternative garbage collector.

I've been running comparative benchmarks involving temporary strings and string collections. WGC is approaching Boehm's performance in some of these workloads, although Boehm remains faster in several scenarios.

I'm not claiming that a relatively young garbage collector is better than an established implementation that has been developed for decades.

Correctness, predictable behavior, and broader testing are still more important than winning individual benchmarks.

For me, WGC is both a runtime component and an opportunity to understand automatic memory management in greater depth.

A compiler that helps you learn

If Wind is supposed to be an educational language, compiler diagnostics should be one of its most important features.

An experienced developer can usually understand a short error message. Someone writing their first program might not even understand the terminology used in that message.

That's why Wind provides three diagnostic modes:

wind --diag=compact example.wnd
wind --diag=normal example.wnd
wind --diag=learn example.wnd
Enter fullscreen mode Exit fullscreen mode

The compact mode provides concise diagnostic messages.

The normal mode provides more detailed information and is the default.

The learn mode is intended for beginners. It explains where an error occurred, why it occurred, and, where possible, how to fix it.

The compiler also provides additional explanations for individual diagnostic codes:

wind --explain W2003
Enter fullscreen mode Exit fullscreen mode

My goal is to help beginners understand their mistakes instead of forcing them to immediately search for an explanation elsewhere.

I believe compiler diagnostics can play a much bigger role in programming education.

Beyond educational exercises

Despite its educational focus, Wind already provides functionality for working with files, JSON, HTTP, and other practical tasks.

One of the most recent additions is C FFI support.

For example, a binding for zlib can describe an external function using a .windbind file:

header <zlib.h>
link "z"
func version() -> str = zlibVersion copy_cstr
Enter fullscreen mode Exit fullscreen mode

The corresponding Wind program can then use the binding:

c.import <zlib>

terminal.paste -> "zlib ${zlib.version()}"
Enter fullscreen mode Exit fullscreen mode

This allows Wind to gradually gain access to the existing ecosystem of C libraries without requiring every integration to be implemented directly inside the compiler.

FFI also introduces additional responsibilities involving type compatibility, memory ownership, object lifetimes, and calling conventions.

Automatic memory management doesn't magically make native interoperability safe.

These are areas where Wind still needs further development and testing.

Freestanding: an experimental direction

During a recent discussion about Wind, someone suggested using it for operating system development.

The current Wind runtime and garbage collector are obviously not suitable for every low-level environment.

This led to the idea of introducing a separate freestanding compilation mode.

A proposed example might look like this:

target freestanding

export func add(i32.a, i32.b) -> i32
    return a + b
end
Enter fullscreen mode Exit fullscreen mode

Instead of generating an executable with the standard Wind runtime, the compiler would produce an object file that could be linked with C or assembly code.

The proposed mode would introduce features such as:

  • Fixed-width integer types.
  • Raw pointers.
  • Static memory management.
  • Explicit external function declarations.
  • C ABI compatibility.
  • Runtime-independent object generation.

The important part is keeping the regular educational mode simple.

Beginners shouldn't be required to understand pointers, memory layouts, or calling conventions before writing their first program.

Freestanding is currently a design proposal, not an implemented feature.

What would success look like?

I'm not trying to replace Python, C++, Rust, or any other established programming language.

My biggest achievement would be seeing Wind used in an actual computer science classroom.

I'd love to see teachers explain programming concepts using Wind, students write their first programs, and beginners provide feedback about the language's design.

Perhaps that feedback would force me to reconsider some of my favorite syntax decisions.

That would be perfectly fine.

Wind is still a young experimental language. It has limitations, questionable design decisions, and plenty of unfinished work.

Nevertheless, developing it has taught me considerably more about programming than I knew when I first downloaded that book about C.

And that's why I'm still working on it.

Source code and feedback

Wind is open source:

https://github.com/dz-red/Wind-Lang

I'd particularly appreciate feedback on the compiler architecture, syntax, garbage collector, and the educational direction of the language.

What would you expect from a compiled programming language designed primarily for beginners?

And what would you change about Wind?


Disclosure: This article is based on my own development experience and was drafted and translated into English with AI assistance.

Top comments (0)