Permalink
Browse files

Configured project for npm package distribution; renamed tool to omcc…

… per npm naming guidance; updated README;
  • Loading branch information...
tristanls committed Jul 2, 2011
1 parent 3e7d49c commit b3991137cd6a80c4d6de7ae9b1127cb0de7b58f2
View
@@ -18,24 +18,20 @@ To learn more:
About
----
-The goal of this project is to provide a tool-chain tool for easily working with OMetaJS. `ometajsnode` allows one to specify grammar, utility modules, and program files via command line, and offers a way of linking them together into an execution chain.
-
-Work in progress
-----
-Working on packaging for `npm`.
+The goal of this project is to provide a tool-chain tool for easily working with OMetaJS. `omcc` allows one to specify grammar, utility modules, and program files via command line, and offers a way of linking them together into an execution chain.
Usage
----
See below walkthrough.
-For command usage try `./ometajsnode -h` or `./ometajsnode --help`
+For command usage try `./omcc -h` or `./omcc --help`
#### Parser example:
from the `bin` directory:
-`./ometajsnode -g ../spec/data/grammar_to_ir.ometajs --grammar-match expr -o output.file ../spec/data/program.file --debug`
+`./omcc -g ../spec/data/grammar_to_ir.ometajs --grammar-match expr -o output.file ../spec/data/program.file --debug`
Let's breakdown that command step by step:
@@ -51,7 +47,7 @@ Let's breakdown that command step by step:
from the `bin` directory:
-`./ometajsnode -g ../spec/data/grammar_and_interpreter.ometajs --grammar-match expr -o output.file ../spec/data/program2.file --verbose`
+`./omcc -g ../spec/data/grammar_and_interpreter.ometajs --grammar-match expr -o output.file ../spec/data/program2.file --verbose`
This command uses grammar that also interprets, so the `output.file` will contain `212.90476...`; also, a different logging mode is used:
@@ -63,21 +59,21 @@ This command uses grammar that also interprets, so the `output.file` will contai
from the `bin` directory:
-`./ometajsnode -g ../spec/data/grammar_to_ir.ometajs --grammar-match expr ../spec/data/program.file | ./ometajsnode -g ../spec/data/interpreter.ometajs --grammar-match interp -o output.file --pipe-in --debug`
+`./omcc -g ../spec/data/grammar_to_ir.ometajs --grammar-match expr ../spec/data/program.file | ./omcc -g ../spec/data/interpreter.ometajs --grammar-match interp -o output.file --pipe-in --debug`
We introduce the `--pipe-in` option here:
-* `--pipe-in` indicates that the input has been previously generated by `ometajsnode`. notice that we are piping output from one `ometajsnode` to another; `--pipe-in` is a flag that lets `ometajsnode` know that it is working with input formatted by itself
+* `--pipe-in` indicates that the input has been previously generated by `omcc`. notice that we are piping output from one `omcc` to another; `--pipe-in` is a flag that lets `omcc` know that it is working with input formatted by itself
#### Parser to intermediate representation, then intermediate representation to "assembly" code example:
from the `bin` directory:
-`./ometajsnode -g ../spec/data/grammar_to_ir.ometajs --grammar-match expr ../spec/data/program.file | ./ometajsnode -g ../spec/data/compiler.ometajs --grammar-match comp -u example-utilities --pipe-in -o output.file --debug --no-pipe-out`
+`./omcc -g ../spec/data/grammar_to_ir.ometajs --grammar-match expr ../spec/data/program.file | ./omcc -g ../spec/data/compiler.ometajs --grammar-match comp -u example-utilities --pipe-in -o output.file --debug --no-pipe-out`
We introduce the utilities option here:
-* `-u example-utilities` specifies a comma separated list of utility modules (here only one) that `compiler.ometajs` uses in order to help it to generate "assembly". `ometajsnode` will attempt to `require('module name')` and will make it available to any `*.ometajs` files via `__Utilities[ <utilityName> ]`. `utilityName` must be exported by the module: `exports.utilityName = 'some name'`;
-* `--no-pipe-out` prevents the output from being encoded. Usually output is encoded so that it can be understood by another instance of `ometajsnode` taking it in for the next step in the pipeline. `--no-pipe-out` prevents that, allowing for special characters to take effect ( this is useful in code emitting scenarios )
+* `-u example-utilities` specifies a comma separated list of utility modules (here only one) that `compiler.ometajs` uses in order to help it to generate "assembly". `omcc` will attempt to `require('module name')` and will make it available to any `*.ometajs` files via `__Utilities[ <utilityName> ]`. `utilityName` must be exported by the module: `exports.utilityName = 'some name'`;
+* `--no-pipe-out` prevents the output from being encoded. Usually output is encoded so that it can be understood by another instance of `omcc` taking it in for the next step in the pipeline. `--no-pipe-out` prevents that, allowing for special characters to take effect ( this is useful in code emitting scenarios )
@@ -2,9 +2,9 @@
var logly = require( 'logly' );
-logly.name( 'ometajsnode' );
+logly.name( 'omcc' );
-var usage = "Usage: ometajsnode <-g|--grammar grammar_file> <--grammar-match expr_to_match> [options] input_file";
+var usage = "Usage: omcc <-g|--grammar grammar_file> <--grammar-match expr_to_match> [options] input_file";
var help1 = [
usage,
"",
@@ -99,7 +99,7 @@ while ( arg = argv.shift() ) {
break;
case 'version':
// using console instead of logly cause we don't want ':'
- console.log( "ometajsnode " + ometajsnode.version );
+ console.log( "omcc " + ometajsnode.version );
process.exit( 0 );
break;
}
@@ -3,11 +3,11 @@
var spawn = require( 'child_process' ).spawn;
var logly = require( 'logly' );
-logly.name( 'ometajsnode_test_runner' );
+logly.name( 'omcc_test_runner' );
var testRunnerDirname = __dirname;
-var usage = "Usage: ometajsnode_test_runner [options]";
+var usage = "Usage: omcc_test_runner [options]";
var help = [
usage,
"",

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
View
No changes.

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
View
@@ -1,11 +1,7 @@
-{ "name" : "ometajsnode"
+{ "name" : "omcc"
, "description" : "A command line tool for Alessandro Warth's OMetaJS ( an object-oriented language for pattern matching )"
-, "version" : "1.0.1"
-, "keywords" :
- [ "ometajsnode",
- "ometajs",
- "ometa" ]
-, "maintainers" :
+, "version" : "1.0.3"
+, "author" :
[ { "name" : "Tristan Slominski",
"email" : "tristan.slominski@gmail.com",
"web" : "http://github.com/tristanls" } ]
@@ -32,6 +28,6 @@
, "dependencies" : []
, "homepage" : "https://github.com/tristanls/ometa-js-node"
, "main" : "./node_modules/ometajsnode/ometajsnode.js"
-, "bin" : { "ometajsnode" : "./bin/ometajsnode" }
+, "bin" : { "omcc" : "./bin/omcc" }
, "engines" : { "node" : ">=v0.4.8" }
}
View
@@ -1,35 +1,26 @@
var exec = require( 'child_process' ).exec;
var fs = require( 'fs' );
-describe( 'ometajsnode', function() {
+describe( 'omcc', function() {
- var usageMessage = 'Usage: ometajsnode <-g|--grammar grammar_file> <--grammar-match expr_to_match> [options] input_file\n';
-
- it( 'should display version with --version option specified', function() {
- exec('./bin/ometajsnode --version',
- function( error, stdout, stderr ) {
- expect( stdout ).toEqual( 'ometajsnode 0.2.0\n' );
- asyncSpecDone();
- });
- asyncSpecWait();
- });
+ var usageMessage = 'Usage: omcc <-g|--grammar grammar_file> <--grammar-match expr_to_match> [options] input_file\n';
it( 'should fail when no grammar is specified', function() {
- exec( './bin/ometajsnode --grammar-match expr ./spec/data/program.file',
+ exec( './bin/omcc --grammar-match expr ./spec/data/program.file',
function( error, stdout, stderr ) {
expect( stderr ).toEqual(
- 'ometajsnode[error]: no grammar specified\n' + usageMessage );
+ 'omcc[error]: no grammar specified\n' + usageMessage );
expect( stdout ).toEqual( '' );
asyncSpecDone();
});
asyncSpecWait();
});
it( 'should fail when no grammar-match is specified', function() {
- exec( './bin/ometajsnode -g ./spec/data/grammar_to_ir.ometajs ./spec/data/program.file',
+ exec( './bin/omcc -g ./spec/data/grammar_to_ir.ometajs ./spec/data/program.file',
function( error, stdout, stderr ) {
expect( stderr ).toEqual(
- 'ometajsnode[error]: no grammar-match expression specified\n' +
+ 'omcc[error]: no grammar-match expression specified\n' +
usageMessage );
expect( stdout ).toEqual( '' );
asyncSpecDone();
@@ -38,7 +29,7 @@ describe( 'ometajsnode', function() {
});
it( 'should parse program (6*(4+3)) from program.file using grammar_to_ir.ometajs and output to stdout', function() {
- exec('./bin/ometajsnode -g ./spec/data/grammar_to_ir.ometajs --grammar-match expr ./spec/data/program.file',
+ exec('./bin/omcc -g ./spec/data/grammar_to_ir.ometajs --grammar-match expr ./spec/data/program.file',
function( error, stdout, stderr ) {
expect( stderr ).toEqual( '' );
expect( stdout ).toEqual( '["mul",["num",6],["add",["num",4],["num",3]]]' );
@@ -48,7 +39,7 @@ describe( 'ometajsnode', function() {
});
it( 'should parse program (6*(4+3)) from program.file using grammar_to_ir.ometajs and output to file', function() {
- exec('./bin/ometajsnode -g ./spec/data/grammar_to_ir.ometajs --grammar-match expr -o ./spec/data/tmp/output.1.file ./spec/data/program.file',
+ exec('./bin/omcc -g ./spec/data/grammar_to_ir.ometajs --grammar-match expr -o ./spec/data/tmp/output.1.file ./spec/data/program.file',
function( error, stdout, stderr ) {
// should be nothing on stdout
expect( stdout ).toEqual( '' );
@@ -69,7 +60,7 @@ describe( 'ometajsnode', function() {
});
it( 'should parse program (6*(4+3)) from stdin using grammar_to_ir.ometajs and output to stdout', function() {
- exec( "echo '(6*(4+3))' | ./bin/ometajsnode -g ./spec/data/grammar_to_ir.ometajs --grammar-match expr",
+ exec( "echo '(6*(4+3))' | ./bin/omcc -g ./spec/data/grammar_to_ir.ometajs --grammar-match expr",
function( error, stdout, stderr ) {
expect( stderr ).toEqual( '' );
expect( stdout ).toEqual( '["mul",["num",6],["add",["num",4],["num",3]]]' );
@@ -79,7 +70,7 @@ describe( 'ometajsnode', function() {
});
it( 'should parse program (6*(4+3)) from stdin using grammar_to_ir.ometajs and output to file', function() {
- exec( "echo '(6*(4+3))' | ./bin/ometajsnode -g ./spec/data/grammar_to_ir.ometajs --grammar-match expr -o ./spec/data/tmp/output.2.file",
+ exec( "echo '(6*(4+3))' | ./bin/omcc -g ./spec/data/grammar_to_ir.ometajs --grammar-match expr -o ./spec/data/tmp/output.2.file",
function( error, stdout, stderr ) {
// should be nothing on stdout
expect( stdout ).toEqual( '' );
@@ -101,7 +92,7 @@ describe( 'ometajsnode', function() {
});
it( 'should parse piped output ["mul",["num",6],["add",["num",4],["num",3]]] from stdin using interpreter.ometajs and output to stdout', function() {
- exec( 'echo \'["mul",["num",6],["add",["num",4],["num",3]]]\' | ./bin/ometajsnode -g ./spec/data/interpreter.ometajs --grammar-match interp --pipe-in',
+ exec( 'echo \'["mul",["num",6],["add",["num",4],["num",3]]]\' | ./bin/omcc -g ./spec/data/interpreter.ometajs --grammar-match interp --pipe-in',
function( error, stdout, stderr ) {
expect( stderr ).toEqual( '' );
expect( stdout ).toEqual( '42' );
@@ -111,7 +102,7 @@ describe( 'ometajsnode', function() {
});
it( 'should parse piped output ["mul",["num",6],["add",["num",4],["num",3]]] from stdin using interpreter.ometajs and output to file', function() {
- exec( 'echo \'["mul",["num",6],["add",["num",4],["num",3]]]\' | ./bin/ometajsnode -g ./spec/data/interpreter.ometajs --grammar-match interp --pipe-in -o ./spec/data/tmp/output.3.file',
+ exec( 'echo \'["mul",["num",6],["add",["num",4],["num",3]]]\' | ./bin/omcc -g ./spec/data/interpreter.ometajs --grammar-match interp --pipe-in -o ./spec/data/tmp/output.3.file',
function( error, stdout, stderr ) {
expect( stderr ).toEqual( '' );
@@ -131,7 +122,7 @@ describe( 'ometajsnode', function() {
});
it( 'should parse intermediate representation ["mul",["num",6],["add",["num",4],["num",3]]] from ir.file using interpreter.ometajs and output to stdout', function() {
- exec( './bin/ometajsnode -g ./spec/data/interpreter.ometajs --grammar-match interp --pipe-in ./spec/data/ir.file',
+ exec( './bin/omcc -g ./spec/data/interpreter.ometajs --grammar-match interp --pipe-in ./spec/data/ir.file',
function( error, stdout, stderr ) {
expect( stderr ).toEqual( '' );
expect( stdout ).toEqual( '42' );
@@ -141,7 +132,7 @@ describe( 'ometajsnode', function() {
});
it( 'should parse intermediate representation ["mul",["num",6],["add",["num",4],["num",3]]] from ir.file using interpreter.ometajs and output to file', function() {
- exec( './bin/ometajsnode -g ./spec/data/interpreter.ometajs --grammar-match interp --pipe-in -o ./spec/data/tmp/output.4.file ./spec/data/ir.file',
+ exec( './bin/omcc -g ./spec/data/interpreter.ometajs --grammar-match interp --pipe-in -o ./spec/data/tmp/output.4.file ./spec/data/ir.file',
function( error, stdout, stderr ) {
expect( stderr ).toEqual( '' );
@@ -161,7 +152,7 @@ describe( 'ometajsnode', function() {
});
it( 'should parse program ((16-6)/(6*(4+3)))+((22/3)*(17+9+3)) from program2.file using grammar_to_ir.ometajs and output to stdout', function() {
- exec( './bin/ometajsnode -g ./spec/data/grammar_to_ir.ometajs --grammar-match expr ./spec/data/program2.file',
+ exec( './bin/omcc -g ./spec/data/grammar_to_ir.ometajs --grammar-match expr ./spec/data/program2.file',
function( error, stdout, stderr ) {
expect( stdout ).toEqual(
'["add",["div",["sub",["num",16],["num",6]],' +
@@ -173,7 +164,7 @@ describe( 'ometajsnode', function() {
});
it( 'should parse program ((16-6)/(6*(4+3)))+((22/3)*(17+9+3)) from program2.file using grammar_to_ir.ometajs and output to file', function() {
- exec('./bin/ometajsnode -g ./spec/data/grammar_to_ir.ometajs --grammar-match expr -o ./spec/data/tmp/output.5.file ./spec/data/program2.file',
+ exec('./bin/omcc -g ./spec/data/grammar_to_ir.ometajs --grammar-match expr -o ./spec/data/tmp/output.5.file ./spec/data/program2.file',
function( error, stdout, stderr ) {
// should be nothing on stdout
expect( stdout ).toEqual( '' );
@@ -198,7 +189,7 @@ describe( 'ometajsnode', function() {
});
it( 'should parse program ((16-6)/(6*(4+3)))+((22/3)*(17+9+3)) from stdin using grammar_to_ir.ometajs and output to stdout', function() {
- exec( "echo '((16-6)/(6*(4+3)))+((22/3)*(17+9+3))' | ./bin/ometajsnode -g ./spec/data/grammar_to_ir.ometajs --grammar-match expr",
+ exec( "echo '((16-6)/(6*(4+3)))+((22/3)*(17+9+3))' | ./bin/omcc -g ./spec/data/grammar_to_ir.ometajs --grammar-match expr",
function( error, stdout, stderr ) {
expect( stderr ).toEqual( '' );
expect( stdout ).toEqual(
@@ -211,7 +202,7 @@ describe( 'ometajsnode', function() {
});
it( 'should parse program ((16-6)/(6*(4+3)))+((22/3)*(17+9+3)) from stdin using grammar_to_ir.ometajs and output to file', function() {
- exec( "echo '((16-6)/(6*(4+3)))+((22/3)*(17+9+3))' | ./bin/ometajsnode -g ./spec/data/grammar_to_ir.ometajs --grammar-match expr -o ./spec/data/tmp/output.6.file",
+ exec( "echo '((16-6)/(6*(4+3)))+((22/3)*(17+9+3))' | ./bin/omcc -g ./spec/data/grammar_to_ir.ometajs --grammar-match expr -o ./spec/data/tmp/output.6.file",
function( error, stdout, stderr ) {
// should be nothing on stdout
expect( stdout ).toEqual( '' );

0 comments on commit b399113

Please sign in to comment.