UNPKG

@ull-esit-pl/use-parse

Version:

Very simplistic executable that dynamically `requires` a module generated by PEG.js or Jison or any parser-parser that exports an object with a `parse` method and calls it with the `input` provided in the command line

39 lines (29 loc) 1.21 kB
# use-parse Very simplistic executable that dynamically `requires` a module generated by PEG.js or Jison or any parser-parser that exports an object with a `parse` method and calls it with the `input` provided in the command line Install it with ``` npm i -g '@ull-esit-pl/use-parse' ``` and use it like this: ``` [~/jison/jison-calc-web-simple(master)]$ ls -ltr calculator.jison -rw-rw-r-- 1 casiano staff 1507 29 abr 2013 calculator.jison [~/jison/jison-calc-web-simple(master)]$ jq .scripts package.json { "test": "npm run compile; use-parse calculator 'a = 2*3; b = 4+a'", "compile": "jison calculator.jison calculator.l -o calculator.js", "browser": "open -a firefox index.html" } [~/jison/jison-calc-web-simple(master)]$ npm test > jison-calc-web-simple@1.0.0 test /Users/casiano/local/src/javascript/PLgrado/jison/jison-calc-web-simple > npm run compile; use-parse calculator 'a = 2*3; b = 4+a' > jison-calc-web-simple@1.0.0 compile /Users/casiano/local/src/javascript/PLgrado/jison/jison-calc-web-simple > jison calculator.jison calculator.l -o calculator.js Processing <a = 2*3; b = 4+a> [ 6, 10 ] [ 6, 10 ] [ [ 6, 10 ], { a: 6, b: 10 } ] [~/jison/jison-calc-web-simple(master)]$ ```