The application I am working on supports importing data defined in different ASCII formats. I want to allow users to define their own ASCII based file formats which the application can import.
I am considering two different approaches:
- API. Make a script API e.g. Lua, Python or JavaScript which allows constructing data. Importer will be defined as script which parses the custom file format.
- Protocol / fileformat. There will be a standard file format or protocol which supports all features. To add a reader for custom format just write a unix filter, that takes custom format on standard input and output standard format on standard output.
What do you think would be the best approach and why?
At the moment I am leaning towards option 2, because it seems simple and would allow importer to be written in any language.