Did you know ... Search Documentation:
Pack bibtex -- prolog/bibtex_dcg.pl
PublicShow source

DCG rules that can parse BibTeX elements.

In this text, a pseudo-EBNF syntax is used to explain some structures.

BibTeX entry format and token names

The following illustrates a BibTex entry and its format. The name of each element is used as a DCG rule's predicate name.

"@" name "{" label ","
    field ","
    field ","

Each field's format is as follows:

key "= {" value "},"

Important fields

Fields like author and keywords have their own format. DCG rules for them are included here. However, consult the bibtex_fields library for more information.

Author value

The author field format is as follows:

`author "and" author "and" author "and" ...`

There are two possible formats for each author's name:

  • `surname "," name`
  • `name surname`


Keywords are phrases written in the article. There are other fields that use the same syntaxs for user-defined keywords.

The format is the same:

`a_phrase "," a_phrase "," ...`

The keywords separators supported are "," and ";". They can be mixed.

Important terms

  • entry/3 is entry(Name: term, Label: string, LstField: list).
  • field/2 is field(Key: atom, Value: string). @author Gimenez, Christian @license GPLv3
Return an entry/3 term corresponding with the codes parsed.
Entry- entry(Name:atom, Label:string, Lst: list).
See also
- field//2
 field(-Key:codes, -Value:codes)// is det
Return the Key = Value field from a bibtex field.
 fields(-Lst:list)// is det
Return a list of field/2 terms parsed from a bibtex fields string. Each element format is field(+Key: atom, +Value: string).
 author(-Surname:list, -Name:list)//
Two types of author field's value:
  • Surnames, Names
  • Name Surname
  • Names Surname
Process a list of authors (i.e. author field value). Use it with a value string only.
Lst- is a list of author/2 terms: author(Surname:string, Name:string).
True iff char is considered as separators.
True iff Keywords is a list of keywords parsed from the input. The separator should be one of k_sep/1.
Keywords- a list of strings.
See also
- keyword_spaces//1
Retrieve all the keywords using spaces as separator.
Keywords- is a list of string codes.