Windows ini file to facts

Hello,

I am looking to convert an configuration file that uses some kind of windows ini file format into facts. What would be a good way to read and parse an ini file. I guess the overall format is:

[section header]
phrase 1 = phrase 2

while phrase 2 can be empty

It looks like section header could also be parsed into [arg1_num_arg2 arg3]

any thoughts are much appreciated,

Daniel

DCG is the first option that comes to mind.

Also the old versions of SWI-Prolog used ini files (ref) so you would have to go back to earlier GitHub pushes to find the old code.

As always check the source for SWI-Prolog, libraries and packages at GitHub.

They were called .ini, but contained Prolog. Probably wasn’t a great idea.

I’d assume someone will have a library to read and/or write these files?

1 Like