~ Office Supplies ~~ Buy Posters ~~ A-Z Products ~~ Website Advertising


Parser - Wikipedia

<<Up     Contents

Parser

A parser is a computer program or a component of a program that analyses the grammatical structure of an input, with respect to a given formal grammar. Parsers can be made both for natural languages and for programming languages. Programming language parsers tend to be based around context free grammars as fast and efficient parsers can be written for them. For example LALR parsers are capable of efficiently analysing a wide class of context free grammars.

The task of the parser can be summarized as to determine if and how the input can be derived from the start symbol with the rules of the grammar. A parser can do this in essentially two ways: it can start with the input and attempt to rewrite it to the start symbol, a so-called bottom-up parser, or it can start with the start symbol and try to rewrite it to the input, a so-called top-down parser. For example LL parsers are top-down parsers and LR parsers are bottom-up parsers.

Another important distinction is whether the parser generates a leftmost derivation or a rightmost derivation (see context-free grammar). LL parsers will generate a leftmost derivation and LR parsers will generate a rightmost derivation (although usually in reverse).

A parser generator is a program which takes a formal description of a grammar (e.g. in BNF) and outputs source code for a parser which will recognise valid strings obeying that grammar and perform associated actions. Unix's yacc is a well known example. Among others are SableCC.

Table of contents showTocToggle("show","hide")

Overview of Parsers

Top-down parsers

Bottom-up parsers

See also


This article (or an earlier version of it) contains material from FOLDOC, used with permission.

wikipedia.org dumped 2003-03-17 with terodump




 
 
213 carat Blue LAPIS LAZULI gold Pyrite gem stone Cab Cabbing cabochon wirewrap rough gemstone 42 gr
 213 carat Blue LAPIS LAZULI gold Pyrite Cab Cabbing cabochon wirewrap 42 gr 
 
66 carat huge OPTICAL QUARTZ gem jewel Faceted 24 mm round portuguese cut loose collector gemstone
 66 carat huge OPTICAL QUARTZ jewel ed 24 mm round portuguese cut loose collector  
 
173 carats gray AGATE gem Polished slab rectangle block Cabbing cab cabochon rough gemstone 34 grams
 173 carats gray AGATE Polished slab rectangle block Cabbing cab cabochon 34 grams 
 
Red green AMMOLITE gem stone Freeform cabochon cabbing jewelry rough Ammonite opal 10 carats 2 grams
 Red green AMMOLITE Freeform cabochon cabbing jewelry Ammonite opal 10 carats 2 grams 
 
100 ct Fluorescent pink white MANGANOCALCITE gem stone Hand polished jewelry rough gemstones 20 gram
 100 ct Fluorescent pink white MANGANOCALCITE Hand polished jewelry 20 gram