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

README.md mentions node bin/jison #323

Closed
m99coder opened this issue Feb 24, 2016 · 7 comments
Closed

README.md mentions node bin/jison #323

m99coder opened this issue Feb 24, 2016 · 7 comments

Comments

@m99coder
Copy link

But I couldn’t figure out how to build such a binary artefact. Neither the Makefile nor any npm script (or build target mentioned in package.json) probably do the trick.

Could you please explain how to get a binary artefact?

@yosbelms
Copy link

1- Install JISON globally:

npm -g install jison

Above command will publish JISON as a CLI tool.
2- Write the grammar and the lexer, both could be in the same fils or separated by %% symbol, then run:

// if grammax and parser are in separated files
jison ./path/to/grammar.y ./path/to/lexer.l -o parser.js -m commonjs

// if grammar and lexer are in the same file
jison ./path/to/grammar.y -o parser.js -m commonjs

Above commands will generate the parser to parser.js file with commonjs module format.

You can use the generated file by doing var myParser = require('parser.js')

@m99coder
Copy link
Author

I already installed jison globally. But I modified src/jison.js and want to test this version inside of the current project. Would it help if I would dismiss the -g flag?

@yosbelms
Copy link

Try node path/to/jison/lib/cli.js ...

@m99coder
Copy link
Author

I tried to export as AngularJS module and therefore added this commit to my own fork of jison: m99coder@66756fd. I used the following command line:

$ node lib/cli.js examples/calculator.jison -o ./calculator.js -m angular

The output isn’t an AngularJS module.

There still is an open pull request for this repository #286. But it probably will never be merged :/

@yosbelms
Copy link

In a first glance at that commit I think the problem is the fallthroug in the line 940. Actually if angular is specified the generated module is in amd format, right? So, you should insert a break; statement just after the line number 940.

@m99coder
Copy link
Author

🙈 Oh man. You are so right. Now it works as expected. Thanks a lot.

@morenoh149
Copy link

@m99coder close issue if solved

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

3 participants