العربية

Alusus Building and Running Instructions

Note: Build scripts depends on GIT tags to determine the version number. If you copy the source files outside the GIT repository and build from there you'll get a version number of 0.0.0-DEV.

External Dependencies

Following is the list of dependencies you'll need to build the project from the source code.

LLVM 3.3

In addition to the dependencies mentioned above, you'll need GCC (version 7 or above), CMake, Gawk, and PHP to be able to build the binaries from the source code. LLVM also has its own dependencies like valgrind for example. To install the build tools in Ubuntu use the following command:
$ sudo apt-get install gcc g++ cmake gawk php-cli
And for Fedora use the following:
$ sudo dnf install gcc gcc-c++ cmake gawk php valgrind valgrind-devel
Notice the need to install valgrind in Fedora in order to be able to build LLVM. We didn't need to install valgrind in Ubuntu. You might also need to install other packages if you are using distros other than the above. Visit LLVM's website for more details on how to build it.
Note: You'll need GCC version 7 or newer. You won't be able to build Alusus code with older versions.

Building Using build.sh

This is the simpler and the recommended method to build. Inside build.sh there are some variables that can be modified. Among those is MAKE_THREAD_COUNT which defines the number of threads to use when building LLVM and Alusus. This is preset to 8 to speed up the build process, but you can lower it if you face problems or if your computer is not capable of handling that much threads efficiently.
If you face problems during the build of LLVM you might need to modify the cmake command inside build.sh by giving it extra arguments, like -DLLVM_TARGET_ARCH.

Building Manually

Executing Automated Tests

Executing the automated tests is simple. All you need to do is to run the following command inside the Alusus' build folder (Builds in the example above) after the build is complete:
$ make test

Using Alusus

After the build is complete you'll have the executable under Bin and the libraries will go under Lib. You'll be able to run the examples as follows:
$ export PATH=<path-to-Alusus>/Bin:$PATH
$ cd <path-to-Alusus>/Examples
$ alusus hello_world.alusus
The Core's executalbe's name when building in debug mode will be alusus.dbg. If the build is in release mode the name will be alusus, i.e. without the dbg extension.

If the Core is built in debug mode logging can be enabled using the --log command line argument, which accepts a number representing the details level of the log as in the following example:

$ alusus helloworld.alusus --log 16
The details level is determined through binary flags representing each different details level with the least significant bit representing the lowest level. A value of 1 for each level means details for that level will be logged to the screen. The following table explains the different levels:
Lexer, low level = 1
Lexer, mid level = 2
Lexer, high level = 4
Parser, low level = 8
Parser, mid level = 16
Parser, high level = 32
The flags can be combined to display more than one level at the same time. For example, a value of 7 means logging all levels for the lexer.

Copyright (C) 2018 Sarmad Khalid Abdullah.
This file is released under Alusus Public License, Version 1.0. For details on usage and copying conditions read the full license in the accompanying license file or at http://alusus.net/alusus_license_1_0.