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