Author: Christos Gitsis
Date: 16:04:18 06/22/05
Go up one level in this thread
On June 22, 2005 at 09:15:56, Mathieu Pagé wrote: >On June 21, 2005 at 19:11:55, Christos Gitsis wrote: > >>On June 21, 2005 at 15:56:04, Mathieu Pagé wrote: >> >>>On June 21, 2005 at 15:35:56, Andreas Rueckert wrote: >>> >>>>Did you look at the PGN parser of the JavaChess project >>>>(http://www.java-chess.de). It would be great to find more contributors for the >>>>PGN grammar, so anyone could write his own parser. >>> >>>No, i do not, but I will. >>> >>>However, I do not plan to use a grammar, what I'd like to do is write an >>>"hardcoded" parser. And I want it to be in C or C++. >>> >>>Mathieu Pagé >> >>I admit that I am not an experienced programmer, but just out of curiosity: >> >>Is it not a lot easier to use tools like flex/bison to help you make the parser, >>and add any C/C++ code that you want in there? >> >>What is the advantage of writing a "hardcoded" parser, as you say? > >Hi Christos, > > I have to admit I have never used any of thoses tools and they do not look easy >to use at my eyes. Now, it seems that everyone I talk about my idea of a PGN >parser seem to think that I should use a parsing rammar/tool, so I'll look at >this possibility (By the way do someone have a good doc about one of this tools >?). > > However, I also think (I can be wrong) that thoses tools are not as efficient >as an "harcoded" parser. Algorithms Efficiency is an obsession for me. If the >algorithm deserve to be coded it deserve to be code as efficiently as possible >(Note: Sometimes efficient can mean "clean" or "portable", not always "fast"). > > If you can point me to documentation of a tool you think I should use to write >my parser it would be appreciated. > >Mathieu Pagé Hi, I am in the beginning stages of writing a compiler as an exercise for a university course. I am using (after the suggestion of my professor) the tools flex (lexical analyzer) and bison (parser, syntactical analyzer). These tools are standard part of any Linux distribution and for Windows users can be used under the djgpp environment (www.delorie.com/djgpp). The two tools work in cooperation and let you define the grammar and the syntax of the language. You can add any C/C++ code you wish. Of course the compiler is a large project, and it would be an enormous or impossible task to write it without those tools, but perhaps a PGN parser could be written without them, with a bit of extra work. Documentation: http://www.gnu.org/software/flex/manual/html_mono/flex.html http://www.gnu.org/software/bison/manual/html_mono/bison.html I hope you write a good PGN parser!
This page took 0 seconds to execute
Last modified: Thu, 15 Apr 21 08:11:13 -0700
Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.