CS 333: Project #4

Language Semantics

In this project you'll explore both the syntax and semantics of certain types of statements in your chosen languages.


Tasks

For each of your languages, complete the following tasks.

  1. Types: what types does the language support? Write a program that demonstrates the internal representation and limitations of two data types (e.g integers and floating point numbers).
  2. Operator Precedence: what are the operator precedence rules of the language? Write a program that demonstrates the operator precedence for logical (and, or, not), equality, comparison, and the standard binary and unary operators. If your language has semantic modifiers like C (& and *), include those.
  3. Implicit Conversion: what are the rules for implicit conversion in the language? If possible, write a program that demonstrates at least three rules for implicit conversion. Include at least one example of implicit conversion with potentially unexpected consequences. If your language does not support implicit conversion (e.g. Ada) then show examples in that language that do not work, but which would work in C.
  4. Scoping: what are the rules for scoping in the language? Write a program that demonstrates the properties of scoping, similar to the examples discussed in class. Is your language statically or dynamically scoped?
  5. Aggregate Types: what kind of aggregate types are supported by the language? In C, these would be structs and unions. In C++, you could add classes to that set. Write a program that demonstrates these structures and how to create and access them.
  6. Function Type: how are functions treated in the language as a data type? Can you assign a function to a variable? Can you pass a function to another function? If so, how do you then execute the function using the refrence?
  7. Write a program whose semantics would change depending upon the particular machine you use. Explain why in comments in your code. You are free to use one of your chosen languages or C. If you can actually find two machines with sufficiently different hardware to demonstrate your code is correct, that's a bonus. The key is to find a 32-bit machine and a 64-bit machine.

Extensions


Writeup

The writeup for this week is answering the questions in assignment tasks, plus the code, which should be integrated with your writeup. Once you have written up your assignment, give your main page for this week the label:

cs333f14language2