Skip to main content Accessibility help
×
Hostname: page-component-77c89778f8-vpsfw Total loading time: 0 Render date: 2024-07-16T13:28:06.194Z Has data issue: false hasContentIssue false

8 - Syntactic Analysis

Published online by Cambridge University Press:  05 June 2012

Guy Cousineau
Affiliation:
Ecole Normale Supérieure, Paris
Michel Mauny
Affiliation:
Institut National de Recherche en Informatique et en Automatique (INRIA), Rocquencourt
Get access

Summary

Most programs, especially those that expect a character string as input, begin by recognizing such strings in order to determine whether or not one happens to represent valid input. Next—in fact, at the same time—such a program transforms the string into internal data that is easier to handle. The preceding chapters assumed the existence of such features and functions. This chapter indicates how to program them.

A command to an operating system (such as Is on Unix, etc.) is a very simple example of a program that takes character strings as input and then decides to accept or reject them. A compiler is a more complicated program to take character strings as input; it accepts the concrete syntax of the program to compile. A compiler decides to accept or reject the program to compile; if it accepts, it transforms the program into more easily managed data, such as abstract syntax trees.

In each of these cases, we say that the command shell or the compiler accepts phrases belonging to a certain language; in the case of the command shell, we mean the options and arguments valid for a given command; for the compiler, the programming language to compile. In both cases, they reject any other phrases. In this chapter, we will call a language the set (possibly infinite) of acceptable character strings, and the chief problem that we take up is that of recognizing the phrases belonging to a given language.

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

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.

  • Syntactic Analysis
  • Guy Cousineau, Ecole Normale Supérieure, Paris, Michel Mauny, Institut National de Recherche en Informatique et en Automatique (INRIA), Rocquencourt
  • Translated by K. Callaway
  • Book: The Functional Approach to Programming
  • Online publication: 05 June 2012
  • Chapter DOI: https://doi.org/10.1017/CBO9781139173018.012
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.

  • Syntactic Analysis
  • Guy Cousineau, Ecole Normale Supérieure, Paris, Michel Mauny, Institut National de Recherche en Informatique et en Automatique (INRIA), Rocquencourt
  • Translated by K. Callaway
  • Book: The Functional Approach to Programming
  • Online publication: 05 June 2012
  • Chapter DOI: https://doi.org/10.1017/CBO9781139173018.012
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.

  • Syntactic Analysis
  • Guy Cousineau, Ecole Normale Supérieure, Paris, Michel Mauny, Institut National de Recherche en Informatique et en Automatique (INRIA), Rocquencourt
  • Translated by K. Callaway
  • Book: The Functional Approach to Programming
  • Online publication: 05 June 2012
  • Chapter DOI: https://doi.org/10.1017/CBO9781139173018.012
Available formats
×