CLIP Command Line InterPreter for a subset of C++.

Slides:



Advertisements
Similar presentations
Chapter 6 Writing a Program
Advertisements

CS 11 C track: lecture 7 Last week: structs, typedef, linked lists This week: hash tables more on the C preprocessor extern const.
C++ Language Fundamentals. 2 Contents 1. Introduction to C++ 2. Basic syntax rules 3. Declaring and using variables.
COSC 120 Computer Programming
Working with JavaScript. 2 Objectives Introducing JavaScript Inserting JavaScript into a Web Page File Writing Output to the Web Page Working with Variables.
Names and Scopes CS 351. Program Binding We should be familiar with this notion. A variable is bound to a method or current block e.g in C++: namespace.
XP 1 Working with JavaScript Creating a Programmable Web Page for North Pole Novelties Tutorial 10.
1 Type Type system for a programming language = –set of types AND – rules that specify how a typed program is allowed to behave Why? –to generate better.
1. 2 FUNCTION INLINE FUNCTION DIFFERENCE BETWEEN FUNCTION AND INLINE FUNCTION CONCLUSION 3.
Adapted from Dr. Craig Chase, The University of Texas at Austin.
Overview scope - determines when an identifier can be referenced in a program storage class - determines the period of time during which that identifier.
Debugging Logic Errors CPS120 Introduction to Computer Science Lecture 6.
CSE 332: C++ program structure and development environment C++ Program Structure (and tools) Today we’ll talk generally about C++ development (plus a few.
PRINCIPLES OF PROGRAMMING Revision. A Computer  A useful tool for solving a great variety of problems.  To make a computer do anything (i.e. solve.
Computer Programming and Basic Software Engineering 4. Basic Software Engineering 1 Writing a Good Program 4. Basic Software Engineering.
Language Evaluation Criteria
1 COMP 2130 Introduction to Computer Systems Computing Science Thompson Rivers University.
Operator Precedence First the contents of all parentheses are evaluated beginning with the innermost set of parenthesis. Second all multiplications, divisions,
PROGRAMMING IN VISUAL BASIC.NET VISUAL BASIC BUILDING BLOCKS Bilal Munir Mughal 1 Chapter-5.
History of C and C++ C++ evolved from C ANSI C C++ “spruces up” C
CSCE 121: Introduction to Program Design and Concepts, Honors Dr. J. Michael Moore Spring 2015 Set 3: Objects, Types, and Values 1 Based on slides.
The Java Programming Language
Programming Language C++ Xulong Peng CSC415 Programming Languages.
1 Names, Scopes and Bindings Aaron Bloomfield CS 415 Fall
XP Tutorial 10New Perspectives on Creating Web Pages with HTML, XHTML, and XML 1 Working with JavaScript Creating a Programmable Web Page for North Pole.
IT253: Computer Organization Lecture 3: Memory and Bit Operations Tonga Institute of Higher Education.
Object Oriented Programming Elhanan Borenstein copyrights © Elhanan Borenstein.
Hans-Peter Plag November 6, 2014 Session 4 (Programming Languages) (Data Types and Variables) Expressions and Operators Flow Control.
Rossella Lau Lecture 1, DCO10105, Semester B, DCO10105 Object-Oriented Programming and Design  Lecture 1: Introduction What this course is about:
3. The Nuts and Bolts of C++ Computer Programming 3. The Nuts and Bolts of C++ 1 Learning the C++ language 3. The Nuts and Bolts of C++
CIS-165 C++ Programming I CIS-165 C++ Programming I Bergen Community College Prof. Faisal Aljamal.
_______________________________________________________________________________________________________________ PHP Bible, 2 nd Edition1  Wiley and the.
CS 213 Fall 1998 Namespaces Inline functions Preprocessing Compiling Name mangling Linking.
CPSC 230 Computers and Programming I Spring 2003 Dr. Lynn Lambert.
Current Assignments Homework 2 is available and is due in three days (June 19th). Project 1 due in 6 days (June 23 rd ) Write a binomial root solver using.
C++ Memory Overview 4 major memory segments Key differences from Java
CSE 232: C++ debugging in Visual Studio and emacs C++ Debugging (in Visual Studio and emacs) We’ve looked at programs from a text-based mode –Shell commands.
Chapter 0 Getting Started. Objectives Understand the basic structure of a C++ program including: – Comments – Preprocessor instructions – Main function.
Looping and Counting Lecture 3 Hartmut Kaiser
XP Tutorial 10New Perspectives on HTML and XHTML, Comprehensive 1 Working with JavaScript Creating a Programmable Web Page for North Pole Novelties Tutorial.
CSE 332: C++ debugging Why Debug a Program? When your program crashes –Finding out where it crashed –Examining program memory at that point When a bug.
ITC Research Computing Support Using Matlab Effectively By: Ed Hall Research Computing Support Center Phone: Φ Fax:
Evaluating Python as an Introductory Programming Language A. Thomas and H.L. Liang UNISA.
1 Original Source : and Problem and Problem Solving.ppt.
An Undergraduate Course on Software Bug Detection Tools and Techniques Eric Larson Seattle University March 3, 2006.
C++ / G4MICE Course Session 2 Basic C++ types. Control and Looping Functions in C Function/method signatures and scope.
1 Debugging and Syntax Errors in C++. 2 Debugging – a process of finding and fixing bugs (errors or mistakes) in a computer program.
School of Computer Science & Information Technology G6DICP - Lecture 6 Errors, bugs and debugging.
CHAPTER 1: INTRODUCTION C++ Programming. CS 241 Course URL: Text Book: C++ How to Program, DETITEL & DEITEL, eighth Edition.
CSC 143A 1 CSC 143 Introduction to C++ [Appendix A]
How to execute Program structure Variables name, keywords, binding, scope, lifetime Data types – type system – primitives, strings, arrays, hashes – pointers/references.
CSE 332: C++ pointers, arrays, and references Overview of Pointers and References Often need to refer to another object –Without making a copy of the object.
Brief Version of Starting Out with C++ Chapter 1 Introduction to Computers and Programming.
Fundamental Programming Fundamental Programming Introduction to Functions.
CPS120 Introduction to Computer Science Exam Review Lecture 18.
CSE 332: C++ expressions Expressions: Operators and Operands Operators obey arity, associativity, and precedence int result = 2 * 3 + 5; // assigns 11.
CS Class 04 Topics  Selection statement – IF  Expressions  More practice writing simple C++ programs Announcements  Read pages for next.
XP Tutorial 10New Perspectives on HTML, XHTML, and DHTML, Comprehensive 1 Working with JavaScript Creating a Programmable Web Page for North Pole Novelties.
CSCE Introduction to Program Design and Concepts J. Michael Moore Spring 2015 Set 6: Miscellaneous 1 Based on slides created by Bjarne Stroustrup.
Introduction to Programming By: Prof. Muhammad Abu Baker Siddique 2 nd Lecture 1.
Chapter 1.2 Introduction to C++ Programming
Chapter 1.2 Introduction to C++ Programming
Names and Attributes Names are a key programming language feature
Chapter 6 CS 3370 – C++ Functions.
Functions Review.
Testing and Debugging.
Review for Final Exam.
Review for Final Exam.
SPL – PS1 Introduction to C++.
4.1 Introduction Arrays A few types Structures of related data items
Presentation transcript:

CLIP Command Line InterPreter for a subset of C++

This presentation Introduction and why CLIP was made Other C++ interpreters Main ideas in CLIP C-- Other features CLIP vs. compiler Evaluation Questions

Introduction In teaching programming the intention is not to teach only one programming language but problem solving in general However, a programming language is needed for student motivation Teacher is often not free to choose the language based on the pedagogical facts Thus, teacher should try to make learning the chosen language as easy as possible  At TUT this means C++

Why CLIP? Learning programming is hard When using compilers, there is much overhead in writing the first complete programs By using an interpreter-based approach, this problem can be avoided

Why CLIP? C++ is not the best language for teaching Compiler error messages are far from intuitive Compilers may be hard to use CLIP is made to smooth these problems

Other C++ interpreters Ch, CINT, UnderC, IfNCP None of these interpreters met our requirements, which were  Available for free  Localizable  Easy to use  Reliable  Easy integration of visualization module

CLIP background CLIP was developed from the interpreter used in VIP, a Visual InterPreter for a subset of C++. VIP was made by Antti Virtanen. Professor Hannu-Matti Järvinen is making a book where he presents a interpreter-based programming education and he needed an interpreter to support the book

Main ideas in CLIP Clear error messages Localization to students mother language Imperative-first approach

How to use CLIP In interactive mode (normal mode) you can run the commands like inside main-function. You can still define functions and structs etc. like in global scope. You can also start CLIP in a single file mode from command line, and then the interpreter functions in a slightly different mode.

C-- The language that CLIP supports, called C--, is a subset of C++. Main features which are included:  All the basic data and control structures  Pointers and references  Functions  Enums  Structs (no methods)‏  String, vector, cin and cout partly  Math library partly

C-- Main features which are missing:  goto statement  Classes (exceptions: cin, cout, string, vector)‏  File streams  Bit operators  Exceptions  Namespaces (using namespace is allowed)‏  Templates (with the exception of vector)‏  Overloading of function names

Other features CLIP adds these features compared to a standard compiler:  When an error is found from code, show the line where the error came from  Show contents of the symbol table in runtime  Teachers can turn some features on or off depending on the topic which is taught  Commands for saving and loading functions to and from external files.  Faster feedback than from compiler

Constraints At the moment the following features can be disabled from the interpreter:  Switch statement  Pointers  Altering the for loop variable inside the for loop  Subroutines, which have both non-const parameters and a return value  Global variables

Runtime error messages The interpreter detects also the following runtime errors:  Divide by zero  Too deep recursion  Infinite loop  Reference through a null pointer  Index or pointer out of bounds  Use of uninitialized variables

CLIP vs. compiler We compared the differences between CLIP and GNU C++ compiler (g++) by giving them the following piece of code: #include using namespace std; int main() { vector i; cout << i; return EXIT_SUCCESS; }

CLIP vs. compiler g++ gave an error which was about 80 lines long and started with the following lines: b.cc: In function 'int main()': b.cc:6: error: no match for 'operator<<' in 'std::cout << i' /share/gcc/gcc-4.1.1/lib/gcc/i686-pc-linux-gnu/4.1.1/../../../../include/c++/4.1.1/bits/ostream.tcc:67: note: candidates are: std::basic_ostream & std::basic_ostream<_CharT, _Traits>::operator & (*) (std::basic_ostream &)) [with _CharT = char, _Traits = std::char_traits ] /share/gcc/gcc-4.1.1/lib/gcc/i686-pc-linux-gnu/4.1.1/../../../../include/c++/4.1.1/bits/ostream.tcc:78: note: std::basic_ostream & std::basic_ostream<_CharT, _Traits>::operator & (*)(std::basic_ios &)) [with _CharT = char, _Traits = std::char_traits ]

CLIP vs. compiler CLIP gave the following error: Semantic error on line 6: Can't print type ”vector of int” to cout. cout << i; ^

Evaluation CLIP is intended to be used in the elementary programming courses at TUT. Hypothesis is that the students will learn the basic concepts easier than before. Although the first real experiences of the usage of the interpreter are still in the future, we feel that the tool statisfies the requirements we have put on it.

Conclusions CLIP smooths the first steps in C++ by offering to the novice programmer a limited programming language and friendly interpreter environment. Later on a visualization module will be integrated with it and we get a system where students can visualize and debug their code.

Questions