Skip to main content

Language Theory and Semantics

  • Chapter
  • First Online:
  • 3403 Accesses

Abstract

There are two key parts to any programming language, and these are its syntax and semantics . The syntax is the grammar of the language and a program needs to be syntactically correct with respect to its grammar. The semantics of the language is deeper, and determines the meaning of what has been written by the programmer.

This is a preview of subscription content, log in via an institution.

Buying options

Chapter
USD   29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD   49.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Hardcover Book
USD   64.99
Price excludes VAT (USA)
  • Durable hardcover edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Learn about institutional subscriptions

Notes

  1. 1.

    Recall that a monoid (M,*,e) is a structure that is closed and associative under the binary operation ‘*’ and has identity element ‘e’.

  2. 2.

    Chomsky made important contributions to linguistics and the theory of grammars. He is more widely known to-day as a critic of US foreign policy.

  3. 3.

    Backus–Naur Form is named after John Backus and Peter Naur. It was created as part of the design of the Algol 60 programming language, and is used to define the syntax rules of the language.

  4. 4.

    Of course, what the programmer has written may not be what the programmer had intended.

  5. 5.

    There are attribute (or affix) grammars that extend the syntactic description of the language with supplementary elements covering the semantics. The process of adding semantics to the syntactic description is termed decoration.

  6. 6.

    Hoare was influenced by earlier work by Floyd on assigning meanings to programs using flowcharts [Flo:67].

  7. 7.

    Total correctness is expressed using {P}a{Q} and program fragment a is totally correct for precondition P and postcondition Q if and only if whenever a is executed in any state in which P is satisfied then execution terminates, and the resulting state satisfies Q.

  8. 8.

    This virtual stack based machine was originally designed by Peter Landin to evaluate lambda calculus expres-sions, and it has since been used as a targefor several compilers.

  9. 9.

    This is similar to what a compiler does in that if errors are found during the compilation phase, the compiler halts and displays the errors and does not continue with code generation.

  10. 10.

    This essentially expresses that the names of bound variables is unimportant.

  11. 11.

    This essentially expresses the idea of function application.

  12. 12.

    This essentially expresses the idea that two functions are equal if and only if they give the same results for all arguments.

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Gerard O’Regan .

Rights and permissions

Reprints and permissions

Copyright information

© 2013 Springer-Verlag London

About this chapter

Cite this chapter

O’Regan, G. (2013). Language Theory and Semantics. In: Mathematics in Computing. Springer, London. https://doi.org/10.1007/978-1-4471-4534-9_10

Download citation

  • DOI: https://doi.org/10.1007/978-1-4471-4534-9_10

  • Published:

  • Publisher Name: Springer, London

  • Print ISBN: 978-1-4471-4533-2

  • Online ISBN: 978-1-4471-4534-9

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics