Skip to content
Nestor Arocha edited this page Jun 29, 2013 · 6 revisions

A grammar is a system of rules that describes a language. pydsl uses grammar rules to parse and extract information from an input.

Formats

  • regular expressions
  • Pydsl Grammar Format
  • mongo database query dictionaries
  • python ply module (only check support)

properties:

  • enum(gd): yields a list of accepted words
  • first(gd): yields a list of the first accepted subword/char
  • minsize(gd): length of the smaller accepted word
  • maxsize(gd): length of the biggest accepted word
  • alphabet(gd): returns the alphabet used by this gd

functions:

  • validate(gd, input): test the input string against the spec. In case of failure, it returns a list of errors
  • guess(input, [gd]): returns a list of grammar and alphabets that are compatible with the input
  • check(d, input): test the input string against the spec
  • extract(gd, input): extract all the slices of the input that are accepted by the definition

See also

  • [Grammar Format Support] (GrammarFormatSupport)
  • [Alphabets] (Alphabet)
Clone this wiki locally