Parser Combinator - Basic Idea

Basic Idea

In functional programming, parser combinators can be used to combine basic parsers to construct parsers for more complex rules. For example, a production rule of a context-free grammar (CFG) may have one or more ‘alternatives’ and each alternative may consist of a sequence of non-terminal(s) and/or terminal(s), or the alternative may consist of a single non-terminal or terminal or the empty string. If a simple parser is available for each of these alternatives, a parser combinator can be used to combine each of these parsers, returning a new parser which can recognise any or all of the alternatives.

A parser combinator can take the form of an infix operator, used to ‘glue’ different parsers to form a complete rule. Parser combinators thereby enable parsers to be defined in an embedded style, in code which is similar in structure to the rules of the grammar. As such, implementations can be thought of as executable specifications with all of the associated advantages.

Read more about this topic:  Parser Combinator

Other articles related to "basic idea":

Gyro Monorail - Principles of Operation - Basic Idea
... A spinning wheel is mounted in a gimbal frame whose axis of rotation (the precession axis) is perpendicular to the spin axis ... The assembly is mounted on the vehicle chassis such that, at equilibrium, the spin axis, precession axis and vehicle roll axis are mutually perpendicular ...
Diode Logic Gate Versions - AND Logic Gate - Basic Idea
... Therefore, the diode AND logic gate is a modified diode OR logic gate the diode AND gate is actually a diode OR gate with inverted inputs and output. ...

Famous quotes related to basic idea:

    Our basic ideas about how to parent are encrusted with deeply felt emotions and many myths. One of the myths of parenting is that it is always fun and games, joy and delight. Everyone who has been a parent will testify that it is also anxiety, strife, frustration, and even hostility. Thus most major parenting- education formats deal with parental emotions and attitudes and, to a greater or lesser extent, advocate that the emotional component is more important than the knowledge.
    Bettye M. Caldwell (20th century)

    It is a strange fact that freedom and equality, the two basic ideas of democracy, are to some extent contradictory. Logically considered, freedom and equality are mutually exclusive, just as society and the individual are mutually exclusive.
    Thomas Mann (1875–1955)