Key-Value parser in FORTRAN

Parser for key-value pairs that can be grouped into named sections; the sections can be nested inside other sections. An example of valid input is as follows:

root

! comment

   version =  15

  forces
    algorithm = 1
    some_params = (1.0, 3.0)

    ewald
        cut = 10.0
    end ewald
  end forces

  files
      input = 'in'
      output = 'out'
  end files

end root

There is one key-value (kv) pair ("version") and two sections ("forces" and "files") in the "root" section of the example input shown above; each of the sub-sections holds more kv pairs; the "forces" section includes also another sub-section ("ewald"); and so on. Values can be of integer, real, string or list type. The latter can hold instances of either type, including lists [e.g., "(1, 'a', ('g', 5.0), 3.0)"].

Download