Jump to content

An Introduction to Dragon

25% developed
From Wikibooks, open books for an open world
(Redirected from Dragon)
An introduction to
The Dragon programming language logo
The Dragon programming language logo

The Dragon Programming Language

Dragon is an innovative and practical general-purpose, multi-paradigm programming language. It supports multiple programming paradigms — imperative, object-oriented, functional, procedural, and declarative — with an expressive, readable syntax that is easy to pick up. Dragon is dynamically and weakly typed, is portable across Windows, Linux, and macOS, and can be used to build console applications.

Under the hood, Dragon source is tokenized by a lexer, parsed into an abstract syntax tree, compiled to bytecode, and executed by a register/stack-based virtual machine written in Rust. For advanced use cases, Dragon scripts can also be transpiled to C and compiled natively with the system's C compiler (gcc, clang, or MSVC), bundled into a single self-contained encrypted executable, or built as a shared library (.dll / .so / .dylib) for embedding in other applications.

Dragon ships with a batteries-included standard library covering math, JSON, the filesystem, the OS environment, dates and timers, HTTP networking, cryptography, ZIP archives, XML, UUIDs, PDF/font rendering, and native FFI interop — all available through a simple import statement. It also includes built-in support for async/await and a thread module for concurrent programming, an interactive REPL, a package-based project runner driven by package.json, and a terminal-based editor called the TurboDragon IDE.

Table of Contents

[edit | edit source]

Getting Started

[edit | edit source]

Variables

[edit | edit source]

Operators

[edit | edit source]

Control Structures

[edit | edit source]

Getting Input

[edit | edit source]

Functions

[edit | edit source]

Collections

[edit | edit source]

Classes and Object-Oriented Programming

[edit | edit source]

Error Handling

[edit | edit source]

Modules and the Standard Library

[edit | edit source]

Concurrency

[edit | edit source]

Compiling and Distribution

[edit | edit source]

Tooling

[edit | edit source]

Appendices

[edit | edit source]