John went to the store.


Back to John went to the store.

We can cover this 'corpus' completely with the following CFG:

Back to We can cover this 'corpus' completely with the following CFG:

What is parsing?

Back to What is parsing?

Start with an 'S' rule.


Back to Start with an 'S' rule.

Keep pushing rules that match the RHS of the item on top of the stack until you hit a word in your sentence.


Back to Keep pushing rules that match the RHS of the item on top of the stack until you hit a word in your sentence.

When you've found a match, keep the entry in a table (marked in red in the illustration) and pop.


Back to When you've found a match, keep the entry in a table (marked in red in the illustration) and pop.

The resulting links between successful table entries gives you your tree.


Back to The resulting links between successful table entries gives you your tree.

What to do when you don't find a match.

Back to What to do when you don't find a match.

A trivial example: 'Wow.'

Back to A trivial example: 'Wow.'

A less trivial example: 'Jesus wept.'


Back to A less trivial example: 'Jesus wept.'

Top-down parsing

Back to Top-down parsing

'Wow.', revisited.


Back to 'Wow.', revisited.

'Jesus wept.', revisited.


Back to 'Jesus wept.', revisited.

Bottom-up parsing

Back to Bottom-up parsing

Remarks

Back to Remarks