# ometajs

> A object-oriented language for pattern matching

Latest version **4.0.0** (published 2015-07-06) · 0 weekly downloads

## Install

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

Provides the command `ometajs2js`.

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 4.0.0 |
| Published | 2015-07-06 |
| First published | 2011-01-23 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=0.4.0 |
| Dependencies | 3 |
| Known vulnerabilities | 0 (+2 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 83 |
| Author | Fedor Indutny |
| Maintainers | veged, fedor.indutny, indutny |

## Links

- npm: https://www.npmjs.com/package/ometajs
- Repository: https://github.com/veged/ometa-js
- Issues: http://github.com/veged/ometa-js/issues
- npm.io page: https://npm.io/package/ometajs

## Dependencies (3)

- [q](https://npm.io/package/q.md) 0.8.x
- [coa](https://npm.io/package/coa.md) 0.3.x
- [uglify-js](https://npm.io/package/uglify-js.md) 1.3.x

## Recent versions

- 4.0.0 (latest) — 2015-07-06
- 3.3.1 (stable) — 2013-08-12
- 3.3.8 — 2015-01-22
- 3.3.7 — 2014-07-09
- 3.3.6 — 2014-03-13
- 3.3.5 — 2014-01-13
- 3.3.4 — 2013-10-16
- 3.3.3 — 2013-10-16
- 3.3.2 — 2013-08-12
- 3.3.0 — 2013-07-24
- 3.2.4 — 2013-01-30
- 3.2.3 — 2013-01-30
- 3.2.2 — 2013-01-29
- 3.2.1 — 2013-01-29
- 3.2.0 — 2013-01-21
- … 54 more at https://npm.io/package/ometajs/versions

## README

```
   ____  __  ___     __            _______
  / __ \/  |/  /__  / /_____ _    / / ___/
 / / / / /|_/ / _ \/ __/ __ `/_  / /\__ \
/ /_/ / /  / /  __/ /_/ /_/ / /_/ /___/ /
\____/_/  /_/\___/\__/\__,_/\____//____/
```

## OMetaJS [![Build Status](https://secure.travis-ci.org/veged/ometa-js.png)](http://travis-ci.org/veged/ometa-js)

OMetaJS is a JavaScript implementation of OMeta, an object-oriented language
for pattern matching.

This is a *node.js* module for developing and using such pattern matching
grammars.

## Installation

### Installing npm (node package manager)

``` bash
$ curl http://npmjs.org/install.sh | sh
```

### Installing ometajs

``` bash
$ [sudo] npm install ometajs -g
```

**Note:** If you are using ometajs _programmatically_ you should not install
it globally.

``` bash
$ cd /path/to/your/project
$ npm install ometajs
```

## Usage

### Command line

```bash
$ ometajs2js --help

Usage:
  ometajs2js [OPTIONS] [ARGS]


Options:
  -h, --help : Help
  -v, --version : Version
  -i INPUT, --input=INPUT : Input file (default: stdin)
  -o OUTPUT, --output=OUTPUT : Output file (default: stdout)
  --root=ROOT : Path to root module (default: ometajs)
```

`ometajs2js` will take input `*.ometajs` file and produce a [CommonJS][0]-
compatible javascript file.

You may also `require('*.ometajs')` files directly without compilation.
(OMetaJS is patching `require.extensions` as [CoffeeScript][1] does).

### Usage as CommonJS module

```javascript
var ometajs = require('ometajs');

var ast = ometajs.grammars.BSJSParser.matchAll('var x = 1', 'topLevel'),
    code = ometajs.grammars.BSJSTranslator.matchAll([ast], 'trans');
```

### Example grammar

```javascript
ometa Simple {
  top = [#simple] -> 'ok'
}
```

[More information][5] about OMetaJS syntax.

### Use cases

Quickly prototype and buildyour own parser/language. Process/traverse complex
[AST][2].

Some projects that are using OMetaJS:

 -   [XJST](http://github.com/veged/xjst)
 -   [ShmakoWiki](http://github.com/veged/shmakowiki/)
 -   [OmetaHighlighter](http://github.com/veged/ometa-highlighter)

### More information

To study OMetaJS or ask questions about its core you can reach out to the
[original repository][3] author [Alessandro Warth][4] or me.

Here is the [documented code][5].

#### Contributors

* [Alessandro Warth][4]
* [Takashi Yamamiya](https://github.com/propella)
* [Sergey Berezhnoy](https://github.com/veged)
* [Nikita Vasilyev](https://github.com/NV)
* [Fedor Indutny](https://github.com/indutny)
* [Jason Davies](https://github.com/jasondavies)

[0]: http://www.commonjs.org/
[1]: http://coffeescript.org/
[2]: http://en.wikipedia.org/wiki/Abstract_syntax_tree
[3]: http://www.tinlizzie.org/ometa/
[4]: http://github.com/alexwarth
[5]: http://veged.github.com/ometa-js/

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