Giter Club home page Giter Club logo
Cotowali photo

cotowali Goto Github PK

repos: 13.0 gists: 0.0

Name: Cotowali

Type: Organization

Bio: Cotowali is a statically typed script language that transpile into POSIX sh

Location: Japan

We need financial support to continue development. Please become a sponsor.

Cotowali

A statically typed scripting language that transpile into POSIX sh

Website

License: MPL 2.0 Join Cotowali Discord

Concepts of Cotowali

  • Outputs shell script that is fully compliant with POSIX standards.
  • Simple syntax.
  • Simple static type system.
  • Syntax for shell specific feature like pipe and redirection.

Example

fn fib(n: int): int {
  if n < 2 {
    return n
  }
  return fib(n - 1) + fib(n - 2)
}

fn int |> twice() |> int {
   var n = 0
   read(&n)
   return n * 2
}

assert(fib(6) == 8)
assert((fib(6) |> twice()) == 16)

fn ...int |> sum() |> int {
  var v: int
  var res = 0
  while read(&v) {
    res += v
  }
  return res
}

fn ...int |> twice_each() |> ...int {
  var n: int
  while read(&n) {
    yield n * 2
  }
}

assert((seq(3) |> sum()) == 6)
assert((seq(3) |> twice_each() |> sum()) == 12)

// Call command by `@command` syntax with pipeline operator
assert(((1, 2) |> @awk('{print $1 + $2}')) == '3')

There are more examples

Installation

Use Konryu (cotowali installer written in cotowali)

curl -sSL https://konryu.cotowali.org | sh
# add to your shell config like .bashrc
export PATH="$HOME/.konryu/bin:$PATH"
eval "$(konryu init)"

Build from source

  1. Install required tools

  2. Build

    z build
  3. Install

    sudo z symlink
    # or
    sudo z install

How to use

# compile
lic examples/add.li

# execution
lic examples/add.li | sh
# or
lic run examples/add.li

Development

See docs/development.md

Docker

docker compose run dev

Author

zakuro <[email protected]>

Acknowledgements

Cotowali is supported by 2021 Exploratory IT Human Resources Project (The MITOU Program by IPA: Information-technology Promotion Agency, Japan.

Cotowali's Projects

cotowali icon cotowali

A statically typed scripting language that transpile into POSIX sh

kaico icon kaico

A statically typed scripting language that is transpiled into shell script.

konryu icon konryu

Cotowali installer and version manager

kuwa icon kuwa

Lossless syntax trees library for V.

vscode-cotowali icon vscode-cotowali

Cotowali support for Visual Studio Code that provide syntax highlighting and indentation.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.