[GD-General] Text file parsing
Brought to you by:
vexxed72
From: Marc F. <mf...@pu...> - 2002-12-11 10:52:24
|
Hello, I'm currently writing a toolkit that will be used as a basis for my next game engine. It will feature one or several editing tools for content creation, as one of the objective is to be data-driven. In the process, I plan to use some intermediate text-based file formats, such as ASE for meshes (easy to export from any modelling packages), text shaders/material files and so on. My question is about the best way of writing file-parsers for these files. I can see currently 2 options 1) use some tools like Lex&Yacc - Pros : easy to use, fast development time, easy to make the grammar evolve - Cons : for now, I was unable to make Lex&Yacc create some nice C++ parser class that can be embedded in my tools. 2) write my own from scratch, maybe first writing a DumbParser class that just provides with a bunch of basic string function, acting like a Lexer and derive the different needed parsers from that, embedding the grammar inside - Pros : full control on the design and the implementation, in comparison to the obfuscated code from Ley/Yacc - Cons : more development time, grammar kind of hardcoded so not easily maintainable, I'm not very experienced in writing text parsers :) I wonder how people handle file parsing in their projects. Thanks for your help. -Marc |