Window {
id: mainWindow
title: "My First Forge App"
size: 480, 320
VBoxContainer {
anchors: left | top | right | bottom
padding: 32, 32, 32, 32
spacing: 16
Label { id: greeting text: "Hello, Forge!" fontSize: 24 }
Button { id: btnHello text: "Say hello" }
}
}
var clicks = 0
on btnHello.clicked() {
clicks = clicks + 1
greeting.text = "Hello for the ${clicks}. time!"
}
The first file says what is there. The second says what should happen. There is no main function, no event loop and no listener registration, and you don't have to install anything by hand. ./run.sh url file://…/app.sml opens a native window on macOS or Linux, and before it appears the script has already been compiled to machine code.
I'm writing a textbook about this, and while I write it, you can read it for free.
What it is
Forge4D is an open source app platform built on the Godot engine. You describe the user interface in SML, a small markup language of nodes and properties. You describe the behaviour in SMS, a small Kotlin-flavoured scripting language that is compiled ahead of time through LLVM. Together they form what we call ForgeIL – the Intention Language: you write down intentions, and the runner takes care of the how.
The book is called Forge4D – Building Apps with ForgeIL, the Intention Language. It is hands-on. Every chapter has a goal, a complete example, a line-by-line walk-through, a list of pitfalls, an exercise, and a solution in the appendix.
What is out today
- Part I – Intention: why an intention language, and your first running app
-
Part II – Structure (SML), first three chapters:
- Nodes, Properties and Values: the whole syntax, built around a small business card app
- Layout: containers instead of coordinates, size flags, split views, grids, tabs, and anchors for the rare element that should float
-
Resources and Themes: one
strings.smlper language, colour tokens by role, named styles, and switching between a dark and a light theme at runtime
Coming next: Markdown inside SML, the element catalogue, and Part III on SMS: values, control flow, functions, events, files, and non-blocking calls.
Every example runs, and that's not a slogan
Each example in the book is started in the real Forge Runner, clicked through and screenshotted before it goes into a chapter. That habit has paid off quickly.
While I was writing the SMS chapters, the tests turned up a list of things the native compiler did not handle correctly yet: strings passed through functions, floating-point math, some loops. So we stopped writing and fixed the compiler first. The new compiler infers types and is checked by a conformance suite that runs every test both in the interpreter and as native code. The book waited for it.
The SML chapters found smaller things. One example: padding takes its four values as left, top, right, bottom, not in the CSS order you probably expect. The book now says so, and every pitfall in it comes from a real run like that one.
Read it
📖 Forge4D on CrowdBooks: free while it is being written
- Source code of the platform: codeberg.org/CrowdWare/Forge4D
- All book examples: codeberg.org/CrowdWare/books
You need a Mac with Apple Silicon or a Linux PC, git, and a text editor. git clone, ./run.sh, and the runner downloads itself on first use.
If you try it and something in a chapter doesn't work the way it says, I want to know. It's an early edition, and your feedback goes straight into the next chapter.
– Adam Art Ananda

Top comments (0)