Warning
Arrow-Lang is not and will never be production ready! We are currently re-writing the syntax and the interpreter!
Arrow is a fun, experimental interpreted programming language that uses arrows and special syntax elements to make programming visually intuitive and compact. Developed using JavaScript in the Deno 2
ecosystem, Arrow is intended for programmers who enjoy minimalist and symbolic syntax, allowing for efficient expressions and type-checked assignments. This language is especially suited for developers interested in learning about language design, parsing, and interpreter construction.
Arrow aims to create an intuitive programming experience focused on simplicity and a unique syntax that is both visually distinct and easy to read. With features like variable type-checking, flexible function definitions, and arrow-based operators, Arrow provides an alternative way to experiment with programming fundamentals, control structures, and I/O. Itβs designed as a sandbox for learning and expanding language development skills in a modular, extensible way.
Note
Most features here will eventualy be added, features are not listed by order, list can change over time.
Feature | Description | Status |
---|---|---|
Variable Declaration | Declares and assigns values to variables. | π¨ Semi-Working |
Basic Operators | Supports addition, subtraction, multiplication, and division. | π² Not Implemented |
Logical Operators | And, Or, Not operators for conditional logic. | π² Not Implemented |
Comparation Operators | Equals, is bigger then, is smaller then for comparation logic. | π² Not Implemented |
Function Definition | Defines functions with arguments and optional return types. | π¨ Semi-Working |
Function Invocation | Calls functions with arguments. | π² Not Implemented |
If-Else Conditionals | Branches code based on conditions. | π² Not Implemented |
While Loop | Executes code while a condition is true. | π² Not Implemented |
For Loop | Executes code a fixed number of times. | π² Not Implemented |
Array Declaration | Declares arrays for storing ordered data. | π² Not Implemented |
Array Access | Accesses elements within an array by index. | π² Not Implemented |
Object Declaration | Declares objects with key-value pairs. | π² Not Implemented |
Object Property Access | Accesses properties of an object by key. | π² Not Implemented |
Built-In Functions | Includes print for output and input for user input. | π² Not Implemented |
Comments | Allows single and multi line comments for documentation. | β Implemented |
To get started with the Arrow language, follow these steps:
First, you need to install Deno 2. You can download and install it from the official Deno website.
Clone this repository to your local machine using the following command:
git clone https://github.com/OMouta/arrow.git
cd arrow-lang
You can use the scripts defined in the deno.jsonc
file to run and test the Arrow language.
To run the Arrow interpreter, use the following command:
deno task arrow path/to/your/code.arrow
To run the tests with debug information, use the following command:
deno task test
This will execute the Arrow code in the test/default.arrow
file and output debug information.
<type> variableName <- value
Examples:
<str> message <- "Hello Arrow"
<fn bool> functionName(<const int> arg1, <const float> arg2 ) {
// function body
-> returnValue
}
<fn bool>
: Denotes the start of a function and its return type.->
: Return keyword, followed by value.
functionName(arg1, arg2, ...)
Examples:
<fn str> greetUser(<const str> name) {
-> "Hello, " + name
}
message <- greetUser("ArrowUser")
- Addition:
x + y
- Subtraction:
x - y
- Multiplication:
x * y
- Division:
x / y
- And:
x && y
- Or:
x || y
- Not:
!! x
- Equal to:
x == y
- Not equal to:
x != y
- Greater than:
x > y
- Less than:
x < y
- Greater than or equal to:
x >= y
- Less than or equal to:
x <= y
Examples:
<int> result <- x + y
<bool> isActive <- flag && condition
<bool> isEqual <- x == y
<bool> isNotEqual <- x != y
<bool> isGreater <- x > y
<bool> isLesser <- x < y
<bool> isGreaterOrEqual <- x >= y
<bool> isLesserOrEqual <- x <= y
if -> condition {
// if block
} elif -> condition {
// else block
} else {
// else block
}
while -> condition {
// loop body
}
for -> init ; condition ; increment {
// loop body
}
Examples:
if -> score >= 50 {
result <- "Pass"
} else {
result <- "Fail"
}
i <== 0
while -> i < 5 {
i <- i + 1
}
<any> arrayName <- [item1, item2, ...]
<any> item <- arrayName[index]
<obj> objectName <- { key1: value1, key2: value2, ... }
<any> propertyValue <- objectName.key
Examples:
<int> items <- [10, 20, 30]
<int> firstItem <- items[0]
<obj> settings <- { volume: 75, theme: "dark" }
<str> currentTheme <- settings.theme
print(message)
<str> inputValue <- input("Prompt message")
print
: Outputs the provided message to the console or display.input
: Displays a prompt and waits for user input.
Examples:
print("Hello, Arrow!")
<str> userName <- input("Enter your name: ")
:: This is a comment
::> This
is
a
comment <::
:: Declare variables
<const int> age <- 25
<const str> name <- "ArrowLang"
:: Function definition with return type
<fn bool> isValidAge(<const int> userAge) {
if -> userAge >= 18 {
-> true
} else {
-> false
}
}
<fn null> main() {
:: Function call
<const bool> canVote <- isValidAge(age)
:: Using a loop with an array
<const int> values <- [10, 20, 30]
<var int> sum <- 0
for -> i <- 0 ; i < values.length ; i <- i + 1 {
sum <- sum + values[i]
}
:: Output the sum
print("Total Sum: " + sum)
}