-}
-/**
- * define the right hand side of a grammar
- * eg. `LHS ::= a + b`
- * @param process the right hand side processing : eg. `a + b` in `LHS`
- * @param arrange define the order (0 starting) of the elements of the result.
- * ast. : eg. `a + c` is `1 0 2` `(+ a c)`
- * @returns the processed ast.
- */
-function gramRHS(process, arrange) {
- return (m) => {
- let result = process(m);
- console.log(`result ${result}`);
- if (result._tag == "None") {
- return result;
- }
- else {
- let matched = result.value.matched;
- let return_array = Array(arrange.length);
- arrange.forEach((val, index) => {
- return_array[arrange[index]] = matched[index];
+ else {
+ fs.readFile(inputFile[0], 'utf8', (err, inputText) => {
+ if (err)
+ throw err;
+ let tree = parser.inputTextToTree(inputText);
+ let output = parser.treeToJS(tree);
+ fs.writeFile(outputJSFile, output, (err) => {
+ if (err)
+ throw err;