{"id":22530163,"url":"https://github.com/ultimaweapon/nitro","last_synced_at":"2025-07-11T08:36:59.671Z","repository":{"id":91000591,"uuid":"526018842","full_name":"ultimaweapon/nitro","owner":"ultimaweapon","description":"Experimental OOP language that compiled to native code with non-fragile and stable ABI","archived":false,"fork":false,"pushed_at":"2024-06-21T17:59:53.000Z","size":209,"stargazers_count":7,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-09T15:52:36.307Z","etag":null,"topics":["compiler","language","oop"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ultimaweapon.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"COPYING","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},"funding":{"github":"ultimaweapon"}},"created_at":"2022-08-18T01:58:28.000Z","updated_at":"2024-06-21T17:59:57.000Z","dependencies_parsed_at":"2023-09-25T02:01:33.307Z","dependency_job_id":"47ccdf09-9f34-4cf0-99c9-fcdfd52069c3","html_url":"https://github.com/ultimaweapon/nitro","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ultimaweapon/nitro","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ultimaweapon%2Fnitro","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ultimaweapon%2Fnitro/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ultimaweapon%2Fnitro/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ultimaweapon%2Fnitro/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ultimaweapon","download_url":"https://codeload.github.com/ultimaweapon/nitro/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ultimaweapon%2Fnitro/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264766627,"owners_count":23660803,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["compiler","language","oop"],"created_at":"2024-12-07T07:18:33.843Z","updated_at":"2025-07-11T08:36:59.637Z","avatar_url":"https://github.com/ultimaweapon.png","language":"Rust","funding_links":["https://github.com/sponsors/ultimaweapon"],"categories":[],"sub_categories":[],"readme":"# Nitro\n\nNitro is an experimental **OOP language** with the following goals:\n\n- [x] Compiled to **native code** like C/C++/Go or Rust.\n- [ ] **[Non-fragile](https://en.wikipedia.org/wiki/Fragile_binary_interface_problem)** and\n  **stable** ABI.\n- [x] A Nitro library will be distributed as a **compiled binary** similar to JAR or DLL file, not\n  as a source code like most languages did.\n- [x] Built-in **cross compilation** (e.g. one can produce Linux binary on Windows).\n- [ ] **GC** using reference counting.\n- [ ] **Runtime reflection**.\n- [ ] Error handling using **exception**.\n- [ ] **No null** value (except a pointer).\n- [ ] **Option type**.\n\nNitro borrowed most of the syntax from Rust except:\n\n- Nitro is an OOP language like Java or C#.\n- Easy to learn, especially for people who already know Java, C# or Rust.\n- No lifetime, no borrow checker, no const VS mut.\n- No borrowed and owned type like `str` and `String`.\n- Use exception like Java or C# for error handling (no checked exception).\n- Nitro was designed for application programming rather than systems programming.\n\n## Different from Java or C#\n\nThe main different is Nitro compiled to **native code** instead of Java bytecode or Common\nIntermediate Language, which can be run **without a VM**. The benefit with this are:\n\n- Low memory footprint.\n- Fast startup.\n- Can be run on a client machine directly without a VM.\n- Easy to interop with other languages.\n\n## Different from Swift and D\n\nThe reason Nitro was born is because of:\n\n- D has fragile ABI.\n- Swift does not support namespace.\n\n## Current state\n\nI'm currently writing the stage 0 compiler along side the `std` library. The goal of stage 0\ncompiler is to compile the `std` and `cli`. Once the first version of `cli` is fully working Nitro\nwill become a self-hosted language.\n\n## Example\n\n```\n@pub\nclass Allocator;\n\nimpl Allocator {\n    @pub\n    fn Alloc(size: UInt, align: UInt): *UInt8 {\n        @if(unix)\n        let ptr = aligned_alloc(align, size);\n\n        @if(win32)\n        let ptr = _aligned_malloc(size, align);\n\n        if ptr == null {\n            @if(os != \"windows\")\n            abort();\n\n            @if(os == \"windows\")\n            asm(\"int 0x29\", in(\"ecx\") 7, out(!) _);\n        }\n\n        ptr\n    }\n\n    @pub\n    fn Free(ptr: *UInt8) {\n        @if(unix)\n        free(ptr);\n\n        @if(win32)\n        _aligned_free(ptr);\n    }\n\n    @if(unix)\n    @ext(C)\n    fn aligned_alloc(align: UInt, size: UInt): *UInt8;\n\n    @if(unix)\n    @ext(C)\n    fn free(ptr: *UInt8);\n\n    @if(win32)\n    @ext(C)\n    fn _aligned_malloc(size: UInt, align: UInt): *UInt8;\n\n    @if(win32)\n    @ext(C)\n    fn _aligned_free(ptr: *UInt8);\n\n    @if(unix)\n    @ext(C)\n    fn abort(): !;\n}\n```\n\n## Build from source\n\n### Prerequisites\n\n- Git\n- Rust\n- C++ toolchain (e.g. MSVC, XCode, GCC)\n- CMake\n\n### Download the source\n\nYou need to clone this repository with submodules like this:\n\n```sh\ngit clone --recurse-submodules https://github.com/ultimaweapon/nitro.git\n```\n\n### Build dependencies\n\nRun the following command in the root of this repository:\n\n#### Linux and macOS\n\n```sh\nCMAKE_BUILD_PARALLEL_LEVEL=2 ./build-deps.sh\n```\n\n#### Windows\n\n```powershell\n.\\build-deps.ps1\n```\n\n### Build CLI\n\n#### Linux and macOS\n\n```sh\n./build-cli.sh\n```\n\nSupply `debug` as a first argument if you want to hack on Nitro.\n\n#### Windows\n\n```powershell\n.\\build-cli.ps1\n```\n\nSet parameter `Type` to `debug` if you want to hack on Nitro (e.g. `.\\build-cli.ps1 -Type debug`).\n\n### Build distribution\n\n#### Linux and macOS\n\n```sh\n./build-dist.sh\n```\n\n#### Windows\n\n```powershell\n.\\build-dist.ps1\n```\n\n## License\n\nBSD-2-Clause Plus Patent License\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fultimaweapon%2Fnitro","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fultimaweapon%2Fnitro","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fultimaweapon%2Fnitro/lists"}