Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CLI tool available? #71

Closed
blakelapierre opened this issue Mar 3, 2016 · 6 comments
Closed

CLI tool available? #71

blakelapierre opened this issue Mar 3, 2016 · 6 comments

Comments

@blakelapierre
Copy link

I want to be able to run files and stdin through particular grammars and semantic operations that will generate files or print results to stdout. I've started building my own tooling for doing this with my own work, but wanted to check to see if something already existed and I didn't find anything in a cursory search through the repositories posted here.

Example:

cat model | run_operation RM_PGSQL toPostgreSQL > schema.ddl

Where RM_PGSQL refers to a grammar and toPostgreSQL refers to a semantic action (or derivative).

Does something like this exist, or is a common solution planned?

My apologies if I have missed something.

@mroeder
Copy link
Contributor

mroeder commented Mar 3, 2016

Hi Blake,
I think that's worth a shot and we could put something like that in bin. There currently is a script in this directory - es5bench - that does something similar: Parse dist/ohm.js against the ES5 grammar and compile it to JS code (using examples/ecmascript/compile.js). It's not a semantics but I don't see why it couldn't be.

@alexwarth
Copy link
Contributor

I agree that it would be useful to have something like this!

On Thu, Mar 3, 2016 at 2:47 PM, mroeder notifications@github.com wrote:

Hi Blake,
I think that's worth a shot and we could put something like that in bin
http://../blob/master/bin. There currently is a script in this
directory - es5bench http://../blob/master/bin/es5bench - that does
something similar: Parse dist/ohm.js against the ES5 grammar and compile
it to JS code (using examples/ecmascript/compile.js
http://../blob/master/examples/ecmascript/compile.js). It's not a
semantics but I don't see why it couldn't be.


Reply to this email directly or view it on GitHub
#71 (comment).

@justinmchase
Copy link
Contributor

It looks like this was done.

$ npm install ohm-js -g
$ ohm-js $opts

@mroeder
Copy link
Contributor

mroeder commented May 3, 2016

No, it actually is still in the pipeline (something that takes grammar, semantics, operation/attribute name and input and processes it).

@robertothais
Copy link

I also had a need for this, and recently released https://github.com/robertothais/ohm-cli.

It currently only supports validating grammars and recognizing inputs. I'd like to add support for semantic actions soon. Any feedback is welcome.

pdubroy added a commit that referenced this issue Dec 8, 2021
- Adds a `match` subcommand that matches an input file against a given grammar (.ohm or .ohm-bundle.js).
- Addresses part of #71. Still TODO: implement a way to evaluate an operation / attribute.
@pdubroy
Copy link
Contributor

pdubroy commented Nov 6, 2022

I'm going to close this as we now have an "official" CLI tool.

@pdubroy pdubroy closed this as completed Nov 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants