Base concepts

Every Jarog program in fact is a list of definitions. Definitions are constants, variables or custom types. Jarog supports functional programming so all functions are variables and can be passed as parameters or fetched as results from other functions.

Statements can be declared only inside functions. All statements and definitions are ended with semicolon.

Program should contain variable or constant named main and it must be a function, which accepts list of strings and returns nothing. This is a main entry point for a program.

Language is case insensitive. Comments start with # symbol. Multi-line comments are surrounded with #* and *#. Any program can load other programs as units and import variables, constants or types from them.

Jarog use stack-based virtual machine to execute code. Jarog is provided with two binaries, jacog and jarog, compiler and runtime respectively. Jacog compiles and runs scripts when jarog can only run precompiled scripts. Each script is compiled on the fly before execution if is launched in jacog. Compiled byte-code can be saved to a binary file and executed later with jarog.

Jarog’s Hello World looks next:

load "<io>" as io;

const main := $(
    arg args: list(string);
) do
    io::put("Hello world!");

To run this example save it to a file named hello.jr and execute jacog.exe hello.jr on Windows or jaroc hello.jr if you use Linux. Binaries can be obtained with argument --out. Run jacog.exe --out=hello.jrc hello.jr to compile script and jarog.exe hello.jrc to run precompiled binary.

Run jacog --help to get the full list of acceptable parameters.