Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cognate-lang/cognate
A human readable quasi-concatenative programming language
https://github.com/cognate-lang/cognate
based-stack-based-language c closures combinatorics compiler forth forth-like functional-programming interpreter lambda-calculus language natural-language prefix-notation proglangs-discord programming-language stack-based-language stack-language
Last synced: 3 months ago
JSON representation
A human readable quasi-concatenative programming language
- Host: GitHub
- URL: https://github.com/cognate-lang/cognate
- Owner: cognate-lang
- License: bsd-2-clause
- Created: 2020-06-02T10:08:40.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2024-01-19T17:21:17.000Z (about 1 year ago)
- Last Synced: 2024-05-18T23:18:23.287Z (9 months ago)
- Topics: based-stack-based-language, c, closures, combinatorics, compiler, forth, forth-like, functional-programming, interpreter, lambda-calculus, language, natural-language, prefix-notation, proglangs-discord, programming-language, stack-based-language, stack-language
- Language: C
- Homepage:
- Size: 3.84 MB
- Stars: 204
- Watchers: 7
- Forks: 9
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-programming-languages - Cognate - Cognate is a quasi-concatenative stack oriented language that uses embedded comments to read like English prose. It is a dynamic language (yet compiled) and makes great use of combinators and higher order functions. Cognate aims to make functional programming simple, readable, and maintainable. (Uncategorized / Uncategorized)
README
The Cognate programming language
Cognate is a small dynamic quasi-concatenative language for functional programming. Cognate aims to express complex programs in a simple and readable way through its unique syntax, which emphasises embedding comments into statements. This makes programs very readable and helps a programmer better express their intentions.
### Cognate is readable
Cognate's compiler ignores words beginning with lowercase letters, allowing comments and code to be interwoven. This 'informal syntax' being optional allows Cognate to be verbose where detail is needed and concise where it isn't.### Cognate is efficient
CognaC (the Cognate Compiler) compiles Cognate sources directly into C. This produces very small and rather fast binaries, allowing Cognate to outperform most dynamic languages. This also makes Cognate a candidate for scripting in embedded environments, such as microcontrollers.### Cognate is simple
Cognate has only a handful of syntax elements. This makes the language very consistent and easy to learn. In future this will allow me to elegantly introduce metaprogramming constructs.### Cognate is functional
Cognate is designed for functional programming - but does not require a PhD in discrete mathematics to use. While Cognate is oriented around first-class functions, no restrictions are placed on IO - making debugging and refactoring less headache-inducing.### Cognate is powerful
Cognate is a stack-oriented programming language. This means that all intermediary values reside in a stack data structure. This allows powerful features such as:* Multiple return values
* Point-free functions
* Operation chaining### Web playground
Check out the interactive web playground - it runs Cognate programs client-side in the browser. It also has intelligent syntax highlighting, code folding, and error reporting in the editor.Playground: [https://cognate-playground.hedy.dev](https://cognate-playground.hedy.dev)
Source: [https://github.com/hedyhli/cognate-playground](https://github.com/hedyhli/cognate-playground)
### Building Cognate
Currently, Cognate will run on Linux and MacOS systems. If you use Windows, then you can install Cognate on the Windows Subsystem for Linux. To build Cognate, you will need `make`, `flex`, `bison`, and a C compiler (currently supported are GCC, Clang, and TCC). After installing these, simply run:
```
make
```
If that succeeds, install the compiler with:
```
make install
```
This installs cognate to the `.local` prefix. To install to a different directory:
```
make PREFIX=/my/prefix/dir install
```
You should then run the test script to test Cognate's functionality. This should work regardless of operating system.
```
make test -j
```
If the tests all pass (they should!), you can then try running some of the included demo programs:
```
cognac examples/fizzbuzz.cog
./examples/fizzbuzz
```[Here](https://cognate-lang.github.io/learn.html) is an work-in-progress introduction to the language.