From Wikipedia, the free encyclopedia
Jump to: navigation, search

Old text[edit]

Original entry on main page "wikified" a bit.

A parser is a program or subprogram that analyzes the grammatical structure of an input stream of tokens, with respect to a given grammar (typically for a programming language) and determines if a correct translation if possible.

Some discussion that may help flesh out the article a bit. This is paraphrase from the "dragon book" by an inexperienced programmer so it should not be added to entry except by a confident software knowledgeable person.

Using the rules provided by the language specification or grammar the program statements are broken down into smallest meaningful elements or tokens. It is useful to conceptualize a binary parse tree when discussing the design and operation of parser. Various means of traversing this tree (moving systematically through processing all nodes) are used in various types of parser.

Methods of parsing Top-Down Parsing many others here

Basically, a parser is a translater from one language to another based upon completely specified grammers.

A definative text in the field of software languages is The Dragon Book, so named for the picture of a dragon peering through a computer monitor at a knight with various shields, armour, and sword labeled with key elements necessary for mastery of the subject.

Reference: "Compilers: Principles, Techniques, and Tools" by Alfred V. Aho, Ravi Sethi, and Jeffrey D. Ullman

Parser are also used for porpoises not defined by formal grammars. scanf parses input. Other parsers use analytical descriptions of the language to be parsed. Formal grammars are not the only way of describing grammars. See Analytic grammars

From Semantic action routine:

Semantic action routines are simple functions invoked by the parser, which add context sensitive informations (e.g. type of a variable...) to the result of the Syntaxanalysis, done by the parser. They also build the intermediate representation of the source code or even the goal language.
  1. (cur) (last) . . 11:07, Feb 5, 2004 . .
  2. (cur) (last) . . 11:04, Feb 5, 2004 . .

Someone see if this is of any use to the article. Dori | Talk 20:53, Feb 5, 2004 (UTC)

I've mentioned it in compiler-compiler because I think that's where it belongs. -- Jan Hidders 16:19, 8 Feb 2004 (UTC)

Hard to understand[edit]

I'm finding the article a little hard to understand. The most confusing thing is, in an introduction, the use of domain specific terminology. I barely know what a parser is, so it feels unnatural to be knee deep already. If something is fundamental to parsing, please don't hesitate to describe (and duplicate) it here. Context free grammar would take a line to abridge, for example. An example of what purpose they serve/what they do could really help the first paragraph. Just some thoughts. 07:37, 5 Mar 2005 (UTC)

I modified the article. How do you like it? Which parts can be improved?
I understand your problem. Especially I am puzzled why the article focuses on grammars like context-free grammar. This is not an article about grammars, you know. Lucky for us, I noticed parsing article has a better description of parser. -- Taku 17:41, Apr 9, 2005 (UTC)

Informal poll for merging with Parsing[edit]

Hokay, guys, let's take a poll to see if we all agree to merge the articles. The front page mentions a merge poll, but i can't see one :) So

  • Strong Merge, use Parser as the main article, speedy parsing, create seperate section inside Parser about parsing. Don't mix parser and parsing in a long (more than a page) single article.