Why Johnny and Jenny Can’t Program in C (But We Could) Dr. Eric Freudenthal Brian A. Carter October 2, 2008.

Slides:



Advertisements
Similar presentations
CSE 332: C++ overview CSE 332 Overview and Structure CSE 332 emphasizes studio-based active learning –Introductory lecture material followed by hands-on.
Advertisements

Introduction to Programming in C++ John Galletly.
Programming Languages and Paradigms
8. Code Generation. Generate executable code for a target machine that is a faithful representation of the semantics of the source code Depends not only.
The Assembly Language Level
Compiler Construction by Muhammad Bilal Zafar (AP)
UNIT-III By Mr. M. V. Nikum (B.E.I.T). Programming Language Lexical and Syntactic features of a programming Language are specified by its grammar Language:-
Yu-Chen Kuo1 Chapter 1 Introduction to Compiling.
1 ) Definition 2) Note on structured and modular programming, and information hiding 3) Example imperative languages 4) Features of imperative languages.
Topic 6 -Code Generation Dr. William A. Maniatty Assistant Prof. Dept. of Computer Science University At Albany CSI 511 Programming Languages and Systems.
Introduction and Syntax. Course objectives Discuss features of programming languages. Discuss how the features are implemented in a simple computer architecture.
1.3 Executing Programs. How is Computer Code Transformed into an Executable? Interpreters Compilers Hybrid systems.
Principles of Programming Chapter 1: Introduction  In this chapter you will learn about:  Overview of Computer Component  Overview of Programming 
Chapter 1: Introduction to Visual Basic.NET: Background and Perspective Visual Basic.NET Programming: From Problem Analysis to Program Design.
Comparison of OO Programming Languages © Jason Voegele, 2003.
Programming Languages CPS120: Introduction to Computer Science Lecture 5.
CS 350 Operating Systems & Programming Languages Ethan Race Oren Rasekh Christopher Roberts Christopher Rogers Anthony Simon Benjamin Ramos.
Invitation to Computer Science 5th Edition
1 Chapter 5: Names, Bindings and Scopes Lionel Williams Jr. and Victoria Yan CSci 210, Advanced Software Paradigms September 26, 2010.
Imperative Programming
11 Getting Started with C# Chapter Objectives You will be able to: 1. Say in general terms how C# differs from C. 2. Create, compile, and run a.
High level & Low level language High level programming languages are more structured, are closer to spoken language and are more intuitive than low level.
Enabling the ARM Learning in INDIA ARM DEVELOPMENT TOOL SETUP.
CS 403: Programming Languages Lecture 2 Fall 2003 Department of Computer Science University of Alabama Joel Jones.
Chapter 1 Introduction Dr. Frank Lee. 1.1 Why Study Compiler? To write more efficient code in a high-level language To provide solid foundation in parsing.
CSC3315 (Spring 2009)1 CSC 3315 Programming Languages Hamid Harroud School of Science and Engineering, Akhawayn University
LANGUAGE TRANSLATORS: WEEK 24 TRANSLATION TO ‘INTERMEDIATE’ CODE (overview) Labs this week: Tutorial Exercises on Code Generation.
Introduction and Overview Summer 2014 COMP 2130 Introduction to Computer Systems Computing Science Thompson Rivers University.
1 COMP 3438 – Part II-Lecture 1: Overview of Compiler Design Dr. Zili Shao Department of Computing The Hong Kong Polytechnic Univ.
Copyright © 2007 Addison-Wesley. All rights reserved.1-1 Reasons for Studying Concepts of Programming Languages Increased ability to express ideas Improved.
Guided Notes Ch. 9 ADT and Modules Ch. 10 Object-Oriented Programming PHP support for OOP and Assignment 4 Term project proposal C++ and Java Designer.
Basic Semantics Associating meaning with language entities.
CS112: Structure of Programming Languages A smorgasbord of topics in programming languages including programming paradigms and syntax, semantics, implementation.
Unit-1 Introduction Prepared by: Prof. Harish I Rathod
1.  10% Assignments/ class participation  10% Pop Quizzes  05% Attendance  25% Mid Term  50% Final Term 2.
COP4020 Programming Languages Names, Scopes, and Bindings Prof. Xin Yuan.
Chapter 1 Introduction. Chapter 1 - Introduction 2 The Goal of Chapter 1 Introduce different forms of language translators Give a high level overview.
CS 460/660 Compiler Construction. Class 01 2 Why Study Compilers? Compilers are important – –Responsible for many aspects of system performance Compilers.
Topic #1: Introduction EE 456 – Compiling Techniques Prof. Carl Sable Fall 2003.
Overview of Previous Lesson(s) Over View  A program must be translated into a form in which it can be executed by a computer.  The software systems.
1 Compiler Design (40-414)  Main Text Book: Compilers: Principles, Techniques & Tools, 2 nd ed., Aho, Lam, Sethi, and Ullman, 2007  Evaluation:  Midterm.
1 CS Programming Languages Class 09 September 21, 2000.
Compiler Design Introduction 1. 2 Course Outline Introduction to Compiling Lexical Analysis Syntax Analysis –Context Free Grammars –Top-Down Parsing –Bottom-Up.
Compiler Construction (CS-636)
Principles of Programming Chapter 1: Introduction  In this chapter you will learn about:  Overview of Computer Component  Overview of Programming 
1 Overview of Programming Principles of Computers.
1 Asstt. Prof Navjot Kaur Computer Dept PRESENTED BY.
CS 404Ahmed Ezzat 1 CS 404 Introduction to Compiler Design Lecture 10 Ahmed Ezzat.
PROGRAMMING FUNDAMENTALS INTRODUCTION TO PROGRAMMING. Computer Programming Concepts. Flowchart. Structured Programming Design. Implementation Documentation.
Review A program is… a set of instructions that tell a computer what to do. Programs can also be called… software. Hardware refers to… the physical components.
Why Johnny and Jenny Can’t Program in C (But We Could) Dr. Eric Freudenthal Brian A. Carter, Frederick Kautz, Alexandria Ogrey October, 2008.
A Single Intermediate Language That Supports Multiple Implemtntation of Exceptions Delvin Defoe Washington University in Saint Louis Department of Computer.
CS 404 Introduction to Compiler Design
Advanced Computer Systems
Compiler Design (40-414) Main Text Book:
Chapter 1 Introduction.
PROGRAMMING LANGUAGES
Type Checking, and Scopes
Compiler Construction (CS-636)
LESSON 1 Introduction to Programming Language
Microprocessor and Assembly Language
Compilers.
Chapter 1 Introduction.
课程名 编译原理 Compiling Techniques
Chapter 1: Introduction to Compiling (Cont.)
CMPE 152: Compiler Design December 5 Class Meeting
CS 3304 Comparative Languages
CSE 332 Overview and Structure
Ada – 1983 History’s largest design effort
Overview of Programming Paradigms
Presentation transcript:

Why Johnny and Jenny Can’t Program in C (But We Could) Dr. Eric Freudenthal Brian A. Carter October 2, 2008

Overview  What happened to CS students’ ability to program in C?  Our approach to addressing the problem  Teaching tricks we’ve picked up along the way  The $20 all-in-one embedded target and the free tools

Why We Could Program in C  Principal CS teaching language  Pascal (or some other procedural language)  Featured explicit memory management (i.e., pointers)  Forced explicit management of compiler and linker  Connections to machine organization were made clear  Memory semantics were similar  Those of us who knew FORTRAN had it even easier (goto statements)  Understanding C requires understanding of:  Separate compilation (global symbols, types having to match, etc.)  Memory management

Java as a Principal Teaching Language  This is not a rant against Java—instead, we’re proposing a response  Java’s memory model is very different from machine organization  Global variables are “hidden” within classes  Automatic garbage collection  Objects have methods  Tools hide “systems” issues  IDEs (students don’t learn/understand separate compilation)  Students don’t understand the roles of linker, symbol scope, etc.  Students are “exposed” to C in a language survey course  But, C’s semantics are best understood in the context of architecture

Why is this a Problem?  Upper-division “systems” courses  Students don’t know how to program in C  Students are unfamiliar with major systems components (linker, libraries, etc.)  Employers are unhappy  CS students don’t understand runtime issues  EE students know C, but they can’t program in the large

Our Approach  Leave introductory sequence unchanged  CS I, II, and III remain Java-based  Teach C and machine organization together (for a full semester)  Introduce students to the key concepts in C  Then use assembly/machine language to show how it’s implemented  Students seem to “get it”  Understand the relationship of OO memory & method abstractions to runtime  Students are able to learn (and even derive) compilation techniques  We’ll show you a few pedagogical tricks that seem to work later  The first group of students are now attending a senior-level OS course  Much stronger skills are observed

Lab Course  Students first learn UNIX tools  Students write C programs that expose:  Variable storage  Pointers  Shifts & masks  Students write leaf routines (called by C) in assembly language  Students call C routines from assembly language  Students learn how interrupts work

Teaching Trick 1: Reduction to goto C  goto is legal in C  First: perform a manual transformation  Students first translate for, while, etc. to goto C  Conversion of goto C to assembly language is trivial  After, in an assignment, students produce standard transformation templates

Teaching Trick 2: Introduction of Operator (Parse) Trees  First: challenge students to translate arithmetic expressions to assembly language  Have them “own the challenge”  Next introduce operator trees

Teaching Trick 3: Two-pass Assembly  Motivate the problem with an exercise  Solve the problem by reserving space for operands in the first pass

Embedded Target System  MSP430 low-power embedded controller  Twenty-seven instructions  $20 for full development system  Works with completely free open-source GNU development environment