Skip to content

Latest commit

 

History

History
124 lines (100 loc) · 4.24 KB

INSTALLATION.md

File metadata and controls

124 lines (100 loc) · 4.24 KB

How To Install

Updated: Oct 10, 2024

Important

I tested it only on macOS. Windows commands is what I remember of how it should work. If you have suggestions feel free to tell me on Discord or create a PR.

CLI

First you need CLI to orchestrate the compiler.

For Unix:

curl -fsSL sh.thelang.io | bash

In case you are curious what it does, you can check here: https://github.com/thelang-io/cli/blob/main/install.sh

For Windows:

irm ps1.thelang.io | iex

If that doesn't work, try this one:

(New-Object System.Net.WebClient).DownloadString('https://ps1.thelang.io/') | iex

In case you are curious what it does, you can check here: https://github.com/thelang-io/cli/blob/main/install.ps1

Test CLI Installation

the -v

If that doesn't work you probably need to re-login into your terminal.

Before Downloading Compiler

Before, everything was compiled on cloud servers. After Oct 2024, I disabled cloud servers (I paid $600 for the last year and nobody used it). To compile you will need a compiler now :)

Before you will get a compiler you will need to have CMake installed: https://cmake.org/download/

Next thing you need to download prebuilt dev version of OpenSSL from: https://cdn.thelang.io/deps.tar.gz and unpack the file. It will contain folder "native" with your platform inside of it. This is needed by compiler itself when you are compiling programs that require SSL support.

After that you need to create system environment variable or add it to your ~/.profile:

DEPS_DIR="path/to/native/$platform"

Building Compiler

This is how to build a compiler from source on Unix:

git clone --depth=1 -b feat-new-codegen --single-branch https://github.com/thelang-io/the.git
cmake the -B the/build -D CMAKE_BUILD_TYPE=Release
cmake --build the/build
cp the/build/the ~/.the/bin/thex
rm -rf the

And this is how to build a compiler from source on Windows:

git clone --depth=1 -b feat-new-codegen --single-branch https://github.com/thelang-io/the.git
cmake the -B the/build -D CMAKE_BUILD_TYPE=Release
cmake --build the/build
Copy-Item "the/build/Debug/the.exe" -Destination "$env:UserProfile/The/bin/thex.exe"
Remove-Item -Recurse -Force the

That should be it!

Test Installation

Create a file, eg "main.the":

main {
  print("Hello, World")
}

And run it like this:

the run main.the --compiler=thex

Important

If you don't add --compiler=thex it will try to run on cloud server, and you will get an error.

Further Reading

Remember, this is old version that is built using C++. This version is slow, and I'm aware of that. The new version, where it's much faster and self-compiles, is still in development. Expected to be released by the end of 2024.

  1. Comments
  2. Operations
  3. Types
  4. Mutability
  5. Control Flow
  6. Iteration
  7. Types: Arrays / Enumerations / Objects / Maps / Unions / Functions / Optionals / References / Any
  8. Anonymous Functions (Closures)
  9. Variadic Parameters
  10. Type Aliasing
  11. Type Checking
  12. Type Casting
  13. Error Handling
  14. Asynchronous Programming
  15. Modules