# koume

> a program language by JSON

Latest version **0.1.1** (published 2019-03-15) · MIT license · 0 weekly downloads

## Install

```sh
npm install koume
pnpm add koume
yarn add koume
bun add koume
```

Provides the command `koume`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.1 |
| Published | 2019-03-15 |
| First published | 2018-10-19 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 149 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Yuichiro MORIGUCHI |
| Maintainers | ymoriguchi |
| Keywords | language, JSON, continuation |

## Links

- npm: https://www.npmjs.com/package/koume
- Repository: https://github.com/y-moriguchi/koume
- Homepage: https://github.com/y-moriguchi/koume#readme
- Issues: https://github.com/y-moriguchi/koume/issues
- npm.io page: https://npm.io/package/koume

## Recent versions

- 0.1.1 (latest) — 2019-03-15
- 0.1.0 — 2018-11-25
- 0.0.0 — 2018-10-19

## README

# Koume
Koume is a programming language described by JSON.  
Koume has features as follows.
* first class functions and anonymous functions
* first class continuations
* tail recursion optimization
* LISP like macros
* message passing mechanism

## How to use

### node.js
Install Koume:
```
npm install koume
```

Use module:
```js
var Koume = require('koume');
```

### Browser
```html
<script src="koume.js"></script>
```

### Command Line
```
$ koume [-n] program.json
```

## Examples

### Literals
```json
[ 765 ]
[ true ]
[ false ]
[ null ]
```

### Apply to function
```json
[ "add", 765, 346 ]
```

### Quotes
```json
[ { "q": "string" } ]
[ { "q": [ "array" ] } ]
[ { "q": { "obj1": 1 } } ]
```

### Quasiquotes
```json
[
  {
    "qq": {
      "obj1": {
        "uq": [ "add", 765, 346 ]
      }
    }
  }
]
```

### Functions
```json
[
  {
    "define": {
      "square": {
        "function": {
          "args": ["x"],
          "begin": [
            ["mul", "x", "x"]
          ]
        }
      }
    }
  }
]
```

### Conditions
```json
[
  {
    "if": {
      "cond": true,
      "then": 1,
      "else": 2
    }
  }
]
```

### Loop (named let)
```json
[
  {
    "let": {
      "name": "sum",
      "vars": {
        "x": 10,
        "y": 0
      },
      "begin": [
        {
          "if": {
            "cond": ["eqv", "x", 0],
            "then": "y",
            "else": ["sum", ["sub", "x", 1], ["add", "x", "y"]]
          }
        }
      ]
    }
  }
]
```

### Continuations
```json
[
  {
    "define": {
      "s": null
    }
  },
  [
    "add",
    346,
    [
      "callcc",
      {
        "function": {
          "args": ["k"],
          "begin": [
            {
              "set": { "s": "k" }
            },
            961
          ]
        }
      }
    ]
  ],
  ["s", 765]
]
```

### Macros
```json
[
  {
    "defmacro": {
      "name": "aMacro",
      "patterns": [
        {
          "pattern": {
            "obj1": "a"
          },
          "begin": [
            {
              "qq": ["list", { "uq": "a" }]
            }
          ]
        }
      ]
    }
  },
  {
    "aMacro": {
      "obj1": 1
    }
  }
]
```

### Message passing
```json
[
  {
    "define": {
      "class": {
        "function": {
          "args": ["x"],
          "begin": [
            {
              "message": {
                "extends": false,
                "messages": {
                  "add": {
                    "function": {
                      "args": ["y"],
                      "begin": [
                        ["add", "x", "y"]
                      ]
                    }
                  }
                }
              }
            }
          ]
        }
      }
    }
  },
  {
    "define": {
      "obj": ["class", 765]
    }
  },
  [["obj", { "q": "add" }], 346]
]
```

## Document
[A document of Koume is here (Japanese).](http://koume.morilib.net)

---
_Source: https://npm.io/package/koume · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
