-
Notifications
You must be signed in to change notification settings - Fork 111
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
Convert grammar.pegjs into grammar.pegcoffee #321
Conversation
# reduce | ||
while \ | ||
stack.length > 2 and \ | ||
( \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be formatted more nicely in coffee-script 1.7, but unfortunately the pegjs-coffee-plugin uses 1.6.
I think this is a good start, but there are some things I don’t really like:
Still, this is a step in the right direction. I just don’t feel like forking both the plugin and pegjs to improve them too right now—to tired from this conversion and tricky debugging .... |
Looks like the the Travis build fails on Node 0.11—sigh—do you understand why? |
Thanks, this is great progress.
Don't worry about it. It's currently broken due to #319
jashkenas/coffeescript interface takes an options object as its second parameter, which may have a |
A short digression. I'm not sure what the ultimate goal is with this conversion, but one could also just strip the grammar of actions, and with the help of https://github.com/andreineculau/pegjs-override-action consolidate the actions in a standalone module. |
memo | ||
foldr = (fn, memo, list) -> | ||
i = list.length | ||
while i-- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is now: 5272d3c.
@michaelficarra could you please have a look at the latest commit. It is a big improvement. |
@@ -30,9 +30,9 @@ lib/bootstrap: lib | |||
mkdir -p lib/bootstrap | |||
|
|||
|
|||
lib/parser.js: src/grammar.pegjs bootstraps lib | |||
lib/parser.js: src/grammar.pegcoffee bootstraps lib |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I’m a bit of a noob regarding Makefiles, but I should add ./lib/pegjs-coffee-plugin.js as a prerequisite here, shouldn’t I?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes.
@michaelficarra Can we try to get this merged? Any change to the grammar is either blocked by this, or requires this PR to be updated. |
- Self-hosted coffee compilation instead of dependency on (old version of) jashkenas/coffee-script. - No more `@variable`s for global variables and helper functions, which involves having to use `=>` instead of `->` sometimes. Now, just use `variable` like in plain JavaScript. - It is now possible to do `a:Foo? { a ?= []; rp a}` as expected. - Better error messages. Partly because CSR has better error messages than jashkenas/[email protected], partly because you also get to know in which rule the code resides. The error messages will get line and column numbers in the .pegcoffee file as soon as lydell/pegjs-each-code#1 is resolved. - No more weird hacks in the initializer. - Note: lib/parser.js gets pretty bloated because of michaelficarra#323.
Convert grammar.pegjs into grammar.pegcoffee
No description provided.