Earlier this year at Puppet Camp EU, Randall Hansen ran an open space session on improving the Puppet user experience.
Lots of sharp edges were identified, but one issue that I raised was the annoying need for trailing commas to break up parameters in resource declarations.
I chatted about this briefly with Luke and for a laugh I decided to write a Treetop Parsing Expression Grammar (PEG) for Puppet resources that supported newlines as the parameter delimeter:
It’s throwaway code, but as far as I’m aware it’s relatively idiomatic Treetop.
It came in handy earlier this week when explaining PEGs to a new recruit into the R&D team at work.
Said recruit suggested that I publish it, as there aren’t too many examples of Treetop PEGs floating around.
To run the PEG over an example snippet:
Gemfile for running it and all the above code is in a Gist.