Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Implementing a PGN parser. Should I care about the import format ?

Author: Fabien Letouzey

Date: 01:09:08 02/21/05

Go up one level in this thread


On February 20, 2005 at 10:14:48, Mathieu Pagé wrote:

>Hi,
>
>I'm currently implementing a pgn parser. I think it is quite dificult to
>implement (efficiently) a parser for the PGN import format that require barely
>no consistencies.
>
>As an example it allow for two tag to be on the same line or to one tag to be
>spaned on multiple line.
>
>An implementation of a parser for this kind of tag will be way less efficient
>than one reading a tag wich comply with the export format (One tag per line, one
>line per tag).
>
>So, here is the question. Those of you who have already implemented a pgn
>parser, did you implement the import format, or just the export one? Or maybe a
>mix of them ? in the later case I would appreciate to have an overview a what
>you implemented and what you did not.
>
>Mathieu P.

A scanner (separate lexical analysis transforming input characters into
tokens/"words") will take care of these problems.

I would say it's not much more work than assuming export format, only a couple
of extra hours.  However if your program is already scattered with
single-character reads, you might lose more time.

If your tool is destined for other people, I would suggest you implement the
input format.  Otherwise, tools such as pgn-extract will clean up PGN files the
way you want, including fixing errors like non-SAN-conforming moves.

Fabien.




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.