Programming language for scripting with syntax similar to C++
- Building and Installing on UNIX-style systems
- Building and Installing on Windows
- Only installing on Windows or Ubuntu
- Using
- Tutorials
- Extensions and LICENSE
C++23
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 buildREPL:
To test the
tercommand.
$ ter
ter> output("Hello Ter!")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
tercommand.
ter --version
Ter/Terlang v0.1.1
Usage:
ter [filename].ter
ter -e '<script>'Windows:
Invoke-WebRequest -Uri "https://github.com/terroo/terlang/releases/download/v0.0.1/terlang-windows-0.0.1.zip"- Unzip
- Create folders and subfolders:
C:\Program Files\Terlang\bin - Move the
.exeto thebin\subfolder - Add the path as an environment variable to just the
tercommand in PowerShell or CMD
Ubuntu:
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/binAnd test:
ter --version
Ter/Terlang v0.1.1
Usage:
ter [filename].ter
ter -e '<script>'
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.terOutput:
Hello, Terlang! π
auto list = {13, 2, 8, 4, 17, 12, 11, 9};
output(list[6]); // 11for(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); // 7class 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
// Exec shell
exec("ls")
// Compiling C++ code
exec("g++ main.cpp")
exec("./a.out")
params.ter
auto params = args()
output(params)Example 01, withOUT params:
ter params.ter
[]Example 02, WITH params:
ter params.ter first second --third "My Four"
[first, second, --third, My Four]Example 02, WITH ESPECIFIC param:
params.ter
auto params = args()
output(params[0])ter params.ter file.txt
file.txtter -e 'output("Hello, Word!")'
ter -e 'auto x = 9 output(x)'
ter -e 'auto var = 42;out(to_string(var) + "\n")'
ter -e "$(cat build.ter)"11. Using Emscripten
Compiling:
emmake cmake -B web .
cd web
emmake makeTesting:
node ter.js -e 'output("Hello, Word!")'
node ter.js -e 'auto var = 42;out(to_string(var) + "\n")'
node ter.js -e "$(cat build.ter)"From video.
Helper:
ter --helpStay tuned for the version:
ter --version
Created by Saymon Macedo.
Based on these tests that were done.
speed.ter
for(auto i = 0; i < 1000000; ++i){
out("Ok" + to_string(i) + "\r")
}Run time ter speed.ter and result:
Ok999999
real 0m2,632s
user 0m2,500s
sys 0m0,110s