Skip to content

Commit

Permalink
Merge pull request #105
Browse files Browse the repository at this point in the history
  • Loading branch information
delasy authored Oct 11, 2024
2 parents 51024be + 690822e commit a93d213
Show file tree
Hide file tree
Showing 98 changed files with 7,988 additions and 1,245 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/cross-compile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ jobs:
platform: windows
steps:
- uses: actions/checkout@v4
- uses: thelang-io/setup-the@v1
- run: sudo apt-get update
- run: sudo apt-get install mingw-w64 ninja-build
- run: curl -fsSL https://cdn.thelang.io/deps.tar.gz | sudo tar -C /usr/local -xz
Expand All @@ -42,7 +41,6 @@ jobs:
run: echo "DEPS_DIR=/usr/local/the/cross-compile/${{ matrix.config.platform }}" >> $GITHUB_ENV
- run: echo "/usr/local/the/osxcross/bin" >> $GITHUB_PATH
- run: sudo sed -i 's/#define _WIN32_WINNT .*/#define _WIN32_WINNT 0x0A00/' /usr/share/mingw-w64/include/_mingw.h
- run: the run scripts/pre-process-codegen
- run: cmake . -B ./build -G Ninja -D BUILD_TESTS=ON -D TEST_CODEGEN_PLATFORM=${{ matrix.config.platform }}
- run: cmake --build build
- run: ctest --output-on-failure --test-dir build
2 changes: 0 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ jobs:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- uses: thelang-io/setup-the@v1
- run: the run scripts/pre-process-codegen
- run: cmake -B ./build -D CMAKE_BUILD_TYPE=Release
- run: cmake --build build
- uses: aws-actions/configure-aws-credentials@v1
Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ jobs:
generator: Visual Studio 17 2022
steps:
- uses: actions/checkout@v4
- uses: thelang-io/setup-the@v1
- if: runner.os == 'Linux'
run: |
sudo apt-get update
Expand All @@ -49,8 +48,6 @@ jobs:
run: brew install ninja
- if: runner.os != 'Windows'
run: uname -a
- run: the -v
- run: the run scripts/pre-process-codegen
- run: curl -fsSL https://cdn.thelang.io/deps.tar.gz -o deps.tar.gz
- run: tar -xzf deps.tar.gz the/native/${{ matrix.config.platform }}
- if: runner.os == 'Linux'
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@
build/
coverage/
lab/
src/codegen-api.hpp
*.out
2 changes: 0 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,9 @@ RUN apt-get update && \

RUN curl -fsSL https://cdn.thelang.io/deps.tar.gz | tar -xz
ENV DEPS_DIR="$PWD/the/native/linux"
RUN curl -fsSL https://cdn.thelang.io/cli | bash

WORKDIR /app
COPY . .
RUN the run scripts/pre-process-codegen
RUN cmake . -G Ninja -D BUILD_TESTS=ON -D TEST_CODEGEN_MEMCHECK=ON
RUN cmake --build .

Expand Down
124 changes: 124 additions & 0 deletions INSTALLATION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
# 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:
```sh
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:
```powershell
irm ps1.thelang.io | iex
```

If that doesn't work, try this one:
```powershell
(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

```sh
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:
```sh
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:
```powershell
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":

```the
main {
print("Hello, World")
}
```

And run it like this:

```sh
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](https://docs.thelang.io/guides/comments.html)
2. [Operations](https://docs.thelang.io/guides/operations.html)
3. [Types](https://docs.thelang.io/guides/types.html)
4. [Mutability](https://docs.thelang.io/guides/mutability.html)
5. [Control Flow](https://docs.thelang.io/guides/control-flow.html)
6. [Iteration](https://docs.thelang.io/guides/iteration.html)
7. Types: [Arrays](https://docs.thelang.io/guides/arrays.html) /
[Enumerations](https://docs.thelang.io/guides/enumerations.html) /
[Objects](https://docs.thelang.io/guides/objects.html) /
[Maps](https://docs.thelang.io/guides/maps.html) /
[Unions](https://docs.thelang.io/guides/unions.html) /
[Functions](https://docs.thelang.io/guides/functions.html) /
[Optionals](https://docs.thelang.io/guides/optionals.html) /
[References](https://docs.thelang.io/guides/references.html) /
[Any](https://docs.thelang.io/guides/any.html)
8. [Anonymous Functions (Closures)](https://docs.thelang.io/guides/anonymous-functions.html)
9. [Variadic Parameters](https://docs.thelang.io/guides/variadics.html)
10. [Type Aliasing](https://docs.thelang.io/guides/type-aliasing.html)
11. [Type Checking](https://docs.thelang.io/guides/type-checking.html)
12. [Type Casting](https://docs.thelang.io/guides/type-casting.html)
13. [Error Handling](https://docs.thelang.io/guides/error-handling.html)
14. [Asynchronous Programming](https://docs.thelang.io/guides/asynchronous-programming.html)
15. [Modules](https://docs.thelang.io/guides/modules.html)
Loading

0 comments on commit a93d213

Please sign in to comment.