Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 116 lines (81 sloc) 2.753 kb
ee2ccdd @indutny [readme] new readme!
indutny authored
1 ```
2 ____ __ ___ __ _______
3 / __ \/ |/ /__ / /_____ _ / / ___/
4 / / / / /|_/ / _ \/ __/ __ `/_ / /\__ \
5 / /_/ / / / / __/ /_/ /_/ / /_/ /___/ /
6 \____/_/ /_/\___/\__/\__,_/\____//____/
7 ```
3cf249e @veged README!
authored
8
c0da20f @indutny [readme] travis icon
indutny authored
9 ## OMetaJS [![Build Status](https://secure.travis-ci.org/veged/ometa-js.png)](http://travis-ci.org/veged/ometa-js)
3cf249e @veged README!
authored
10
d9211d3 @indutny [readme] small fixes
indutny authored
11 OMetaJS is a JavaScript implementation of the OMeta, an object-oriented language
ee2ccdd @indutny [readme] new readme!
indutny authored
12 for pattern matching.
3cf249e @veged README!
authored
13
d9211d3 @indutny [readme] small fixes
indutny authored
14 This is a *node.js* module for developing and using such pattern matching
ee2ccdd @indutny [readme] new readme!
indutny authored
15 grammars.
16
17 ## Installation
18
19 ### Installing npm (node package manager)
20
21 ``` bash
d9c1aa7 @indutny [readme] fixed commands
indutny authored
22 $ curl http://npmjs.org/install.sh | sh
ee2ccdd @indutny [readme] new readme!
indutny authored
23 ```
24
25 ### Installing ometajs
26
27 ``` bash
28 $ [sudo] npm install ometajs -g
29 ```
30
31 **Note:** If you are using ometajs _programatically_ you should not install
32 it globally.
33
34 ``` bash
35 $ cd /path/to/your/project
d9c1aa7 @indutny [readme] fixed commands
indutny authored
36 $ npm install ometajs
0ff3dd8 @indutny [readme] close bash source listing
indutny authored
37 ```
3cf249e @veged README!
authored
38
39 ## Usage
40
41 ### Command line
42
ee2ccdd @indutny [readme] new readme!
indutny authored
43 ```bash
44 $ ometajs2js --help
45
46 Usage:
47 ometajs2js [OPTIONS] [ARGS]
48
49
50 Options:
51 -h, --help : Help
52 -v, --version : Version
53 -i INPUT, --input=INPUT : Input file (default: stdin)
54 -o OUTPUT, --output=OUTPUT : Output file (default: stdout)
55 --root=ROOT : Path to root module (default: ometajs)
56 ```
57
58 `ometajs2js` will take input `*.ometajs` file and produce [CommonJS][0]
59 compatible javascript file.
3cf249e @veged README!
authored
60
ee2ccdd @indutny [readme] new readme!
indutny authored
61 Also you may `require('*.ometajs')` files directly without compilation.
9187120 @indutny [readme] minor fixes
indutny authored
62 (OmetaJS is patching `require.extensions` as [CoffeeScript][1] does).
3cf249e @veged README!
authored
63
ee2ccdd @indutny [readme] new readme!
indutny authored
64 ### Using as CommonJS module
3cf249e @veged README!
authored
65
ee2ccdd @indutny [readme] new readme!
indutny authored
66 ```javascript
67 var ometajs = require('ometajs');
3cf249e @veged README!
authored
68
0dcbd21 @indutny readme: update
indutny authored
69 var ast = ometajs.grammars.BSJSParser.matchAll('var x = 1', 'topLevel'),
70 code = ometajs.grammars.BSJSTranslator.matchAll([ast], 'trans');
ee2ccdd @indutny [readme] new readme!
indutny authored
71 ```
72 Example
3cf249e @veged README!
authored
73
ee2ccdd @indutny [readme] new readme!
indutny authored
74 ### Example grammar
3cf249e @veged README!
authored
75
ee2ccdd @indutny [readme] new readme!
indutny authored
76 ```javascript
77 ometa Simple {
78 top = [#simple] -> 'ok'
79 }
80 ```
af41ebd @veged
authored
81
9187120 @indutny [readme] minor fixes
indutny authored
82 [More information][5] about OmetaJS syntax.
ee2ccdd @indutny [readme] new readme!
indutny authored
83
84 ### Use cases
85
86 Fast prototyping and building your own parser/language. Processing/traversing
87 complex [AST][2].
88
89 Some projects that are using this:
90
91 - [XJST](http://github.com/veged/xjst)
af41ebd @veged
authored
92 - [ShmakoWiki](http://github.com/veged/shmakowiki/)
93 - [OmetaHighlighter](http://github.com/veged/ometa-highlighter)
ee2ccdd @indutny [readme] new readme!
indutny authored
94
95 ### More information
96
97 To study OmetaJS or ask questions about it's core you can try to reach out
ed47e25 @veged Update README.md
authored
98 [original repository][3] author [Alessandro Warth][4] or me.
ee2ccdd @indutny [readme] new readme!
indutny authored
99
9187120 @indutny [readme] minor fixes
indutny authored
100 Here is [documented code][5].
ee2ccdd @indutny [readme] new readme!
indutny authored
101
b63e0a1 @indutny [readme] added contributors
indutny authored
102 #### Contributors
103
3838a7e @indutny [readme] use list for contributors
indutny authored
104 * [Alessandro Warth][4]
105 * [Takashi Yamamiya](https://github.com/propella)
106 * [Sergey Berezhnoy](https://github.com/veged)
107 * [Nikita Vasilyev](https://github.com/NV)
108 * [Fedor Indutny](https://github.com/indutny)
b63e0a1 @indutny [readme] added contributors
indutny authored
109
449d9e0 @indutny [readme] fixed links
indutny authored
110 [0]: http://www.commonjs.org/
111 [1]: http://coffeescript.org/
112 [2]: http://en.wikipedia.org/wiki/Abstract_syntax_tree
113 [3]: http://www.tinlizzie.org/ometa/
114 [4]: http://github.com/alexwarth
540d2f9 @indutny [readme] fix link to documented source
indutny authored
115 [5]: http://veged.github.com/ometa-js/
Something went wrong with that request. Please try again.