Home 0P3N Blog Juliar Overview
Ready to Start Your Career?
Create Free Account
Rattar s profile image
By: Rattar
February 9, 2017

Juliar Overview

By: Rattar
February 9, 2017
Rattar s profile image
By: Rattar
February 9, 2017
matrix-1799661_1280Intro
Juliar.Future is the latest iteration of Juliar Programming Language. The compiler is built on top of JAVA, so everywhere JAVA can run, the compiler can run. 
This is a huge step we've taken to eliminate having to build a compiler for each version.

Download
First thing first, you'll need to download the latest version of Juliar.Future at: https://www.juliar.org/downloads.ju
You should get JuliarCompiler.jar
Compile
JuliarCompiler.jar works on all platforms that have JAVA installed. So it is system independent!
Run it in CommandPrompt/Console using the following command: 

`java -jar JuliarCompiler.jar something.jrl output`

Where something.jrl is Juliar script and output is output name.
Because Juliar compiles directly into JAVA bytecode, Juliar programs can run anywhere JAVA is installed.

Why?
You might be wondering, why should you use Juliar instead of JAVA? The reason is that Juliar is less imperative and more functional. It can; however, be used as an Object Oriented programming language. Juliar's aim is to provide the same features of any modern imperative language such as C++ and JAVA and put a twist by adding functional components. Juliar is an easy, fast, and fun language to use.

Creating Juliar File
Create a text file called "something.jrl". jrl is the extension juliar uses for its files! You can name it anything you want as long as it has an extension of .jrl. 
First you need a main function,

`
function main() = {


}
`

The main function is the entry point of the code. If you do not have a main function, that means the code cannot be run directly. The point of having the main function is so that when code runs directly, it will perform some action. You might not need to perform that action if the code is included in.  Please keep in mind that if you have a main function in an included script, it won't run unless you explicitly call the main function in that included script.

Creating and calling a custom functionCreating a custom function is very simple:`function foo() = {}`Where foo is the function name. You might be wondering why is there an equal sign? The reason is that '=' sign copies the content of {} into a callable function.
Juliar is also partly a functional language and if you do not include '='. Juliar would think that you are getting back an object from foo() call and applying {}  on it. So potentially you can have something like function foo(x){3,2} = { return x+$} which will return x+3,x+2 as an object array.Calling a function is very simple:`functionToCall(x,y);`Where x and y are variables. You can call custom functions the same way.HoistingJuliar supports function hoisting. Unlike C/C++, functions can be declared in any order (even if they are declared after a functional call).Dynamic or Static CastingJuliar supports both static and dynamic casting. It is, however, recommended that you static type variables (i.e. declare their type such as int, float, double, etc)
and dynamic cast the function so that you don't need to create a template.
Function Overloading

Juliar currently doesn't support overloading. However, this may change in the future. Let us know how you feel.

Variable DeclarationVariables are declared using one of the following declarations: int, double, float, string, obj. Please note, if you are not sure what type is going to be, you can let the compilerdecide by using var instead.Printing to Screen

Juliar has lots of options for printing to the screen. If you just want to print, use printLine("something"). If you know the type or want to cast it to a different type, consider using printInt(64), printFloat(2.3), printDouble(.312321).Writing/Opening FilesJuliar uses "Open Format" standard for opening and storing files. Hence, it should potentially work on all Operating Systems. To Open a file just do`fileOpen("filename")`Prefix NotationJuliar allows prefix notation. That means you can arithmetic functions such as +,-,/,* and % before each operation and it will apply to everything after it.For example, you can do:`int x = + 3 2 5 10;`which is equivalent of doing`int x = 3 + 2 + 5 + 10;`This is useful to do when you have a huge file.
Schedule Demo

Build your Cybersecurity or IT Career

Accelerate in your role, earn new certifications, and develop cutting-edge skills using the fastest growing catalog in the industry