CS374: Programming Language Principles - Syntax and Semantics

Activity Goals

The goals of this activity are:
  1. To explain the role of syntax in a programming language
  2. To differentiate between syntax and semantics

The Activity

Directions

Consider the activity models and answer the questions provided. First reflect on these questions on your own briefly, before discussing and comparing your thoughts with your group. Appoint one member of your group to discuss your findings with the class, and the rest of the group should help that member prepare their response. Answer each question individually from the activity on the Class Activity Questions discussion board. After class, think about the questions in the reflective prompt and respond to those individually in your notebook. Report out on areas of disagreement or items for which you and your group identified alternative approaches. Write down and report out questions you encountered along the way for group discussion.

Model 1: Semiotics: Signs and Symbols

Auld Lang Syne

Questions

  1. What word arrangements can you identify in this passage, or in general prose?
  2. What are the general phrase structures that you can see?
  3. What are the words of this language?
  4. How about the musical notation? What words, phrases, and structures are evident?

Model 2: Semantics

The quick brown fox jumped over the lazy dog.
They are flying kites.

Questions

  1. What is the subject, verb, and direct object of the first sentence?
  2. What is the subject and verb of the second sentence? Is there a direct object?

Model 3: Semantics in Programming

Questions

  1. What is the general syntax of a variable declartaion?
  2. What is the type of each variable in this program? Is this idea part of the syntax or at a higher level of abstraction? How does this relate to seeing a note on a music sheet versus playing a sound at a particular frequency?
  3. What is the tax rate for a person age 20 with an income of 20000? What should it be?
  4. What type should taxamount be? How do you know?

Submission

Submit your answers to the questions using the Class Activity Questions discussion board. You may also respond to questions or comments made by others, or ask follow-up questions there. Answer any reflective prompt questions in the Reflective Journal section of your OneNote Classroom personal section.