https://github.com/chaos-lang/chaos
The Chaos Programming Language
https://github.com/chaos-lang/chaos
chaos chaos-language cyclomatic-complexity functional immutability procedural programming-language typesafe
Last synced: 3 months ago
JSON representation
The Chaos Programming Language
- Host: GitHub
- URL: https://github.com/chaos-lang/chaos
- Owner: chaos-lang
- License: gpl-3.0
- Created: 2019-12-21T18:54:08.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2022-08-17T10:53:03.000Z (almost 3 years ago)
- Last Synced: 2024-08-02T03:07:56.642Z (11 months ago)
- Topics: chaos, chaos-language, cyclomatic-complexity, functional, immutability, procedural, programming-language, typesafe
- Language: C
- Homepage: https://chaos-lang.org
- Size: 2.09 MB
- Stars: 278
- Watchers: 13
- Forks: 17
- Open Issues: 25
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# Chaos
![]()
Turn chaos into magic!
Chaos is a strongly typed, dynamic yet compilable, test-oriented procedural programming language that achieves zero cyclomatic complexity.### Influenced by
- TypeScript's type safety
- Python's syntax, modules and extensibility
- JavaScript's cross-platform support
- Ruby's loops and blocks, Rexx's `FOREVER` keyword
- PHP's dedication to server-side
- Haskell's pure functions
- C's speed and interoperability
- Go's standalone executables### Featured Aspects
- There are no control structures. (no `if..else`, no `switch..case`) Decision making only possible on function returns:
```ruby
num def add(num x, num y)
num z = x + y
end {
z == 8 : f1(),
z > 10 : f2(),
default : f3()
}
```
- A single unit test is enough to have 100% coverage on functions, always.
- Warns you about untested functions in the executed program.
- Detects possible runtime errors in compile-time.
- Unique function call system that combines procedures with some aspects of functional programming paradigm.
- No `while` or `when` keywords. Loops are mostly predetermined. Infinite loops can only be achievable through the `INFINITE` keyword.
- There are `break` and `continue` statements but breaking a multiline loop inside a function is forbidden.
- Single source of errors and unique exit codes for each one of them. So the errors are catchable by other programs.
- Language's itself forces you to write less error-prone code.
- Say goodbye to dependency conflicts with [Occultist](https://occultist.io/) dependency manager.
- Eliminated segmentation fault possibility using strict memory management and predictions.
- Simplest [C extension development](https://chaos-lang.org/docs/16_chaos_c_extensions_development) framework so far.## Installation
Install the requirements:
```shell
make requirements
```Compile the Chaos source:
```shell
make
```Install the `chaos` binary system-wide:
```shell
make install
```## Interpreter
### Interactive Shell
```shell
$ chaos
Chaos Language 0.2.0 (Jan 20 2021 02:39:23)
GCC version: 9.3.0 on linux
Turn chaos into magic!kaos> print "hello world"
hello world
kaos> exit
Bye bye!
```### Program File as Command-line Argument
**hello.kaos**:
```ruby
print "hello world"
``````shell
$ chaos hello.kaos
hello world
```## Compiler
```shell
$ chaos -c hello.kaos -o hello
Starting compiling...
Compiling Chaos code into build/hello.c
Compiling the C code into machine code...
Cleaning up the temporary files...Finished compiling.
Binary is ready on: build/hello
$ build/hello
hello world
```Run `chaos --help` to see more options.
## Uninstallation
You can uninstall the `chaos` binary and its C headers with:
```shell
make uninstall
```## Useful Links
[**Language Reference**](https://chaos-lang.org/docs/03_comments)
[**Developing Chaos C Extensions**](https://chaos-lang.org/docs/16_chaos_c_extensions_development)
[**API Reference**](https://chaos-lang.org/docs/api)
[**Template for Chaos C Extension Developers**](https://github.com/chaos-lang/template)
[**Documentation Repository**](https://github.com/chaos-lang/chaos-lang.org)
[**Bug Tracker**](https://github.com/chaos-lang/chaos/issues)
[**Occultist Dependency Manager**](https://github.com/chaos-lang/occultist)
[**Contribution Guide**](https://github.com/chaos-lang/chaos/blob/master/CONTRIBUTING.md)
[**Code of Conduct**](https://github.com/chaos-lang/chaos/blob/master/CODE_OF_CONDUCT.md)