Skip to main content Accessibility help
×
Hostname: page-component-8448b6f56d-wq2xx Total loading time: 0 Render date: 2024-04-25T03:37:07.896Z Has data issue: false hasContentIssue false

5 - Parsing and recognition

Published online by Cambridge University Press:  05 June 2012

Jeffrey Shallit
Affiliation:
University of Waterloo, Ontario
Get access

Summary

In this chapter we investigate methods for parsing and recognition in contextfree grammars (CFGs). Both problems have significant practical applications. Parsing, for example, is an essential feature of a compiler, which translates from one computer language (the “source”) to another (the “target”). Typically, the source is a high-level language, while the target is machine language.

The first compilers were built in the early 1950s. Computing pioneer Grace Murray Hopper built one at Remington Rand during 1951–1952. At that time, constructing a compiler was a black art that was very time consuming. When John Backus led the project that produced a FORTRAN compiler in 1955–1957, it took 18 person-years to complete.

Today, modern parser generators, such as Yacc (which stands for “yet another compiler-compiler”) and Bison, allow a single person to construct a compiler in a few hours or days. These tools are based on LALR(1) parsing, a variant of one of the parsing methods we will discuss here. Parsing is also a feature of natural language recognition systems.

In Section 5.1 we will see how to accomplish parsing in an arbitrary CFG in polynomial time. More precisely, if the grammar G is in Chomsky normal form, we can parse an arbitrary string wL(G) of length n in O(n3) time. While a running time of O(n3) is often considered tractable in computer science, as programs get bigger and bigger, it becomes more and more essential that parsing be performed in linear time.

Type
Chapter
Information
Publisher: Cambridge University Press
Print publication year: 2008

Access options

Get access to the full version of this content by using one of the access options below. (Log in options will check for institutional or personal access. Content may require purchase if you do not have access.)

Save book to Kindle

To save this book to your Kindle, first ensure coreplatform@cambridge.org is added to your Approved Personal Document E-mail List under your Personal Document Settings on the Manage Your Content and Devices page of your Amazon account. Then enter the ‘name’ part of your Kindle email address below. Find out more about saving to your Kindle.

Note you can select to save to either the @free.kindle.com or @kindle.com variations. ‘@free.kindle.com’ emails are free but can only be saved to your device when it is connected to wi-fi. ‘@kindle.com’ emails can be delivered even when you are not connected to wi-fi, but note that service fees apply.

Find out more about the Kindle Personal Document Service.

  • Parsing and recognition
  • Jeffrey Shallit, University of Waterloo, Ontario
  • Book: A Second Course in Formal Languages and Automata Theory
  • Online publication: 05 June 2012
  • Chapter DOI: https://doi.org/10.1017/CBO9780511808876.006
Available formats
×

Save book to Dropbox

To save content items to your account, please confirm that you agree to abide by our usage policies. If this is the first time you use this feature, you will be asked to authorise Cambridge Core to connect with your account. Find out more about saving content to Dropbox.

  • Parsing and recognition
  • Jeffrey Shallit, University of Waterloo, Ontario
  • Book: A Second Course in Formal Languages and Automata Theory
  • Online publication: 05 June 2012
  • Chapter DOI: https://doi.org/10.1017/CBO9780511808876.006
Available formats
×

Save book to Google Drive

To save content items to your account, please confirm that you agree to abide by our usage policies. If this is the first time you use this feature, you will be asked to authorise Cambridge Core to connect with your account. Find out more about saving content to Google Drive.

  • Parsing and recognition
  • Jeffrey Shallit, University of Waterloo, Ontario
  • Book: A Second Course in Formal Languages and Automata Theory
  • Online publication: 05 June 2012
  • Chapter DOI: https://doi.org/10.1017/CBO9780511808876.006
Available formats
×