deimos-lang/dm-book/src
2026-03-26 16:29:42 -05:00
..
getting_started.md Start work on mdbook. 2026-03-26 16:29:42 -05:00
impl_array_list.md Start work on mdbook. 2026-03-26 16:29:42 -05:00
README.md Start work on mdbook. 2026-03-26 16:29:42 -05:00
SUMMARY.md Start work on mdbook. 2026-03-26 16:29:42 -05:00

Introduction

Greetings! This is the manual for Deimos Lang, a programming language created by Jesse Brault. Deimos has the planned following features:

  • Basic object-oriented features and semantics, including interfaces, classes, and records.
  • Enumerated (union) types like Rust/OCaml.
  • Traits, which function similar to Rust traits or Haskell type-classes.
  • Closures, including those with delegates like Groovy or Kotlin.
  • Compile-time metaprogramming with template-like constructs.
  • The usual imperative constructs: if/else, for/while loops, etc.
  • Functional features, borrowed from languages such as OCaml, Rust, Haskell: pattern matching, persistent data structures, and tail recursion.
  • Static name-resolution and type-checking, with compiler type-inference as much as possible.
  • Optional fully-dynamic dispatch via dyn keyword, providing runtime method/property lookup like Groovy or Ruby.
  • A fast foreign-function interface FFI for calling native Rust functions.

Deimos is compiled for the Deimos Virtual Machine (DVM), a VM like those of Java and Lua in spirit but with a Rust implementation and access to the rest of the Rust (and C, via Rust) ecosystem. The ultimate goal is to be able to run Deimos and Lua side-by-side on the DVM, allowing applications both a statically typed language like Deimos to function alongside and interface with a much more relaxed language like Lua.

Hello, World!

Since it's standard practice to offer the classic Hello World program, let's get started!

fn main()
  println("Hello, World!")
end

Sometimes we just need to dump a string to the terminal, so println is available by default in all scopes. Indeed, all items in the std::core module are imported by default to each file/module. In this case, the fully-qualified name of println is std::core::println, and is located in the print.dm file under std/core:

pub extern fn println(message: Any) -> Void

Here, println is declared as an extern function, meaning its implementation is provided by a native function at runtime. We can also see that it takes one parameter of type Any—where Any is the catchall super-type of all types in the language. Void takes its usual meaning.