HiveBrain v1.2.0
Get Started
← Back to all entries
patternMinor

Weak Precedence Grammar and Parsing

Submitted by: @import:stackexchange-cs··
0
Viewed 0 times
weakparsinggrammarandprecedence

Problem

I am studying parsing, i.e. bottom-up parsing. it is said that there some rules which are used by weak precedence grammar. What does weak precedence grammar mean? What about precedence relation?

Any help will be appreciated. If it is possible, could you give an example. Thanks

Solution

Weak precedence is first an algorithm for parsing (see Parsing Techniques - A Practical Guide 1st edition p. 186). So a weak precedence grammar would be a grammar which can be parsed by this algorithm (see the reference for a description of the algorithm, you'll probably want to start at least a few pages earlier).

IIRC, the interest of weak precedence parsing dropped at lot when practical LR(1) variants (SLR(1) and LALR(1)) were discovered, but precedence algorithms are still sometimes used in hand written parser for parsing expressions while the rest of the grammar is parsed with a recursive descend variant.

Context

StackExchange Computer Science Q#11730, answer score: 2

Revisions (0)

No revisions yet.