{"id":13606172,"url":"https://github.com/austral/austral","last_synced_at":"2025-04-08T13:06:09.013Z","repository":{"id":37015459,"uuid":"150195755","full_name":"austral/austral","owner":"austral","description":"Systems language with linear types and capability-based security.","archived":false,"fork":false,"pushed_at":"2024-06-24T22:21:08.000Z","size":4781,"stargazers_count":1116,"open_issues_count":21,"forks_count":41,"subscribers_count":29,"default_branch":"master","last_synced_at":"2024-10-29T17:43:21.297Z","etag":null,"topics":["capabilities","compiler","linear-types"],"latest_commit_sha":null,"homepage":"https://austral-lang.org/","language":"OCaml","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/austral.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":"ROADMAP.md","authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-09-25T02:21:49.000Z","updated_at":"2024-10-28T20:54:08.000Z","dependencies_parsed_at":"2023-02-18T11:01:34.615Z","dependency_job_id":"7ec1412c-bf1b-48b6-9d08-b094491d0289","html_url":"https://github.com/austral/austral","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/austral%2Faustral","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/austral%2Faustral/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/austral%2Faustral/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/austral%2Faustral/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/austral","download_url":"https://codeload.github.com/austral/austral/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247847609,"owners_count":21006099,"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":["capabilities","compiler","linear-types"],"created_at":"2024-08-01T19:01:06.709Z","updated_at":"2025-04-08T13:06:08.993Z","avatar_url":"https://github.com/austral.png","language":"OCaml","readme":"# Austral\n\n![Build status badge](https://github.com/austral/austral/actions/workflows/build-and-test.yml/badge.svg)\n\nAustral is a new language.\n\nFeatures:\n\n- **Linear types**: linear types allow resources to be handled in a\n  provably-safe manner. Memory can be managed safely and without runtime\n  overhead, avoiding double `free()`, use-after-`free` errors, and double fetch\n  errors. Other resources like file or database handles can also be handled\n  safely.\n\n- **Capabilities**: linear [capabilities][cap] enable fine-grained permissioned\n  access to low-level facilities. Third-party dependencies can be constrained in\n  what types of resources they can access. This makes the language less\n  vulnerable to [supply chain attacks][sca].\n\n- **Typeclasses**: typeclasses, borrowed from Haskell, allow for bounded ad-hoc\n  polymorphism.\n\n- **Safe Arithmetic**: Austral has well-defined semantics for all arithmetic\n  operations on numeric types. There are distinct operations for\n  trap-on-overflow arithmetic and modular arithmetic, as in Ada.\n\n- **Algebraic Data Types**: algebraic data types, as in ML or Haskell, with\n  exhaustiveness checking.\n\nAnti-features:\n\n- No garbage collection.\n- No destructors.\n- No exceptions (and no surprise control flow).\n- No implicit function calls.\n- No implicit type conversions.\n- No implicit copies.\n- No global state.\n- No subtyping.\n- No macros.\n- No reflection.\n- No Java-style @Annotations.\n- No type inference, type information flows in one direction.\n- No uninitialized variables.\n- No pre/post increment/decrement (`x++` in C).\n- No first-class async.\n- No function overloading (except through typeclasses, where it is bounded).\n- No arithmetic precedence.\n- No variable shadowing.\n\n## Example\n\nCalculate and print the 10th Fibonacci number:\n\n```ml\nmodule body Fib is\n    function fib(n: Nat64): Nat64 is\n        if n \u003c 2 then\n            return n;\n        else\n            return fib(n - 1) + fib(n - 2);\n        end if;\n    end;\n\n    function main(): ExitCode is\n        print(\"fib(10) = \");\n        printLn(fib(10));\n        return ExitSuccess();\n    end;\nend module body.\n```\n\nBuild and run:\n\n```bash\n$ austral compile fib.aum --entrypoint=Fib:main --output=fib\n$ ./fib\nfib(10) = 55\n```\n\n## Building with Nix\n\nIf you have [Nix][nix], this will be much simpler. Just:\n\n[nix]: https://nixos.org/\n\n```bash\n$ nix-shell\n$ make\n```\n\nAnd you're done.\n\n## Building without Nix\n\nBuilding the `austral` compiler requires `make` and the `dune` build system for\nOCaml, and a C compiler for building the resulting output. You should install\nOCaml 4.13.0 or above.\n\nFirst:\n\n```bash\n$ git clone git@github.com:austral/austral.git\n$ cd austral\n```\n\nNext, install [opam][opam]. On Debian/Ubuntu you can just do:\n\n```bash\n$ sudo apt-get install opam\n$ opam init\n```\n\nThen, create an opam switch for austral and install dependencies via opam:\n\n```bash\nopam switch create austral 4.13.0\neval $(opam env --switch=austral)\nopam install --deps-only -y .\n```\n\nFinally:\n```bash\nmake\n```\n\nTo run the tests:\n\n```bash\n$ ./run-tests.sh\n```\n\nTo build the standard library:\n\n```bash\n$ cd standard\n$ make\n```\n\n## Usage\n\nSuppose you have a program with modules `A`, `B`, and `C`, in the following\nfiles:\n\n```\nsrc/A.aui\nsrc/A.aum\n\nsrc/B.aui\nsrc/B.aum\n\nsrc/C.aui\nsrc/C.aum\n```\n\nTo compile this, run:\n\n```bash\n$ austral compile \\\n    src/A.aui,src/A.aum \\\n    src/B.aui,src/B.aum \\\n    src/C.aui,src/C.aum \\\n    --entrypoint=C:main \\\n    --output=program\n```\n\nThe `--entrypoint` option must be the name of a module, followed by a colon,\nfollowed by the name of a public function with either of the following\nsignatures:\n\n1. `function main(): ExitCode;`\n2. `function main(root: RootCapability): ExitCode;`\n\nThe `ExitCode` type has two constructors: `ExitSuccess()` and `ExitFailure()`.\n\nFinally, the `--output` option is just the path to dump the compiled C to.\n\nBy default, the compiler will emit C code and invoke `cc` automatically to\nproduce an executable. To just produce C code, use:\n\n```bash\n$ austral compile --target-type=c [modules...] --entrypoint=Foo:main --output=program.c\n```\n\nIf you don't need an entrypoint (because you're compiling a library), instead of\n`--entrypoint` you have to pass `--no-entrypoint`:\n\n```bash\n$ austral compile --target-type=c [modules...] --no-entrypoint --output=program.c\n```\n\nIf you just want to typecheck without compiling, use the `tc` target type:\n\n```bash\n$ austral compile --target-type=tc [modules...]\n```\n\nGenerated C code should be compiled with:\n\n```bash\n$ gcc -fwrapv generated.c -lm\n```\n\n## Status\n\n1. The bootstrapping compiler, written in OCaml, is implemented. The main\n   limitation is it does not support separate compilation. In practice this is\n   not a problem: there's not enough Austral code for this to matter.\n\n2. The compiler implements every feature of the spec.\n\n3. A standard library with a few basic data structures and capability-based\n   filesystem access is being designed.\n\n## Contributing\n\nSee: [`CONTRIBUTING.md`](https://github.com/austral/austral/blob/master/CONTRIBUTING.md)\n\n## Community\n\n- [Discord](https://discord.gg/8cEuAcD8pM)\n\n## Roadmap\n\nCurrently:\n\n- Expanding the [standard\n  library](https://github.com/austral/austral/tree/master/standard).\n\nNear-future work:\n\n- Build tooling and package manager.\n\n# License\n\nCopyright 2018–2023 [Fernando Borretti][fernando].\n\nLicensed under the [Apache 2.0 license][apache] with the [LLVM exception][llvmex]. See the [LICENSE file][license] for details.\n\n[opam]: https://opam.ocaml.org/doc/Install.html\n[cap]: https://en.wikipedia.org/wiki/Capability-based_security\n[sca]: https://en.wikipedia.org/wiki/Supply_chain_attack\n[fernando]: https://borretti.me/\n\n[apache]: https://www.apache.org/licenses/LICENSE-2.0\n[llvmex]: https://spdx.org/licenses/LLVM-exception.html\n[license]: https://github.com/austral/austral/blob/master/LICENSE\n","funding_links":[],"categories":["OCaml","Other"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faustral%2Faustral","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faustral%2Faustral","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faustral%2Faustral/lists"}