grammar Format { token TOP { [ <comment>* [ <section> [ <line> | <comment> ]* ]* ]* } rule section { '[' <identifier> <subsection>? ']' } rule subsection { '"' <identifier> '"' } rule identifier { <[A..Za..z]> <[A..Za..z0..9_-]>+ } rule comment { <[";]> .*? $$ } rule line { <key> '=' <value> } rule key { <identifier> } rule value { .*? $$ } } Format.parse('lol.conf'.IO.slurp)