O'Reilly logo

Text Processing with Ruby by Rob Miller

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Rule-Based Parsers

Stepping above the simple StringScanner-based parsers that we’ve looked at thus far requires us to enter a heady and complex world. Parsing is studied by both computer scientists and linguists, and its techniques are the subject of much research. Major advancements continue to be made, and the field is an active one.

But as with most such fields, it’s possible to reap the advantages of this active research without having to study for a doctorate, and one relatively recent development that will be useful to us is the parsing expression grammar (PEG). A grammar is essentially a way of defining the rules that govern a particular language. Using a grammar, a parser can then discern the meaning of text written in that language. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required