Skip to main content Accessibility help
×
Hostname: page-component-7bb8b95d7b-2h6rp Total loading time: 0 Render date: 2024-10-01T07:17:30.316Z Has data issue: false hasContentIssue false

4 - Grammars

Published online by Cambridge University Press:  02 December 2009

James A. Anderson
Affiliation:
University of South Carolina
Get access

Summary

Formal grammars

A grammar is intuitively a set of rules which are used to construct a language contained in Σ* for some alphabet Σ. These rules allow us to replace symbols or strings of symbols with other symbols or strings of symbols until we finally have strings of symbols contained in Σ allowing us to form an element of the language. By placing restrictions on the rules, we shall see that we can develop different types of languages. In particular we can restrict our rules to produce desirable qualities in our language. For example in our examples below we would not want 3 + ÷4 − ×6. We also would not want a sentence Slowly cowboy the leaped sunset. Suppose that we begin with a word add, and that we have a rule that allows us to replace add with A + B and that both A and B can be replaced with any nonnegative integer less that ten. Using this rule, we can replace A with 5 and B with 3 to get 5 + 3. There might also be an additional rule that allows us to replace add with a different string of symbols.

If we add further rules that A can be replaced by A + B and B can be replaced by A × B, we can start by replacing add with A + B. If we then replace A with A + B and B with A × B, we get A + B + A × B.

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

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.

  • Grammars
  • James A. Anderson, University of South Carolina
  • Book: Automata Theory with Modern Applications
  • Online publication: 02 December 2009
  • Chapter DOI: https://doi.org/10.1017/CBO9780511607202.005
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.

  • Grammars
  • James A. Anderson, University of South Carolina
  • Book: Automata Theory with Modern Applications
  • Online publication: 02 December 2009
  • Chapter DOI: https://doi.org/10.1017/CBO9780511607202.005
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.

  • Grammars
  • James A. Anderson, University of South Carolina
  • Book: Automata Theory with Modern Applications
  • Online publication: 02 December 2009
  • Chapter DOI: https://doi.org/10.1017/CBO9780511607202.005
Available formats
×