Programming Language Project

Question Set #3

Due: November 9, 2004 at start of class

Answers MUST be keyed in before printing

 

Name Christopher Payne          Programming Language  Object Oriented Turing

 

Note:  For each of these question sets, you should look first in the reports you were given.  You should then check the information on the Web or in a book.  If the information is not in the report, you should say so and then find it on the Web or in a book.

 

The first 4 questions are about comments in your language.

 

1.        Show a typical comment in your language

                  % This is a typical comment in OOT

              /* This is also a typical comment in OOT. */

 

 

2.       Where does comment begin, end?

When using the percent symbol, %, to begin a comment the comment begins after the % and ends at the end of that line.

When using /* … */ the comment begins after the /* and ends when it gets to */. 

 

3.       Where can it be placed? 

                  A comment can be placed anywhere as long as it follows either a % or /* symbol, so it can be on a separate line by itself or

               a line containing code but placed after the code.

 

4.       Can a single comment extend over more than one line?  

                  Yes.  By starting the comment using /*, then a single comment can extend multiple lines as long as it is terminated with */, at which point the comment ends.

                 

 

5.       Is your language case sensitive?

                  Yes, Turing is a case sensitive language.

                  Information was obtained from http://www.tvdsb.on.ca/Montcalm/depts/comp/TEE2o1/variables%20Turing.htm

 

6.       Does your language allow and/or require type declarations?

      All variables must be declared as a data type by using the syntax:     var  <var_name> : <type>

     An identifier can be associated with a data type using the reserved word ‘type’.  The identifier can then be used as that type. for example:

 

         type number : int

         num1 : number

 

     This says num1 is type number which is type int, so num1 is type int and can take on any value a type int can. 

 

 

7.        What are the scalar data types, if any, in your language?

                   The scalar types in Turing are int, real, Boolean, char, string, enumerated, and subrange.

               All information was found at http://www.doc.ic.ac.uk/lab/firstyear/turing_lecture_notes/turing_notes.html

  

8.       What are the structured data types, if any, in your language?

The structured data types of Turing are array, record, set, and union.

      All information was found at http://www.doc.ic.ac.uk/lab/firstyear/turing_lecture_notes/turing_notes.html

 

 

9.       Does your language have any other data types (i.e. pointers???)

      Turing also has abstract data types.   

 

 

9.       How are strings handled in your language?  (look at our text for a description of the possible choices before answering this question).

In Turing strings are a primitive type and are fixed length.