v1.0

Getting Started with Astra

Astra is a custom programming language implemented in C++17. It compiles source code to bytecode and executes it on a custom Virtual Machine. Designed to be simple yet expressive — with unique features like Chains, Modifiers, and a tri-state boolean system.

💡 Tip: Astra is perfect for learning language design concepts, scripting tasks, and building tools with a clean, readable syntax.

Installation

Download the latest release for your platform:

Windows

terminal
\\ Download astra.exe and run: astra program.astra

Linux / macOS

terminal
\\ Download the binary and run: chmod +x astra ./astra program.astra
📦 Download: Get the latest release from the Downloads page.

Hello World

Create a file called hello.astra and write:

hello.astra
write "Hello, World!"

Run it:

terminal
astra hello.astra

Output:

Hello, World!

Let's try something more interesting:

intro.astra
\\ Variables name = "Astra" version = 1.0 write "Welcome to " + name + " v" + version \\ Tri-state boolean — unique to Astra! flag = maybe write flag \\ MAYBE \\ Safe division x = 10 / 0 write x \\ INFINITE

Interactive REPL

Run Astra without a file to enter the interactive REPL (Read-Eval-Print Loop). Great for experimenting with the language:

terminal
astra
Astra VM Ready (Type 'exit' to quit) Astra [1] >> x = 10 Astra [2] >> write x 10 Astra [3] >> write x * 2 + 5 25 Astra [4] >> exit
💡 Tip: The REPL supports arrow keys for history navigation. Press ↑ to recall previous commands.

Build from Source

Astra is implemented in C++17. To build from source, you need a C++ compiler like g++ or clang++.

Clone the repository

terminal
git clone https://github.com/astra-language/astra cd astra

Compile

terminal
g++ -std=c++17 -O3 main.cpp lexer.cpp compiler.cpp vm.cpp \ parser.cpp PowerManager.cpp chains.cpp error.cpp \ builtfun.cpp file.cpp common.cpp -o astra

Run

terminal
./astra hello.astra
✅ Next: Learn about Variables & Constants →