Oses Pageview

Sunday, April 14, 2013

PRECEDENCE PARSER AND LL(1) GRAMMAR.






PRECEDENCE PARSER.
The process of discovering a derivation from a set of production rules is called parsing. Technically, parsing can be seen as a process of determining if a string of tokens can be derived from the start state of a grammar. Precedence parser or LR(1) parser, is a type of parser that set rules for binding operators to
operands, Higher precedence operators bind to their operands before lower precedence ones. e.g., / and * have equal precedence, but are higher than either + or -, which have equal precedence. If two operators have the same precedence, we use what is called associativity to resolve the ambiguity. Operators can be either left associative, right              associative, or nonassociative.

LL (1) GRAMMAR.
If one can build a parsing table with no multiply-defined entries, then the grammar is LL(1).
Grammars with the LL(1) property are called predictive grammars because the parser can
“predict” the correct expansion at each point in the parse, while Parsers that capitalize on the
LL(1) property are called predictive parsers. One kind of predictive parser is the recursive

descent parser.

Click to Download Paper

No comments:

Post a Comment