Computer Languages : Winter 2020

Class PL 211 12:00 PM - 1:15 PM MW
Dr. Ernesto Gomez
Labs See university class schedule, TA: Mohammad Al-Hijjawi

Dr. Ernesto Gomez - (909) 537-5429
office: jb-337, hours MW 2:30-4:30

Open door policy: When my door is open, I am interruptible - I will be happy to talk to you even outside office hours. When my door is closed, I am either not there or working on something I don't want to interrupt. Knock if you think whatever you need is something I will agree is more urgent than whatever I am doing.

This page is the syllabus. Schedule, grading is described here or in links from here. Look for changes and updates here

This link is the old CSE320 page- contains useful links

USEFUL REFERENCE: Syntax and Semantics of Programming Languages Slonneger and Kurtz"
Appendix A - Prolog and Appendix B - Scheme are excellent intros to these languages.


BOOK: "Programming Language Pragmatics", Fourth Edition, Michael L. Scott, Morgan Kauffman ISBN 978-0-12-410409-9

SCHEDULE : (under construction)
- Topics from the book - (parts of) chapters 2,3,4,6,7,8,9,10,11,,12
--- 2019 - concentrate on 2,3,4.1-4.3,6.1,6.5,6.6,7.1 (properties of languages in general) 11 (functional), 12 (logic) - in every case, there will be material in class that extends what is in the book

Exercises 1-3 : do by Feb. 14

WEEK 1: Ch 1.2,1.4 - intro, language types. Turing machine and Turing Completeness
WEEK 2: CH 2.1 - syntax specification, derivation, syntax tree
WEEK 3: CH 4.2 - annotated grammar, CH 3 - Names, binding

Week 4: CH 6, CH 11 (functional languages)
Week 5: Scheme (and Haskell)
Week 6: language design -
consistency: syntax and style match everywhere
orthogonality - all combinations with correct syntax work
legibility - is it easy to read and understand what the code does
writeability - ease and speed of writing code

stability - once you learn the language, how hard is it to keep up with changes?
safety - ease of debugging, error detection, avoid unexpected effects
speed and efficiency - is this a language or an impleentation thing?
extensibility? can the language be modified inside the language? (C : no, C++ : yes, others?) examples -
The switch statment in C++ : not orthogonal, bad legibility
Vectors in scheme do not match basic design of lists, input/output breaks the functional paradigm.

WEEK 7: Prolog from Dr. Botting's old cs320 page: old prolog lab 18 old prolog lab 19 examples
Try examples, but do not post on webpage
Prolog course notes from York U.

Hardware considerations and equivalence of different language paradigms-- reductions!

- Given problems P and P' we say that P reduces to P' if every problem in P can be transformed to a specific subset S' of all problems in P'. The idea is, we can convert a problem in P to a problem in S', solve it, and then the solution in S' can be mapped back to the solution in P. (more detailed writeup will be added - watch this space)

cellular automata - a Turing-equivalent hardware model

Conway's Game of Life


You are allowed 1 page of notes (both sides) in the final.


The following describes 5 labs to be done, in our labs and at home, over the entire term. All programming should run in a machine in the CSE lab or on a laptop you can bring, since you may need to show a running program to me or other. All work is individual, but feel free to discuss with each other (share ideas and solutions, do not share code). Do not use a web platform like (e.g. Cloud 9 or equivalent) becasue it is too abstracted from the Sample code to read system time

From geeks for geeks, pick one of: QUICKSORT, DYKSTRA SHORTEST PATH and KMP (pattern search) algorithm.
WINTER 2020- use these algorithms: (do at least 2 different data sets for each algorithm)

1) quicksort on array
For this problem, you will need to generate arrays of 1000 to 10000 3 or 4 digit integers. You should generate the array using the random() function in a C++ program. (try: "man random" at command line for reference on this)

2) partition sum
This algorithm has exponential complexity, so your data should be a short list - the example in the reference uses less than ten numbers, you may want to use several different input lists of less than 20 numbers.

(if you find a different algorithm you prefer, ask me if it is OK)
Implement this algorithm 5 times in:
C: an imperative language;
Python or C++: an OO language;
Haskell or Scheme: a functional language;
Prolog: a logic language;
and a language of your choosing.

(You may replace C, C++ or Scheme by another language of the same type, ask me first)
For each of the above 5 cases, your lab report should include: source code, screen shots (or other demonstration) of multiple tests (at least 5 with different data), timing of multiple runs (at least 5 repetitions with same data).
To allow comparison of different languages, the timing test for all 5 implementations should use the same data.
You should describe your impressions of:

1. Ease/difficulty of of programming
2. Ease/difficulty of debugging
3. Speed of execution
4. any other comments

Write a final report in which you compare the 5 languages you tested, and state your opinion and preferences
br> PROJECT: (not applicable winter 2020 term)
Useful/entertaining sites:

geeks for geeks Languages, algorithms and other stuff
Codepad - try programs in multiple languages
The LEGO Turing Machine
Some strange programming languages

Labs and assignments 30% - Labs and other assignments are individual. Assignments will be turned in by email

Team Project 30% -
1 Midterm - (practice test - not graded)
Final 40% - (see CSUSB finals schedule)

Codepad - try programs in multiple languages
Haskell Wiki
guile - Gnu Scheme
Scheme reports (most systems comply with the Scheme 5 report)
Scheme 5
Scheme 48 - "written in 48 hours, can learn in 48 hours"
(not exactly what we have, but better documentation than Guile or MIT - and you can downoad it for Windows)
Guile - GNU Scheme Manual
MIT - Gnu Scheme
Dick Botting notes on scheme
Lisp - more or less like Scheme
Prolog - from Botting CSE320 notes

Learning Outcomes

The following are learning outcomes for the Computer Science program, accredited by ABET This course supports these outcomes.

a) An ability to apply knowledge of computing and mathematics appropriate to the discipline

b) An ability to analyze a problem, and identify and define the computing requirements appropriate to its solution

c) An ability to design, implement, and evaluate a computer-based system, process, component, or program to meet desired needs

d) An ability to function effectively on teams to accomplish a common goal

e) An understanding of professional, ethical, legal, security and social issues and responsibilities

f) An ability to communicate effectively with a range of audiences

g) An ability to analyze the local and global impact of computing on individuals, organizations, and society

h) Recognition of the need to and an ability to engage in continuing professional development

i) An ability to use current techniques, skills, and tools necessary for computing practice

j) An ability to apply mathematical foundations, algorithmic principles, and computer science theory in the modeling and design of computer-based systems in a way that demonstrates comprehension of the tradeoffs involved in design choices

k) An ability to apply design and development principles in the construction of software systems of varying complexity

The following are CSUSB policies fizzbuzz.txt uml.i Plagiarism and cheating are violations of the Student Conduct Code (see Appendix) and may be dealt with by both the instructor and the Judicial Affairs Officer. Definition and procedures for addressing cheating and plagiarism are found below. Questions about academic dishonesty and the policy should be addressed to the Office of the Vice President, Student Services. Plagiarism is the act of presenting the ideas and writings of another as one’s own. Cheating is the act of obtaining or attempting to obtain credit for academic work through the use of any dishonest, deceptive, or fraudulent means. Cheating includes but is not limited to:

1. Copying, in part or in whole, from another’s test, software, or other evaluation instrument.

2. Submitting work previously graded in another course unless this has been approved by the course instructor or by departmental policy.

3. Submitting work simultaneously presented in two courses, unless this has been approved by both course instructors or by the department policies of both departments.

4. Using or consulting during an examination sources or materials not authorized by the instructor.

5. Altering or interfering with grading or grading instructions.

6. Sitting for an examination by a surrogate, or as a surrogate.

7. Any other act committed by a student in the course of his or her academic work, which defrauds or misrepresents, including aiding or abetting in any of the actions defined above.

Plagiarism is academically dishonest and makes the offending student liable to penalties up to and including expulsion. Students must make appropriate acknowledgements of the original source where material written or compiled by another is used. Procedure. Allegations of academic dishonesty may be handled directly by the instructor or may be referred by the instructor to the Judicial Affairs Officer. If handled by the instructor, the instructor has the following responsibilities:

1. To preserve the evidence in support of the allegation;

2. To notify the student of the allegation and of the evidence on which it is based;

3. To provide the student a reasonable opportunity to challenge or rebut the allegation;

4. To notify the student of the action being taken.

The instructor may employ any of the following sanctions:

1. Verbal or written reprimand;

2. Assignment or appropriate task or examination;

3. Change of grade, including assigning a punitive grade to work involving dishonesty, or for the course, project, thesis, or any other summary evaluation of the student’s academic work.

If the student does not wish to accept the sanction proposed by the instructor, the student may request and require that the allegation be referred to the Judicial Affairs Officer. In that event, the procedures specified under Executive Order 970 (Student Disciplinary Procedures of the California State University) shall be observed. The instructor shall not impose any sanction other than the sanction(s) imposed through the disciplinary procedure.

{Students with Disabilities:}

If you are in need of an accommodation for a disability in order to participate in this class, please let me know and also contact Services to Students with Disabilities at UH-183, (909)537-5238.

{Students with Disabilities:}

If you are in need of an accommodation for a disability in order to participate in this class, please let me know and also contact Services to Students with Disabilities at UH-183, (909)537-5238.