Getting started with CLight
Quickly set up and write your first line of CLight code!
What is CLight?
CLight is a programming language developed by third year Epitech students. Based on C, it reproduces several of the core programming concepts and syntax.
Setup the environment
Follow these instructions to setup your environment:
Update:
sudo apt-get updateInstall stack:
curl -sSL https://get.haskellstack.org/ | shInstall ghc:
sudo apt-get install -y ghcDownload llvm:
wget https://apt.llvm.org/llvm.sh ; chmod +x llvm.sh ; sudo ./llvm.shSetup llvm:
sudo ln -s /usr/bin/llvm-config-9 /usr/bin/llvm-configInstalling the CLight compiler
To be able to program in CLight, you'll first have to download the compiler:
Download the github repository at https://github.com/EpitechPromo2025/B-FUN-500-MPL-5-2-glados-bastien.boymond, and extract.
Install the dependencies:
cd part2; stack --install-ghc build --dependencies-onlyCompile the compiler using the Makefile, with the command:
cd part2; make reYou should now find a new binary called glados in the part2 folder.
Compiling CLight
Start by creating a simple script in a new file. For this example, we'll call it example.cl. Let's add a simple function:
int add(int a, int b) {
return a + b;
}To compile, use the binary called glados:
./glados example.clYou should now have an object file called example.o next to your example.cl script.
Create another script in the language you want. For this example, we'll use the C programming language, and create a new file called main.c.
extern int add(int a, int b);
int main(void)
{
printf("add: %d\n", add(10, 10));
return (0);
}Compile both the main.c file and the example.o file:
gcc main.c example.o -o mainNow if you execute the binary, you should see "add: 20" displayed in the terminal:
./mainLast updated