A Project Approach to Programming Language Theory Joan Krone Denison University Many Languages • Natural 6,912 Millennia to develop • Programming 2,500 (U. of Kansas) 8,500 (Diarmuid Piggott) all within 50 years • One language per week since Fortran based on the 2,500 2 Where Have All the Languages Gone? • • • • • • • • • • Assembler Fortran Basic Pascal PL1 Modula2 Ada C C++ Lisp/Scheme • • • • • • • • • • ML Clu Prolog Smalltalk Eiffel Python Perl Java PHP HTML 3 Recent Article Ryder, Soffa, Burnett, “The Impact of Software Engineering Research on Modern Programming Languages,” ACM TOSEM, 2005. 4 Paradigms • • • • • Logic Structured Procedural OO Use of Abstraction (java interfaces) 5 6 Why Johnny Can’t Code • David Brin • Language for novices? 7 The Problem • Maybe Basic • Probably java • Lack of student experience 8 Two Levels of Programming Language Courses • Sophomore Level: survey • Senior Level: capstone 9 A Two Pronged Approach • Semester Project • Daily assignments – Same questions – Different languages for different students 10 Project Choices 1. Become a guru. 2. Do a comparative analysis of 2 languages in the same category. • • C++ and Java Perl and HTML 3. Do a comparative analysis of 2 languages in the different categories. • • Java and Scheme Haskell and Python 11 4. Write a translator for a simple language. 5. Design a new language. 12 13 To Be a Guru • • • • • • • Classify History Scoping Type Checking Support for Abstraction Concurrency Type Conversion 14 • Write documentation • Choose at least 3 features unique to your language and explain how those features can be used advantageously by a programmer to perform some task in your language more efficiently than it could be done in another language without those features. • Be prepared to give a talk and a demonstration which illustrate how your language facilitates the implementation of solutions to problems. 15 Daily Requirement • Choose a language • Discover how that language handles a particular topic, such as scoping. • Prepare a demo to illustrate the discovery 16 Class Size • Small class - - individual investigations • Large class - - groups of 2, 3, or 4 17 Programming Languages are Like Cars Assembler: A formula I race car. Very fast but difficult to drive and maintain. FORTRAN II: A Model T Ford. Once it was the king of the road. FORTRAN IV: A Model A Ford. FORTRAN 77: a six-cylinder Ford Fairlane with standard transmission and no seat belts. COBOL: A delivery van. It's bulky and ugly but it does the work. BASIC: A second-hand Rambler with a rebuilt engine and patched upholstery. Your dad bought it for you to learn to drive. You'll ditch it as soon as you can afford a new one. PL/I: A Cadillac convertible with automatic transmission, a two-tone paint job, white-wall tires, chrome exhaust pipes, and fuzzy dice hanging in the windshield. 18 • • • • • • • • • Pascal: A Volkswagon Beetle. It's small but sturdy. Was once popular with intellectual types. LISP: An electric car. It's simple but slow. Seat belts are not available. PROLOG/LUCID: Prototype concept cars. FORTH: A go-cart. LOGO: A kiddie's replica of a Rolls Royce. Comes with a real engine and a working horn. APL: A double-decker bus. It takes rows and columns of passengers to the same place all at the same time but it drives only in reverse and is instrumented in Greek. Ada: An army-green Mercedes-Benz staff car. Power steering, power brakes, and automatic transmission are standard. No other colors or options are available. If it's good enough for generals, it's good enough for you. C++: A black Firebird, the all macho car. Comes with optional seatbelt (lint) and optional fuzz buster (escape to assembler). Java: All-terrain very slow vehicle. 19 Our Future • C++ and Java forever? • Probably Not • Our students may be the designers of the next important language • Hopefully, they will learn from history 20