开发者

Writing BibTex parser

开发者 https://www.devze.com 2023-01-09 01:06 出处:网络
How should I start writing a parser for BibTex files. As the initial design I see following steps. List down grammar

How should I start writing a parser for BibTex files. As the initial design I see following steps.

  1. List down grammar
  2. Build a tokenizer
  3. Do parsing of token stream against开发者_开发知识库 grammar

We also need some error mechanism, so the users uploading bibtex files can know line numbers where is the error in their BibTex files. I am looking for community opinion to target this problem.

(please point if there are any existing open source C# or VB.NET BibTex parsers.)


There are many tools available to assist you with this, such as ANTLR or the GOLD Parsing System. I usually use the latter to create my parser grammars.


I've published an open source library for BibTex format (load/save/export to Excel), allowing both non-typed (Key/Value dictionary) and strong typed access to the BibTex entries.

It might not fit well your purpose, as it is weak on validation (has none of it :) ), but might help anyway:

  • Nuget Package
  • GitHub repository
  • About the package on my web site
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号