Generic selectors
Exact matches only
Search in title
Search in content
Post Type Selectors

Differentiate between top-down and bottom-up parser.Under which conditions predictive parsing can be constructed for a grammar ?

AspectTop-Down ParserBottom-Up Parser
ApproachStarts from the highest level and works downwards.Starts from the lowest level and builds upwards.
AnalogyReading a story: starts from the title and reads down.Solving a puzzle: starts with pieces, builds upwards.
Parsing StrategyBegins with the start symbol and expands it.Begins with terminal symbols, combines to form the start symbol.
Prediction CapabilityLess predictive without lookahead.More predictive with proper lookahead.
ExampleRecipe: starts with dish name, breaks down to steps.Sentence: starts with words, builds to complete sentence.
EfficiencyCan be less efficient due to backtracking.Generally more efficient with proper algorithms.
Predictive parsing can be constructed if the following condition holds :
1.Every grammar must be recursive in nature.
2.Each grammar must be left factored.

Leave a Comment