groupon / cson-parser

Simple & safe CSON parser
BSD 3-Clause "New" or "Revised" License
133 stars 27 forks source link

Implement clean parser #7

Open jkrems opened 10 years ago

jkrems commented 10 years ago

Right now we are using CSR for parsing which handles a huge superset of the files we'd want to parse. We should consider implementing a clean parser for CSON as part of this repo.

jkrems commented 10 years ago

cc @abloom @mcculloughsean - on a scale of 1-10: How stupid is this idea?

abloom commented 10 years ago

For what benefit? Why would we want to strip it?

jkrems commented 10 years ago
├─┬ coffee-script-redux@2.0.0-beta8
│ ├── cscodegen@0.1.0 (git://github.com/michaelficarra/cscodegen.git#73fd7202ac086c26f18c9d56f025b18b3c6f5383)
│ ├─┬ escodegen@0.0.28
│ │ ├── esprima@1.0.4
│ │ └── estraverse@1.3.2
│ ├─┬ esmangle@0.0.17
│ │ ├── escope@1.0.1
│ │ ├── esprima@1.0.4
│ │ ├─┬ esshorten@0.0.2
│ │ │ └── estraverse@1.2.0
│ │ ├── estraverse@1.3.2
│ │ └─┬ optimist@0.6.1
│ │   ├── minimist@0.0.8
│ │   └── wordwrap@0.0.2
│ ├─┬ nopt@2.1.2
│ │ └── abbrev@1.0.4
│ ├─┬ source-map@0.1.11
│ │ └── amdefine@0.1.0
│ └── StringScanner@0.0.3

Pretty much 100% of that is not used by us. But somebody who wants to parse CSON files will have to download all of it. And there's the point that CSR is in eternal beta and seems all but abandoned.

abloom commented 10 years ago

I mean, it sounds like a fine idea, but it sounds like a bunch of work that's only benefit is to make the download smaller? Is there a performance improvement?

jkrems commented 10 years ago

I wouldn't expect a serious performance improvement (it's not doing that much more). But it would cut the installed size of this package in half and help defining what exactly valid CSON is (without referring to CSR implementation details). I'm not sure the initial implementation is really worth it, but it might be a fun weekend project at some point.

johan commented 10 years ago

It would be pretty neat if it didn't choke on legal coffee-script literals that cs-redux hates on, such as

{ "comma": "first"
, "basic": "json"
}
jkrems commented 10 years ago

@johan Since you know my hate for comma-first I'm sure you know that this is unlikely to make the cut if I'd be writing the parser... ;)

johan commented 10 years ago

I thought it was Sean McCullough who was the comma-first hater. :-)

mcculloughsean commented 10 years ago

:+1: to a clean implementation without a CSR dependency