Programming language for scripting with syntax similar to C++
macOS, GNU/Linux, BSD-Like, Haiku and others.
git clone https://github.com/terroo/terlang cd terlang cmake -B build . cmake --build build sudo cmake --install build
REPL:
To test the
ter
command.
$ ter ter> output(args()) Ter/Terlang VERSION: 0.0.1 ter> exit
With MSVC!
Open PowerShell (Run as Administrator) from the Windows Start Menu
git clone https://github.com/terroo/terlang cd terlang\ cmake -B build . cmake --build build # Create destination folders and subfolders New-Item -Path "C:\Program Files\Terlang\bin" -ItemType Directory -Force # Move to destination folder Move-Item -Path "build\Debug\ter.exe" -Destination "C:\Program Files\Terlang\bin\ter.exe" # Create an environment variable for system "Path" [System.Environment]::SetEnvironmentVariable("Path", $env:Path + ";C:\Program Files\Terlang\bin", [System.EnvironmentVariableTarget]::Machine)
Close PowerShell, then reopen and run:
To test the
ter
command.
prompt> ter ter> output(args()) Ter/Terlang VERSION: 0.0.1 ter> exit
Windows:
Invoke-WebRequest -Uri "https://github.com/terroo/terlang/releases/download/v0.0.1/terlang-windows-0.0.1.zip"
C:\Program Files\Terlang\bin
.exe
to the bin\
subfolderter
command in PowerShell or CMDUbuntu:
wget https://github.com/terroo/terlang/releases/download/v0.0.1/terlang-ubuntu-24-04-0.0.1.zip unzip terlang-ubuntu-24-04-0.0.1.zip sudo mv ter /usr/local/bin
And test:
$ ter ter> output(args()) Ter/Terlang VERSION: 0.0.1 ter> exit
vim hello.ter
// Comment line auto hello = "Hello, Terlang! 😃 "; output(hello); /* Multiline comments */
Semicolon is optional:
auto hello = "Hello, Terlang!"
. Literally skipping the line:out("Hello\n")
Run:
ter hello.ter
Output:
Hello, Terlang! 😃
auto list = {13, 2, 8, 4, 17, 12, 11, 9}; output(list[6]); // 11
for(auto i = 0; i < 5; ++i){ // Or i++ out(to_string(i) + " | ") } out("\n") // 0 | 1 | 2 | 3 | 4 | auto i = 0; while(i < 5){ out(to_string(i) + " | ") ++i; } out("\n") // 0 | 1 | 2 | 3 | 4 |
main.ter
include("./library.ter") output(value); // 18
library.ter
auto value = 18;
set print(str){ output(str); } set add(x, y){ return x + y; } set increment(a){ return ++a; } print("My content"); // My content output(add(3, 9)); // 12 auto result = increment(6); output(result); // 7
class Animal { cat(name){ output("Cat name is: " + name); } dog(){ output("I am dog!"); } descAnimal(human){ return "Human: " + human; } } Animal().cat("Bob"); auto obj = Animal(); obj.dog(); output(obj.descAnimal("Peter"));
Output:
Cat name is: Bob I am dog! Human: Peter
// Rand number auto num = rand(5, 15); output(num) // Number between 5 and 15 // Clock auto myclock = clock(); output(myclock); // Ex.: 1732022610.561000 // Environment variables auto home = getenv("HOME"); output(home); // Ex.: /home/user auto shell = getenv("SHELL") output(shell); // Ex.: /bin/bash // Temporary version auto version = args(); output(version); // Ex.: Ter/Terlang VERSION: 0.0.1
Syntax highlight for Vim:
Syntax highlight for Neovim:
Syntax highlight for VS Code:
Comming soon!