Fwd: EBNF for Diet YAML
Trans <[email protected]>
| Newsgroups | gmane.text.yaml.general |
|---|---|
| Message-ID | <CAEu+kw2z4zSuxibDeAOsxPJacH8WbstiVke4JFr5-5EYUWWvCQ@mail.gmail.com> |
On Thu, Jun 26, 2014 at 11:35 AM, Ingy dot Net <[email protected]> wrote: > Hi Trans, > > Good timing. I'm not sure where to start. Maybe with this: > https://github.com/ingydotnet/yaml-pgx/blob/master/yaml.pgx > > That's a working Pegex grammar. Pegex is a parsing framework that can turn > that grammar into a working parser in any language that has regular > expression support. There's a lot of work yet to do, but I'm working on it. > Please join me. > Awesome that will be very helpful. I'll try to help, though I expect the devil is in the details, and when it comes to the YAML spec, it's the details that devil me ;-) > Here's a complete JSON grammar: > https://github.com/ingydotnet/json-pgx/blob/master/json.pgx and you can > find other working grammars ending in -pgx under my github account. > > My vision for Pegex is to have a yaml.pgx based implementation in every > language, where bugs can be fixed in exactly one place. > > That would be FANTASTIC. > ---- > > Regarding your grammar, a couple things: > > > - Scalar types like String Number Date Boolean Nil don't really belong > at this level. They are handled conceptually at the type resolution phase > of the stack (even if you are imagining a no stack implementation). > > You mean they are just strings then? I still need to represent the fact that they become numbers, dates and boolean, though (see below). > > - Indentation is the tough part in bnf. It requires a stack and can't > really be expressed in pure BNF to my knowledge. I'm currently working > through how to do that nicely in Pegex. Fortunately there is this real > world PEG supporting indentation: > https://github.com/michaelficarra/CoffeeScriptRedux/blob/master/src/grammar.pegjs > , so using that as a guideline. > > Yea, I realize the indention is a problem technically. But I'm not worried about having a 100% precise BNF spec. I'll just explain the differences verbally. My main purpose is to give an over all understanding of the flow and format in a single graphic. > Perl has had a YAML subset called YAML::Tiny > https://github.com/Perl-Toolchain-Gang/YAML-Tiny#readme and it is used > heavily in CPAN tooling. > > It seems like a good idea at first, but it's not YAML, and yet people > think it is so they get bad surprises eventually. I'm not a fan, and am > working to make a full YAML parser in less code than YAML::Tiny. (Note: > even though I'm not a fan I am a major contributor because it's a big part > of YAML in Perl and I want it steered correctly). > > ---- > > TOML is not very impressive. A slightly modified INI. That said I use INI > quite often for config stuff these days. It's made for configuration. YAML > is a data serialization language that just happens to get (mis)used for > config. I say this because Oren and Clark and I always considered that YAML > was not the best thing for config. > Ah, hell no! YAML is AWESOME for configuration. You guys must not program in Ruby much --it's all over the place. And I am seeing it turn up in all sorts of other places too like Java, Android and Ubuntu.[1] I think you should reconsider that "(mis)used" statement really think about what you're saying here. You take away all the uses of YAML as configuration and all that will be left is a drop or two in a ten gallon hat. If you want YAML to be embraced on the large scale you have to be willing to embrace it one the small scale too. And now I guess I see why it has been languishing, with people defecting to JSON and now TOML. YAML really needs to support a light version as part of a larger standards base. It's just foolish not embrace it's obvious success. > TOML has no Dumper. It can't be used for anything but config. So I don't > think we need to worry about TOML replacing YAML except in places where INI > might have been better in the first place. > No way, man! I 've used INI for config too (as far back as the 90's), and as soon as you need anything beyond basic `this.that = stuff`, you got nothing. And obviously so, b/c that's exactly why a YAINI called TOML was created. I once thought that if INI were just a little more capable then we won't need YAML for configuration. But I tried my hand at it for a long time, and it just doesn't pan out well. > Back to the Pegex grammar. This is my most exciting work to date. It goes > deeper than I could possibly express in this email. I'd love it if you'd > join forces with me. #pegex on irc.freenode.net. > I'm down, if there is anything I can help with. I think it's a great idea. trans. [1] Just few examples: * http://jekyllrb.com/docs/configuration/ * http://guides.rubyonrails.org/configuring.html#configuring-a-database * http://www.datastax.com/documentation/cassandra/1.2/cassandra/configuration/configCassandra_yaml_r.html * http://www.sinatrarb.com/contrib/config_file.html * http://docs.typo3.org/flow/TYPO3FlowDocumentation/TheDefinitiveGuide/PartIII/Configuration.html * https://juju.ubuntu.com/docs/charms-config.html * https://blog.process-one.net/switch-ejabberd-configuration-to-yaml/ * http://beets.readthedocs.org/en/latest/reference/config.html * https://github.com/openstack/governance/blob/master/reference/programs.yaml * http://tomasz.janczuk.org/2012/05/yaml-configuration-support-in-iisnode.html * ... google search and it just goes on and on ... -- Sorry, says the barman, we don't serve neutrinos. A neutrino walks into a bar. Trans <[email protected]> 7r4n5.com http://7r4n5.com ------------------------------------------------------------------------------ Open source business process management suite built on Java and Eclipse Turn processes into business applications with Bonita BPM Community Edition Quickly connect people, data, and systems into organized workflows Winner of BOSSIE, CODIE, OW2 and Gartner awards http://p.sf.net/sfu/Bonitasoft _______________________________________________ Yaml-core mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/yaml-core