CS 230 01/Zelle Fall 2021

Programming Languages

Dates and Times

All due date/times are given in Central Time (US). Please make sure you translate appropriately for your locale.

Submitting work

Items listed with non-classtime due dates are to be turned in on Socrates (see link at the top of this page). For most assignments you will be attaching one or more files. It is up to you to double check that you have properly submitted your work. You can override a previous submission by simply submitting the file(s) again.

Acceptable File Types

Howework answers can be submitted as electronic documents; PDF is prefered, but MS Office formats (.docx), and plain text (.txt) are fine. You can also write answers on paper and submit a picture file. Any standard image format is fine (PDF, jpg, png, gif, etc). Using an app like "camScanner" and collecting multiple pages into a single PDF document is strongly encouraged.

For projects, you should always submit the code (module) file. This will be a plain text file containing the Python program code. It should have a ".py" at the end of the name, although your computer may not show you the extension. DO NOT submit output from a Python "Shell" Window. If the file you are submitting contains shell prompts (indicated with ">>>"), then it is the wrong file.

Assignments

(due 9/8, midnight) Case Study: Languages of Interest

The purpose of this assignment is to get you thinking about possible choices of programming language for a case study. The first step is doing some Internet research on the universe of programming languages. You might start with this Wikipedia page, History of Programming Languages, to get oriented. Then you might poke around for some lists of "hot," "popular," or "most used" programming languages. One example is the "Tiobe index".

Based on your research, do a short write-up that contains two annotated lists. The first is a list of the 5 languages that you think would be most important for your career. For this list, you should obviously consider what you see yourself doing as a career and what languages are most likely to be of importance for that. You should try to order your list by importance (the most relevant languages first) and explain how you chose those 5 languages in terms of your career plans/interests/hopes/dreams.

The second list should be a list of 5 languages that are not on your first list that you think would be interesting to learn. For each language in this list, give at least a one sentence reason why you chose it.

Include a listing of your sources of information at the bottom of your write-up. Any consistent citation style is fine. Just make sure that you provide sufficient information so that I can check on your sources for myself.

(due 9/10, class time) Homework: Assembly Language

See the problem set here.

You should have your solutions on paper ready to turn in at the beginning of class.

(due 9/17, midnight) Project: Stack Assembly Interpreter (assem2.py)

Write an interpreter for the assembly language of Problem 2 from the Assembly Language homework set.

As a starting point, you can use assem1.py from handouts/assemblers. I have tweaked the code slightly so that read_program should work for the stack-based assembly code. (If you've already downloaded the file, you will probably want to get the updated version.) I have also provided a small sample file (ex1.sa).

Obviously, you will need to modify MachineState to make it stack-based. You do not need a separate stack class; a list is fine. Use append and pop to push and pop, respectively. You will also have to rewrite the execute_instruction function.

(due 9/17, classtime) Case Study: Language Selection

Notes on language selection, including a list of eligible languages can be found here. You can "claim" your language (first-come, first-served, ties broken by lottery) in class on 9/13 or via email. Your language is not officially selected until I approve it.

Your next assignment is to research the history and motivation for the creation of your language. Where did it come from and why was it created? How does it fit in the "timeline" of computer language development?

(due 9/20, classtime) Grammar Homework

Write out BNF grammars for the remainder of the languages (#3-10) on the Simple Language/Grammar Examples handout from class on 9/17.

Reminder: Second Quiz is Friday (9/24)

It will cover material from classes since the last quiz. That's the last part of Language Systems, and the material on grammars.

(due 9/22 classtime) Grammar Homework 2

Redo the Simple Language/Grammar Examples using EBNF to simplify your grammars. Try to use as little recursion as possible.

(due 9/30, midnight) Case Study: Part 1

Your assignment is to make a video on the history/motivation for your language. You should answer basic questions like: Who developed the language? When did it happen? Why was the language developed? What languages had an influence on yours. What languages has your language influenced. How has the language evolved? What is the impact of your language today? Basically, try to situate your language in the ongoing history of programming language development.

Your video does not have to be fancy, but you should try to include some visual aids. You could use Zoom, a simple screencasting app, or even just your phone to create the video. It should be 3-5 minutes long. Meeting the time guideline is a requirement. Do not go over.

To "hand-in" your video, you will upload it to Youtube (you will need to make an account if you don't already have one) as an UNLISTED video. Make sure when you go through the upload to indicate that it is NOT INTENDED FOR CHILDREN. Once your video is uploaded, submit a link here.

(due 9/27, class time) Expression Grammar

Write out a BNF grammar for the expressions of the language that we formulated in class today (9/24). I will not collect this, but it is a good exercise, and we will use it as a starting point for class discussion Monday.

We also need a name for our language. Bring ideas to class on Monday.

Class Videos

For those of you who could not make it to class today, I have posted a link to the Youtube playlist containing the case-study videos. You can find it under "Lectures" on Socrates.

On next Friday's (10/5) quiz, there will be a matching style question where you are asked to name the language being described. So you will want to be sure to review these videos and take notes if you were not in class today.

(due 10/4, classtime) Jelle Grammar

Write a complete phrase structure grammar for Jelle (our class language). As discussed in class on Wednesday, you may assume that lexical analysis has tokenized a program into the following categories: number, id, string, addop, mulop, ^, '(', ), :=, nl, display, input, ';', and ','. These will be the nonterminals for your grammar.

You may use BNF/EBNF as you see fit to express your grammar. Your grammar should recognize any legal program. Use the programs that we developed in class and posted on the Socrates Discussion module as a guide to what programs look like. Have your grammar on paper ready for hand-in at the start of class.

Quiz Reminder

Our next quiz is coming up Friday (10/8). About 1/2 of the points will be a matching question over our history/motivation videos, so you will definitely want to go over your video notes. Questions about grammars (lexical vs. phrase structure) and Jelle will comprise the remainder of the quiz.

I have posted the "jelly_grammar.py" file and some sample Jelle programs under the "handouts" button at the top of our class webpage. We'll finish up the CharScanner Friday and talk about the Lexer.

(due 10/15, midnight) Checker Examples

We need test data for developing and testing our syntax checkers. Your assignment is to retrieve one of the Jelle programs from our discussion page on Socrates and do the following:

  1. Use your Socrates user name to rename the file as: <username>_correct.jle. For example, I would name my file: jz8360_correct.jleReview the code in the file and make sure that it is correct!

  2. Introduce a syntax error into the file and save it again as: <username>_err1.jle. Put a comment in the file near the error that you introduced to explain the error.

  3. Repeat step 2 two more times to create files <username>_err2.jle and <username>_err3.jle Try to introduce novel and "sneaky" errors.

  4. Turn all 4 files in on Socrates.

(due 10/25, midnight) Syntax Checker

Complete the code in checker.py from here. Turn in all files necessary for your checker to run.

(due 11/2, midnight) Case Study Part 2: "A Taste of ..."

Your assignment is to make a video giving the class a "taste" of what your language is like. During this video, you must present (and demonstrate running) some actual programs using your language. Using these examples, you should discuss the broad outline of your language including such isses as: programming paradigm, syntactic style, basic control structures, block structure, language environment, use of data types, and memory model. You are trying to convey what it is like to program in your language.

Your video does not have to be fancy, but you should try to include some visual aids, including showing your language in action. You can use Zoom, a simple screencasting app, or even just your phone to create the video. It should be 8-10 minutes long. Meeting the time guideline is a requirement. Do not go over.

To "hand-in" your video, you will upload it to Youtube (you will need to make an account if you don't already have one) as an UNLISTED video. Make sure when you go through the upload to indicate that it is NOT INTENDED FOR CHILDREN. Once your video is uploaded, submit a link here.

Jelle Examples Posted

I've posted a curated set of example programs to try out your syntax checkers on. You can find them here.

(due 11/8) Jelle Parser

Write a JelleParser class. Starter code is available under handouts/jelle/parser_start/.

Note: The Lexer code that I originally posted had the wrong lexical category for the "/" and "%" tokens. (I should have run the regression tests.) I have posted an updated version. You can either download the new version, or just fix the SINGLE_CHAR_TOKENS table in the Lexer

(due 11/17) Scheme functions

Write defintions for the following functions.

	 (nth n lst) returns the nth item from lst (use 0-based indexing)
	 example: (nth 3 '(a b c d e f)) --> 'd

	 (rac lst) like car, but returns the last item of a list
	 example: (rac '(a b c d e) --> 'e

	 (snoc item lst) Like cons, but adds the item at the end of the list.

	 (fib n) returns the nth Fibonacci number. Note: you should implement an
	 efficient (loop-like) algorithm.

	 (smaller-items x lst) returns a list of all the items in lst that are
	 smaller than x. eample: (smaller 4 '(3 1 4 1 5 9 2 6)) --> '(3 1 1 2)

	 (intersection lst1 lst2) returns a list of all the items in lst1 that also
	 appear in lst2

	 (merge lst1 lst2) returns sorted list the is the merge of it's sorted arguments
	 example: (merge '(12 34 56 56 72 90) '(3 5 34 50)) -->'(3 5 12 34 34 56 56 72 90)

	 (lookup key pairs) --> returns the value associated with key in pairs.
	 example: (lookup 'foo '((bar 3) (baz 4) (foo 7) (flarge 1))) --> 7
       

Put all your definitions in a single file, funcs.rkt and turn it in on Socrates. Many of these can be done in multiple ways, either by leveraging built-in functions or with list recursion. For example, you could write rac using the built-in reverse or by using list recursion to get to the last item. For bonus points, provide both versions.

(due 12/10) RJelle Interpreter

You can find a detailed assignment description (PDF) and start code here: handouts/jelle/interpreter

I'll add hints to this sections as I get questions from students. Check back here if you are stumped.

(due 12/17) Case Study Part 3: Language Superpower

For the final installment of the case study you need to identify something particularly unique or significant to your language that you think contributes significantly to its trendiness or "staying power." What is its "superpower?" This could be some feature of the language, or perhaps its suitability to a certain application area.

Once you have decided on your language's superpower, you should create a video that explains/demonstrates your language's ability. Since we will not be viewing these in class, we have a little more flexibility in length. You video should be between 6 and 12 minutes long.

Post your video as an unlisted video on Youtube, and then copy the link to this form.

Reminders: Quiz and Exam

Just a quick reminder that our final quiz has been pushed back until Weds. 10/8.

Our final exam is on 12/17.

(due 12/8): Scoping Exercise

Using the Python-like code in scope_ex1.py:

Have your answers on paper suitable for hand-in.

(due 12/8): Scoping Exercise (part 2)

Extend your work on the scoping exercise to show the ordered pair of numbers that would be used to locate each variable at the the three points of interest. You can assume that all entries in an activation record require 8 bytes. So, for example, the third "slot" in an activation record would be at offset 16 (since the first has offset 0).

Final Exam: 12/16, Noon

The final exam is comprehensive. In addition to the material covered on the 6 quizzes, it will also include the material on implementing block structure and various parameter passing mechanisms. It will be written to be a 1-hour exam, but you will have the entire 2-hour time slot to work on it. I don't yet know the exact format, but you will definitely have some choices on which questions you choose to answer.

A good starting point for study is simply to review the 6 quizzes. I have posted them on the Handouts tab on Socrates. I will also draw on knowledge from our various projects, you can use our class webpage as a resource for remembering this material. As requested, I have posted a solution to the parser project, also on Socrates under Handouts.

(due 12/17) Reminder Case Study Part 3

This is a repost to remind you about your final case study video. See the description above. You can turn it in here.