
Installation
Click download link and select your own system or package after setup your development environment path to extracted path. If you need to If you want to do development, you can install golang and extract the codes with this command;
go get -v github.com/olproject/olang
and run
olang(.exe) (-r) (-d=true [debug mode])
Thats it.
Files
Olang files is to simple. Default file extension “.ola”. Let’s start by examining the programming language example.
def hello = fn(name){ return "Hello, "+name+"! Welcome to O-lang!" }
def result = hello("Oytun") show(result)
Run:
$ chmod a+x test.ol $ ./test.ol
or
$ olang test.ol
Output:
Hello, Oytun! Welcome to Olang
Loading Modules
Loading modules is too simple.
hello.ol (as hello module):
def hello = fn(name){ show("Hello, "+name+"! Welcome to Olang!") }
load.ol (main file):
#!/usr/bin/env olang load "hello.ol" def name = "Oytun"; hello(name);
Run:
$ olang load.ol
Output:
Hello, Oytun! Welcome to Olang!
System Casts;
System casts is general syntax use for IRL (In Real Life).
Definitions
Simple casting definition; def something = something;
Hash
Simple casting hashes;
def pyramid = {"x":10, "y":10, "z":10} pyramid["x"] # => 10
Array
Simple casting arrays;
def triangle = [10,20,30] triangle[1] # => 10
Integer
Simple casting integer;
def zero = 0 # => 0
String
Simple casting string;
def name = "Oytun" # => "Oytun"
Functions
Simple casting functions;
def sum = fn(x,y){ return x+y; } sum(10,6) # => 16
Process
Simple casting system processes;
proc procname "command" "work path" ["arg1","arg2"]
Socket
Simple casting system sockets;
sock socketname "type" "port" "ip"
Are you ready to write a code. Learn all the structure variables. We’ll go a little deeper in the other article.