Introduction
The Hybrix system includes a custom computer programming language, called "the Hybrix language." It has three defining qualities:
- Minimalist: There are object-oriented classes and inheritance, but otherwise very few abstractions or advanced features. You will learn everything there is to know about the language relatively quickly.
- Low-level: Hybrix code has a straightforward translation to assembly language. You can view the corresponding assembly language as you're writing code, and by studying it, learn how a compiler works.
- Memory-safe: Program objects are managed by a garbage collector. It is technically possible to write unsafe code that corrupts the computer's memory; however, unsafe code is easy to avoid and only needed for certain device interactions.
Look and feel
Here's a small program that illustrates the Hybrix language syntax:
MODULE MAIN
FUNC START()
# INITIALIZE THE HYBRIX FRAMEWORK
ENGINE::INIT()
CONSOLE::INIT()
# PRINT A MESSAGE ON THE SCREEN
CONSOLE::PRINT("HELLO, WORLD!")
END FUNC
END MODULE
The program always begins execution in the MAIN::START() function. When the function returns, the program finishes.
The code uses all capital letters, and in fact the editor will automatically capitalize whatever you type. It's a bit quirky and SEEMS LIKE SHOUTING, but you'll quickly get used to it.
Here's a slightly larger program that counts from 1 to 10:
MODULE MAIN
FUNC START()
ENGINE::INIT()
CONSOLE::INIT()
VAR I: INT
1 -> I
LOOP
# PRINT THE NUMBER
CONSOLE::PRINT_INT(I)
# PRINT A SPECIAL "NEWLINE" CHARACTER, STARTING A NEW LINE
CONSOLE::PRINT("{N}")
# WHEN I REACHES 10, DROP OUT OF THE LOOP
IF I = 10
DO DROP
I + 1 -> I
END LOOP
END FUNC
END MODULE
If you're uncomfortable writing I + 1 -> I, you can write I <- I + 1 instead. They have the same meaning.
Minimalist philosophy
Compared to other popular programming languages, the above example may seem verbose. For serious work, engineers prefer languages that allow complex ideas to be expressed very concisely. This convenience comes at the price of a steeper learning curve, though. For beginners, it can destroy the expectation that we can perfectly understand our code; we don't need to blindly rely on memorized incantations or trial and error. Hybrix's simple statements make it easy to step through your code using the debugger, line by line, to visualize your code.
A verbose language also trains your mental foundation: Humans learn by repeating an activity over and over until it becomes second nature. You may find that there's something beautiful about detailed work, similar to assembling Lego toys, creating worlds in Minecraft, or brushing each tree in a landscape painting. Whenever the small steps of your Hybrix program produce a wonderful result, that magic is 100% your creation. It's not obscured by someone else's unfathomable compiler.