{"id":42690881,"url":"https://github.com/rickisgone/tungsten","last_synced_at":"2026-04-29T22:03:50.575Z","repository":{"id":271763212,"uuid":"913986329","full_name":"RickIsGone/tungsten","owner":"RickIsGone","description":"A statically typed compiled programming language inspired by C++ and Java written in C++20","archived":false,"fork":false,"pushed_at":"2026-04-28T10:45:01.000Z","size":1880,"stargazers_count":19,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-04-28T12:30:56.473Z","etag":null,"topics":["build-system","compiler","languages","package-manager","programming-language"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/RickIsGone.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-01-08T18:20:29.000Z","updated_at":"2026-04-28T10:45:04.000Z","dependencies_parsed_at":"2026-01-29T13:00:28.002Z","dependency_job_id":null,"html_url":"https://github.com/RickIsGone/tungsten","commit_stats":null,"previous_names":["rickisgone/tungsten"],"tags_count":28,"template":false,"template_full_name":null,"purl":"pkg:github/RickIsGone/tungsten","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RickIsGone%2Ftungsten","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RickIsGone%2Ftungsten/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RickIsGone%2Ftungsten/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RickIsGone%2Ftungsten/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RickIsGone","download_url":"https://codeload.github.com/RickIsGone/tungsten/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RickIsGone%2Ftungsten/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32445563,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-29T20:22:27.477Z","status":"ssl_error","status_checked_at":"2026-04-29T20:22:26.507Z","response_time":110,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["build-system","compiler","languages","package-manager","programming-language"],"created_at":"2026-01-29T13:00:16.715Z","updated_at":"2026-04-29T22:03:50.570Z","avatar_url":"https://github.com/RickIsGone.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# The Tungsten programming language\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"tungsten logo.png\" alt=\"the tungsten logo\" width=\"300\" /\u003e\n\u003c/p\u003e\n\n## introduction\n\n*Tungsten* is a statically-typed multi-paradigm compiled programming language made with the LLVM framework and inspired\nby C++ and Java\n\n## Example\n\nBelow is a snippet of code which shows some of the basic functionalities of tungsten\n\n```c++\nfun fibonacci(i64 n) -\u003e i64 {\n   if (n \u003c= 1) \n      ret n;\n   ret fibonacci(n - 1) + fibonacci(n - 2);\n}\n\nfun main() -\u003e i32 {\n   for (i64 i = 0; i \u003c 10; ++i) {\n      print(\"fibonacci(%lu) = %lu\\n\", i, fibonacci(i));\n   }\n   ret CodeSuccess;\n}\n```\n\n\u003e [!WARNING]\n\u003e the language is still under development, and everything is subject to change\n\n\u003c!-- # Trying the language\n\nif you want to try *Tungsten* before installing the compiler, feel free to do so on\nthe [online tungsten compiler](https://rickisgone.hackclub.app) --\u003e\n\n# VSCode Extension\n\nYou can install the VSCode extension for *Tungsten* from\nthe [VSCode marketplace](https://marketplace.visualstudio.com/items?itemName=RickIsGone.tungsten)\nor by searching for `tungsten` in the extensions tab of VSCode.\nYou'll need to have the compiler installed on your system for the extension to work properly.\n\n# Installation\n\nYou have two options to get Tungsten:\n\n## Option 1: Download Pre-compiled Binaries\n\nYou can download pre-compiled binaries from\nthe [GitHub Releases page](https://github.com/rickisgone/tungsten/releases/latest).\n\nAvailable packages:\n\n- **Windows**: `.zip`, `.msi`, `.7z` packages\n- **Linux (Ubuntu)**: `.deb`, `.tar.gz`, `.7z`, `.sh` packages\n\n\u003c!-- - **macOS**: `.tar.gz`, `.7z`, `.dmg` packages --\u003e\n\nSimply download the appropriate package for your platform.\n\n## Option 2: Build from Source\n\nIf you prefer to build from source or need the latest development version, follow the building instructions below.\n\n# Building\n\n| Platform | Build Status                                                                                                                                                                             |\n|----------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Ubuntu   | [![Ubuntu Build](https://github.com/rickisgone/tungsten/actions/workflows/Ubuntu%20build.yml/badge.svg)](https://github.com/rickisgone/tungsten/actions/workflows/Ubuntu%20build.yml)    |\n| Windows  | [![Windows Build](https://github.com/rickisgone/tungsten/actions/workflows/Windows%20Build.yml/badge.svg)](https://github.com/rickisgone/tungsten/actions/workflows/Windows%20Build.yml) |\n| Mac      | [![macOS build](https://github.com/RickIsGone/tungsten/actions/workflows/MacOS%20build.yml/badge.svg)](https://github.com/RickIsGone/tungsten/actions/workflows/MacOS%20build.yml)       |\n\n## Prerequisites\n\nGlobal\n\n- cmake 3.28 or newer\n- git\n\nCompiler\n\n- LLVM 18 or newer\n- ZLIB (windows only)\n\nPackage Manager\n\n- Libcurl\n- libarchive\n\nIf you are on windows i'd suggest using [vcpkg](https://github.com/microsoft/vcpkg) to install the dependencies\n\n\u003e [!IMPORTANT]\n\u003e this project uses C++ modules, which are currently not supported by all compilers and CMake generators, so make sure\n\u003e to use both a compiler and a CMake generator that supports modules\n\n\u003cins\u003e **1. Cloning the repo:** \u003c/ins\u003e\n\nStart by cloning the repo with `git clone https://github.com/rickisgone/tungsten`\nafter doing this follow the instruction for the targeted OS\n\n\u003cdetails\u003e\u003csummary\u003e\u003cbig\u003eWINDOWS\u003c/big\u003e\u003c/summary\u003e\u003cp\u003e\n\n\u003cins\u003e **2. Compiling the project:** \u003c/ins\u003e\n\nHere I'm using vcpkg:\n\n```bash\ncmake -B build -S . -DCMAKE_TOOLCHAIN_FILE='VCPKG_DIR\\scripts\\buildsystems\\vcpkg.cmake'  -DVCPKG_TARGET_TRIPLET=x64-windows-static -DLLVM_DIR='VCPKG_DIR/installed/x64-windows-static/share/llvm/' -Dzstd_DIR='VCPKG_DIR/installed/x64-windows-static/share/zstd'\ncmake --build build --config Release\n```\n\nreplace `VCPKG_DIR` with the vcpkg directory\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\u003csummary\u003e\u003cbig\u003eLINUX\u003c/big\u003e\u003c/summary\u003e\u003cp\u003e\n\n\u003cins\u003e **2. Compiling the project:** \u003c/ins\u003e\n\n*the default compiler and CMake generator on linux (gcc and Make) don't support modules, so I'll be using Clang and\nNinja in the example below*\n\n```bash\ncmake -S . -B build -GNinja -DCMAKE_CXX_COMPILER=clang++\ncmake --build build --config Release\n```\n\n\u003c/details\u003e\u003cp\u003e\n\n\u003c!-- \u003cdetails\u003e\u003csummary\u003e\u003cbig\u003eMacOS\u003c/big\u003e\u003c/summary\u003e\u003cp\u003e\n\n\u003cins\u003e **2. Compiling the project:** \u003c/ins\u003e  \n\n```bash\ncmake -DLLVM_DIR=$(brew --prefix llvm)/lib/cmake/llvm -S . -B build -GNinja -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang\ncmake --build build --config Release\n```\n\n\u003c/details\u003e\u003cp\u003e --\u003e\n\n# Syntax\n\n## Variables declaration\n\nTungsten has a similar naming convention to Rust, where base types are written in **camelCase** and structs and classes\nare written in **PascalCase**\n\n| Type     | Alignment (Bytes) |\n|----------|-------------------|\n| `void`   | N/A               |\n| `int`    | 4                 |\n| `uint`   | 4                 |\n| `float`  | 4                 |\n| `f32`    | 4                 |\n| `double` | 8                 |\n| `f64`    | 8                 |\n| `char`   | 2                 |\n| `bool`   | 1                 |\n| `String` | N/A               |\n| `i8`     | 1                 |\n| `i16`    | 2                 |\n| `i32`    | 4                 |\n| `i64`    | 8                 |\n| `i128`   | 16                |\n| `u8`     | 1                 |\n| `u16`    | 2                 |\n| `u32`    | 4                 |\n| `u64`    | 8                 |\n| `u128`   | 16                |\n\nTungsten has also a variadic type called `argPack` which is just like `...` in C\n\n\u003e [!NOTE]\n\u003e all variables are initialized to 0 by default and pointers are initialized to nullptr\n\n### Stack allocation\n\n```rust\ni64 myVariable = 247;\ni64 myVariable{247};\n```\n\n### Heap allocation\n\n```c++\nint* myPointer = new int{247};\n```\n\nTo free the pointer:\n\n```c++\nfree myPointer;\n```\n\nfree also sets the address pointed by the pointer to `nullptr`\n\n\u003e [!WARNING]\n\u003e Tungsten doesn't have a garbage collector so you have to manually free the pointers\n\n## Arrays\n\n### Stack allocation\n\n```c++\nint[10] myArray;\n```\n\n### Heap allocation\n\n```c++\nint* myArray = new int[10];\n```\n\nTo free the array:\n\n```c++\nfree myArray;\n```\n\nthis works for both normal and multidimensional arrays.\n\n## References\n\nreferences just just like in C++ are pointers which can't be reassigned and you need to specify an address when\ndeclaring them:\n\n```c++\nint var;\nint\u0026 ref = \u0026var;\n```\n\nunlike in C++ to pass them to functions you need to do it explicitly:\n\n```rust\ni64 var;\nfun(\u0026var);\n```\n\n## Control flow statements\n\n### If\n\nIf statements are written just like in C++\n\n```cpp\nif (condition) {\n    // do stuff\n} else {\n    // do other stuff\n}\n```\n\nAnd just like in C++ you can avoid using braces for single instructions\n\n```cpp\nif (condition)\n    // do stuff\nelse \n    // do other stuff\n```\n\n### While\n\nUnlike in C++, while statements require braces to work\n\n```cpp\nwhile (condition) {\n    // do stuff\n}\n```\n\n### Do while\n\nDo whiles instead are just like in C++\n\n```cpp\ndo {\n    // do stuff\n} while(condition);\n```\n\n### For\n\nFor statements just like while statements require braces to work\n\n```rust\nfor (i64 i = 0; i \u003c 10; + + i) {\n// do stuff\n}\n```\n\n## Functions\n\nRather than a C++ aproach, functions are more similar to Rust's:\n\n```rust\nfun myFunction() -\u003e i64 {\n   ret 247;\n}\n```\n\nYou can return arrays by doing:\n\n```c++\nfun myfunction() -\u003e int[3] {\n    int[3] array{2, 4, 7};\n    ret array;\n}\n```\n\nOr you can allocate on the heap and use a pointer:\n\n```c++\nfun myFunction() -\u003e int* {\n    int* array = new int[3]{2, 4, 7};\n    ret array;\n}\n```\n\n### Extern Functions\n\nThere are two types of extern functions\n\n- C functions\n- tungsten functions\n\nYou can import C functions with\n\n```cpp\nextern \"C\" fun myCFun() -\u003e void;\n```\n\nand tungsten functions with\n\n```cpp\nextern fun myFun() -\u003e void;\n```\n\n### Main Function\n\nThe `main` function can return either `int` or `i32`. Command line arguments are passed like in C with\n`int argc, String* argv` or `i32 argc, char** argv`.\nIf no return value is provided, `0` will be returned by default.\n\n```c++\nfun main(int argc, String* argv) -\u003e int {\n    /* your code */\n    ret CodeSuccess;\n}\n```\n\nIf you don't need the command-line arguments, you can simply omit them:\n\n```c++\nfun main() -\u003e int {\n    /* your code */\n    ret 0;\n}\n```\n\n### integrated Core Functions\n\nTungsten has a reduced number of integrated core functions\n\n| Type     | Name              | Arguments                                    | functionality                                |\n|----------|-------------------|----------------------------------------------|----------------------------------------------|\n| `i32`    | shell             | (String cmd)                                 | same function as`system()` in C              |\n| `void`   | print             | (String fmt, ArgPack)                        | same function as`printf()` in C              |\n| `void`   | input             | (String fmt, ArgPack)                        | same function as`scanf()` in C               |\n| `String` | __builtinFile     | no arguments                                 | returns the name of the file                 |\n| `String` | __builtinFunction | no arguments                                 | returns the name of the function             |\n| `u64`    | __builtinColumn   | no arguments                                 | returns the number of the column             |\n| `u64`    | __builtinLine     | no arguments                                 | returns the number of the line               |\n| `String` | nameof            | (any statement with a name)                  | returns the name of the variable             |\n| `String` | typeof            | (any statement with a type)                  | returns the type of the variable             |\n| `u64`    | sizeof            | (any statement with a type or a type itself) | returns the size of the type of the variable |\n\n## Namespaces\n\nYou can declare namespaces the same as c++:\n\n```c++\nnamespace std {\n    fun a() -\u003e void {}\n}\n```\n\nbut in tungsten you can also declare namespace members outside the namespace block like this:\n\n```c++\nnamespace std {\n    fun a() -\u003e void {}\n}\nfun std::b() -\u003e void {}\n```\n\n## Classes\n\nTungsten also has classes and they are declared like this:\n\n```cpp\nclass Foo {\n   constructor() {}\n   constructor(int init) {this-\u003e_member = init}\n   constructor(const Foo\u0026 other) {}\n\n   destructor() {}\n   \n   fun member() -\u003e int { ret this-\u003e_member; }\n\nprivate:\n   int _member;\n}\n```\n\n### Member access  \n\n```cpp\nfun member() -\u003e int { ret this-\u003e_member; }\n```\n\nAs shown here, to access members of the class you need to use the `this` pointer\n\n### Default visibility  \n\nRather than being private by default like in C++, Tungsten classes are public\n\n### Constructors and destructor\n\n```cpp\nconstructor() {}\nconstructor(int init) {this-\u003e_member = init}\nconstructor(const Foo\u0026 other) {}\ndestructor() {}\n```\n\nConstructors are automatically invoked when creating an object, even if no explicit initialization braces are provided:\n\n```cpp\nFoo foo;\nFoo foo{};\n```\n\nBoth forms will call the default constructor.\n\n#### Default constructors and destructor\n\nIf no default constructor, copy constructor, or destructor is explicitly defined, the compiler will automatically generate them.\n\n## Building a project\n\nTo build a project, you can either compile via cmd by calling the `tungsten` compiler or you can make a `build.tgs` file\nand use the integrated buildsystem\n\n### Compiling via cmd\n\n\u003e [!IMPORTANT]\n\u003e Tungsten currently uses *clang++* to compile the generated llvm ir to an executable, so you need to have it installed\n\u003e for the compiler to work (clang 15 or higher is needed)\n\n```shell\ncd projectDirectory\ntungsten \u003cfile\u003e [flags]\n```\n\n### Compiling via buildsystem\n\n\u003e [!IMPORTANT]\n\u003e Not added yet\n\nA simple project's build file will look something like this:\n\n```c++\nimport build;\n\nProject myProject{Executable, \"myProject\"};\n\nfun main() -\u003e i32 {\n    myProject.addSource(\"main.tgs\");\n    myProject.build();\n}\n```\n\nTo build the file, you'll then have to call the compiler in the directory where the build file is located\n\n```shell\ncd projectDirectory\ntungsten tgs-build [flags] \n```\n\nThe compiler will then automatically compile the `build.tgs` file.\nAfter compiling the file, the compiler will automatically execute the `build` executable which will compile the project\nfollowing the rules set by the `build.tgs` file.\nThe build output will then be put into the `projectDirectory/build` directory\n\n# TPKG\n\n\u003e [!IMPORTANT]\n\u003e Not added yet\n\ntpkg is the package manager included with the *Tungsten programming language*\n\n\u003e [!NOTE]\n\u003e tpkg uses a centralized git directory, which is not checked, meaning it's on the users to open issues reporting\n\u003e malicious packages\n\npackage files are written in **json**, and a simple package file looks like this\n\n```json\n{\n  \"name\": \"myPackage\",\n  \"version\": \"1.0.0\",\n  \"description\": \"my package description\",\n  \"homepage\": \"homepage url\",\n  \"license\": \"MIT/Apache 2.0/ecc.\",\n  \"source\": \"source/release code zip url\",\n  \"dependencies\": [\n    \"your dependencies\"\n  ],\n  \"build\": {\n    \"type\": \"cmd/buildsystem\",\n    \"args\": [\n      \"myargs\"\n    ]\n  }\n}\n```\n\n# License\n\nThis project is licensed under the Apache License 2.0. See the [LICENSE](LICENSE.txt) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frickisgone%2Ftungsten","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frickisgone%2Ftungsten","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frickisgone%2Ftungsten/lists"}