Source map support plan

Showing 1-5 of 5 messages
Source map support plan Rob Tsuk 12/20/11 4:42 PM
Hi everyone,

I put together a small plan for adding source map support to CoffeeScript. If you have any interest or experience in the area, please give it a read and see if you think it makes sense. I'm hoping to use the relative down time of the holidays to get a patch ready to go, so I'll be starting work on this soon.

Re: [coffeescript] Source map support plan Steve Howell 12/21/11 7:43 AM
Hi Rob,

This looks like a good plan to me.

The Location object seems like a good way to make the patch a little less invasive with respect to, and it could be extended eventually to have column support as well as just the line number.

As I mentioned on ticket 558, there have been some previous patches that got rejected due to all the special cases in, which you are obviously aware of.  It would be great to get some buy-in from the core contributors before proceeding, so you might want to ping them on the ticket.

My two cents is that line number support is obviously important, so if it comes at the cost of a little complexity in, it is well worth it.  I think a well-designed patch would make the code a little uglier, but it wouldn't really make it more complex.  Sure, each line would have to pass along a little more state to create the node, but it wouldn't require any complex constructs.

There are probably some opportunities to pre-factoring to make a line-number patch easier, but the more I think about it, the more I think we should just go for it, and future patches could probably clean it up.

The timing seems right to me.  At this point the CoffeeScript grammar should be pretty stable.  From my perspective, the best thing to do with CS now is to leave the core language more or less alone, because it's really beautiful as it stands.  If the language can stay relatively stable, it would create a great opportunity to close the gaps on tooling, and line number support is a big part of that.

From: Rob Tsuk <>
To: coffeescript <>
Sent: Tuesday, December 20, 2011 4:42 PM
Subject: [coffeescript] Source map support plan
Re: [coffeescript] Source map support plan Rob Tsuk 12/21/11 5:13 PM

I decided against changing all the constructors, but I have to give the .setLocation() approach more thought. It is uglifying. Any suggestions welcomed.
Re: [coffeescript] Source map support plan Steve Howell 12/21/11 5:46 PM
Nice work.  What does your generated parser.js look like?  I agree that the .setLocation() is a bit uglifying, but it's not horrible.  The o() function is already kind of cryptic, even before your patch.  I think the end game here is to define a simple DSL for the grammar that is not built on top of coffee itself, and then write a custom parser to make it play nice with Jison.

The mailing list might not be the best forum for this discussion.  I think a lot of core-CS-dev type of discussions tend to happen via github issues or irc.

From: Rob Tsuk <>
Sent: Wednesday, December 21, 2011 5:13 PM
Subject: Re: [coffeescript] Source map support plan
Re: [coffeescript] Source map support plan Rob Tsuk 12/21/11 9:18 PM
It's here.

All bison style parsers are so ugly you really can't make them any worse.

I hate to touch issue 558, since it will spam the world, but that does seem like the right thing to do.