Presentation is loading. Please wait.

Presentation is loading. Please wait.

Daisy Arias Math 382/Lab November 16, 2010 Fall 2010.

Similar presentations


Presentation on theme: "Daisy Arias Math 382/Lab November 16, 2010 Fall 2010."— Presentation transcript:

1 Daisy Arias Math 382/Lab November 16, 2010 Fall 2010

2 In computer science and linguistics parsing or more formally, syntactic analysis, is the process of analyzing a text. Made of a sequence of tokens (for example, words), to determine its grammatical structure with respect to a given (more or less) formal grammar.

3 Computer Science is frequently described as the systematic study of algorithmic processes that create, describe, and transform information. While Linguistics is the study of language structure (grammar) and the study of meaning.

4 What exactly is Syntactic Analysis?  The purpose of syntactic analysis is to determine the structure of the input text.  This structure consists of a list of phrases, the smallest of which are the basic symbols and the largest of which is the sentence.

5 Example: Linguistics Alex’s mom, Cathy, will be leading the meeting on Thursday. Basic Symbols Sentence Who?  Alex  Cathy What? Leading a meeting When? Thursday Are the words actually in the dictionary? Does the order of the words convey some kind of coherent thought?

6 Example: Computer Science In programming language such as C, C++, Java, etc. consider the following expression sum=3+2; StringMeaning sumIdentifier =Assignment Operator 3Number +Addition Operation 2Number ;End of Statement

7 What a Computer might be thinking... Lexical analysis is performed which is defined to be the process of converting a sequence of characters into a sequence of tokens. Tokens: characters/words A parse tree is an ordered tree that represents the syntactic structure of a string according to some formal grammar. A compiler, Interpreter or Translator generator is a tool that creates a parser, interpreter, or compiler from some form of formal description

8 Types of parser The task of the parser is essentially to determine if and how the input can be derived from the start symbol of the grammar. This can be done in essentially two ways: Top-down parsing- Top-down parsing can be viewed as an attempt to find left-most derivations of an input-stream by searching for parse trees using a top-down expansion of the given formal grammar rules. Tokens are consumed from left to right. Inclusive choice is used to accommodate ambiguity by expanding all alternative right-hand-sides of grammar rules. Bottom-up parsing- A parser can start with the input and attempt to rewrite it to the start symbol. Intuitively, the parser attempts to locate the most basic elements, then the elements containing these, and so on. LR parsers are examples of bottom-up parsers. Another term used for this type of parser is Shift-Reduce parsing.

9 The first compiler was written by Grace Hopper, in 1952, for the A-0 programming language. The FORTRAN team led by John Backus at IBM is generally credited as having introduced the first complete compiler in 1957.


Download ppt "Daisy Arias Math 382/Lab November 16, 2010 Fall 2010."

Similar presentations


Ads by Google