https://github.com/sandy98/pgnparser
A simple utility to parse PGN chess files
https://github.com/sandy98/pgnparser
Last synced: about 1 year ago
JSON representation
A simple utility to parse PGN chess files
- Host: GitHub
- URL: https://github.com/sandy98/pgnparser
- Owner: sandy98
- License: mit
- Created: 2017-04-11T04:40:35.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2019-12-04T04:47:09.000Z (over 6 years ago)
- Last Synced: 2025-02-07T12:39:51.975Z (over 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 18.1 MB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## PGNParser
A simple utility to parse PGN chess files and retrieve the collection of games
within in JSON format.
Could be regarded as a PGN compiler, being JSON the 'object format' produced by the compiler.
### Build
Just type 'make' and get:
* pgnparser: executable that reads the provided file (or stdin), from game
(second arg, defaults to 1) to game (third arg, defaults to 100) and prints
the json resulting array to stdout.
* libpgnparser.so: shared dynamic link library which basically exports 2
functions: game_count(pgn_filename) and parser(pgn_filename, start_game,
end_game).
### Usage
There are a bunch of files under tests directory which provide example of using
the library from python, ruby, node.js (js and coffee-script) and clojure.
Their contents is pretty self-explanatory as to how to use them.
It's also provided the directory 'pgnfiles', containing some pgn files for test purpose,
and 'jsonfiles' directory, home for files generated using 'make-json.sh' script.
### Comments
Library generated using legendary unix tools 'lex' and 'yacc' (see Makefile),
which in the system they were made map to 'flex' and 'bison' respectively.