Aplos Documentation

All you need to know about Aplos.

← Back to Homepage

1. Introduction

1.1 What is Aplos?

Aplos is a readable high AND low-level programming language. Aplos can be used for nearly anything as it is a general purpose language. Unlike typical general purpose languages, Aplos has some special features like the integration of C++ and much more! As of now, we are a very small community. Fun fact: the name Aplos comes from the greek word (Απλός) which means simple or plain.

1.2 Getting Started

Install the interpreter and verify with aplos --version.

To run a script in Aplos you must use the command aplos run example.ap.

1.3 Installation

As of now 8/22/2025, Installing is not available since I am still working on the interpreter.

When the time comes, in order to install the interpreter, you must visit the download page on this site. The Aplos interpreter will only natively be supported for Windows systems as of now.

2. Basics

2.1 Variables

Variables can be defined like any other language. Example: varname = 10 : int

To statically type, you need to use static:. Example:

static: onions = 10 : int

2.2 Constants

Constants are defined using the const keyword:

static: const WAIT_TIME = "15 seconds" : string

2.3 Types

  • int - Integer numbers (42, -7)
  • float - Floating-point numbers (3.14, -0.001)
  • string - Textual data ("Hello")
  • bool - Boolean values (true/false)
  • array - Ordered collections ([1,2,3])
  • table - Key-value pairs (like dictionaries/maps)

2.4 Operators

  • Addition: +
  • Subtraction: -
  • Multiplication: *
  • Division: /
  • Modulus: %

2.5 Comments

Single-line comments start with #.

Multi-line comments: /* comment */

2.6 Print Statements

Use print() or println() for console output.

2.7 Control Flow

If and switch statements are supported. Example:

static: apples = 10 : int
static: oranges = 5 : int

if apples > oranges then
    print("More apples than oranges")
else
    print("More oranges than apples")
end
                    
static: day = "Monday" : string

switch day
    case "Monday":
        print("Today is monday")
    case "Friday":
        print("Today is friday")
    default:
        print("It's another day")
end
                    

2.8 Loops

# For loop
for i in range(1, 5) {
    println(i)
}

# While loop
static: count = 0 : int
while count < 5 {
    println(count)
    count += 1
}
                    

2.9 Functions

func greet(name: string) : void
    println("Hello " .. name)
end

greet("Alice")
                    

2.10 Arrays

static: numbers = [1,2,3] : array
numbers.append(4)
numbers.remove(2)
println(numbers)
                    

2.11 Tables (Maps)

static: person = {
    name = "Alice" : string,
    age = 30 : int
} : table

print(person[name])
person.add("occupation", "Adventurer")
                    

3. Debugging & I/O

3.1 Debug Variables

Debug variables are booleans controlling debug output.

static: debugMode = true : bool
if debugMode then
    println("Debug info here")
end
                    

3.2 Debug Printing

Use debug.print() for special debug output.

3.3 Files

# Reading
static: file = open("data.txt", "r")
println(file.read())
file.close()

# Writing
static: file = open("data.txt", "w")
file.write("Hello World")
file.close()
                    

4. Modules & Libraries

4.1 Local Modules (.apm)

import "mymodule.apm"

mymodule.myfunction()
                    

4.2 Library System (lib)

lib math

println(math.sqrt(16))
                    

4.3 Importing C++ Libraries

import "cpp/somelib.so"
                    

5. Error Handling

5.1 Try / Except

try
    println(10 / 0)
except ZeroDivisionError
    println("Cannot divide by zero")
end
                    

5.2 Exception Types

ZeroDivisionError, FileNotFoundError, IndexError, ValueError, etc.

5.3 Finally Clause

try
    file = open("data.txt", "r")
except FileNotFoundError
    println("File missing")
finally
    println("Done trying to open file")
end
                    

6. Concurrency & Parallelism

6.1 Spawning Tasks

spawn func worker()
    println("Doing work")
end
                    

6.2 Sleeping & Timing

sleep(1000) # milliseconds
                    

6.3 Synchronization

mutex lock
lock.acquire()
# critical section
lock.release()
                    

7. Math & System Libraries

7.1 Math

import "math"
println(math.pi)
println(math.pow(2,3))
                    

7.2 Random

import "random"
println(random.randint(1,100))
                    

7.3 Time

import "time"
println(time.now())
sleep(500)
                    

7.4 OS

import "os"
println(os.getcwd())
                    

7.5 Thread

import "thread"
thread.create(func() println("Hello from thread") end)
                    

8. Advanced Features

8.1 Low-Level Access

Access pointers and memory directly using special built-ins.

8.2 Memory Management

Garbage collection is automatic but you can manually free memory.

8.3 Optional OOP

class Person
    func __init__(self, name: string)
        self.name = name
    end
    func greet(self)
        println("Hello " .. self.name)
    end
end
                    

8.4 Coroutines / Async

co = coroutine.create(func()
    for i in range(1,3) do
        println(i)
        coroutine.yield()
    end
end)

coroutine.resume(co)
coroutine.resume(co)
coroutine.resume(co)
                    

9. Examples

9.1 Hello World

println("Hello, World!")
                    

9.2 Calculator

func add(a: int, b: int) : int
    return a + b
end

println(add(5,7))
                    

9.3 Module Usage

import "math"
println(math.sqrt(64))