Hans-Peter Plag October 16, 2014 Session 3 Programming Languages Data Types and Variables Expressions and Operators Flow Control.

Slides:



Advertisements
Similar presentations
compilers and interpreters
Advertisements

Overview of programming in C C is a fast, efficient, flexible programming language Paradigm: C is procedural (like Fortran, Pascal), not object oriented.
Programming Paradigms and languages
Introduction to JavaScript
CIS 101: Computer Programming and Problem Solving Lecture 8 Usman Roshan Department of Computer Science NJIT.
Programming Languages Language Design Issues Why study programming languages Language development Software architectures Design goals Attributes of a good.
CS 330 Programming Languages 10 / 16 / 2008 Instructor: Michael Eckmann.
Software Language Levels Machine Language (Binary) Assembly Language –Assembler converts Assembly into machine High Level Languages (C, Perl, Shell)
Reasons to study concepts of PL
Program Flow Charting How to tackle the beginning stage a program design.
Program Flow Charting How to tackle the beginning stage a program design.
Programming Languages Structure
Compilers and Interpreters. Translation to machine language Every high level language needs to be translated to machine code There are different ways.
Chapter 10 Application Development. Chapter Goals Describe the application development process and the role of methodologies, models and tools Compare.
Programming Concepts and Languages Chapter 12 – Computers: Understanding Technology, 3 rd edition 1November
COP4020 Programming Languages
Prof. R. Willingale Department of Physics and Astronomy 2nd Year C+R 2 nd Year C and R Workshop Part of module PA2930 – 2.5 credits Venue: Computer terminal.
Overview of JSP Technology. The need of JSP With servlets, it is easy to – Read form data – Read HTTP request headers – Set HTTP status codes and response.
Scope.
JAVA v.s. C++ Programming Language Comparison By LI LU SAMMY CHU By LI LU SAMMY CHU.
1 CIS336 Website design, implementation and management (also Semester 2 of CIS219, CIS221 and IT226) Lecture 9 JavaServer Pages (JSP) (Based on Møller.
5.3 Machine-Independent Compiler Features
Introduction to FORTRAN
CS 355 – Programming Languages
Chapter 1. Introduction.
PHP TUTORIAL. HISTORY OF PHP  PHP as it's known today is actually the successor to a product named PHP/FI.  Created in 1994 by Rasmus Lerdorf, the very.
Names Variables Type Checking Strong Typing Type Compatibility 1.
1 Programming Languages Tevfik Koşar Lecture - II January 19 th, 2006.
1 JavaScript in Context. Server-Side Programming.
TUTORIAL 10: PROGRAMMING WITH JAVASCRIPT Session 2: What is JavaScript?
Java Programming, Second Edition Chapter One Creating Your First Java Program.
1 3. Computing System Fundamentals 3.1 Language Translators.
Copyright © 2007 Addison-Wesley. All rights reserved.1-1 Reasons for Studying Concepts of Programming Languages Increased ability to express ideas Improved.
Hans-Peter Plag November 6, 2014 Session 4 (Programming Languages) (Data Types and Variables) Expressions and Operators Flow Control.
Just a Little PHP Programming PHP on the Server. Common Programming Language Features Comments Data Types Variable Declarations Expressions Flow of Control.
XP Tutorial 10New Perspectives on HTML and XHTML, Comprehensive 1 Working with JavaScript Creating a Programmable Web Page for North Pole Novelties Tutorial.
C463 / B551 Artificial Intelligence Dana Vrajitoru Python.
JavaScript Syntax, how to use it in a HTML document
Computing System Fundamentals 3.1 Language Translators.
JavaScript Defined JavaScript Basics Definitions JavaScript is an object-oriented programming language designed for the world wide web. JavaScript code.
12/8/2015\course\cpeg323-07Fs\Topic2b-323.ppt1 Topic 2b High-Level languages and System Software (Languages) Introduction to Computer Systems Engineering.
Concepts of programming languages Chapter 5 Names, Bindings, and Scopes Lec. 12 Lecturer: Dr. Emad Nabil 1-1.
How to execute Program structure Variables name, keywords, binding, scope, lifetime Data types – type system – primitives, strings, arrays, hashes – pointers/references.
General Computer Science for Engineers CISC 106 Lecture 12 James Atlas Computer and Information Sciences 08/03/2009.
STL CSSE 250 Susan Reeder. What is the STL? Standard Template Library Standard C++ Library is an extensible framework which contains components for Language.
Higher Computing Science 2016 Prelim Revision. Topics to revise Computational Constructs parameter passing (value and reference, formal and actual) sub-programs/routines,
Chapter 1 Java Programming Review. Introduction Java is platform-independent, meaning that you can write a program once and run it anywhere. Java programs.
CS 330 Programming Languages 10 / 23 / 2007 Instructor: Michael Eckmann.
1 PHP Intro PHP Introduction After this lecture, you should be able to: Know the fundamental concepts of Web Scripting Languages in general, PHP in particular.
Dr. Abdullah Almutairi Spring PHP is a server scripting language, and a powerful tool for making dynamic and interactive Web pages. PHP is a widely-used,
Introduction to Javascript. What is javascript?  The most popular web scripting language in the world  Used to produce rich thin client web applications.
COP4020 Programming Languages Introduction Prof. Robert van Engelen (modified by Prof. Em. Chris Lacher)
Programming Languages Concepts Chapter 1: Programming Languages Concepts Lecture # 4.
Programming 2 Intro to Java Machine code Assembly languages Fortran Basic Pascal Scheme CC++ Java LISP Smalltalk Smalltalk-80.
Chapter 1. Introduction.
Compilers Principles, Techniques, & Tools Taught by Jing Zhang
PHP using MySQL Database for Web Development (part II)
Applications Active Web Documents Active Web Documents.
C LANGUAGE MULITPLE CHOICE QUESTION SET-2
The language focusses on ease of use
Basic 1960s It was designed to emphasize ease of use. Became widespread on microcomputers It is relatively simple. Will make it easier for people with.
Introduction Python is an interpreted, object-oriented and high-level programming language, which is different from a compiled one like C/C++/Java. Its.
COP4020 Programming Languages
PHP.
Accomplishing Executables
CSC 253 Lecture 2.
Tutorial 10: Programming with javascript
Compilers Principles, Techniques, & Tools Taught by Jing Zhang
PHP an introduction.
Types and Related Issues
Presentation transcript:

Hans-Peter Plag October 16, 2014 Session 3 Programming Languages Data Types and Variables Expressions and Operators Flow Control Statements

Interpreter-based languages: are translated into machine code every time a script is executed (at run time). Compiler-based languages: are translated into machine code, then linked into an executable file. Can be executed afterwards (many times). Interpreter-based languages: - syntax check, check of logic at run time - translation into machine code at run time reduces speed Examples: - Linux/OS9 script (shell scripts) - PHP - Pearl - Javascript - Python Compiler-based languages: - syntax check by compiler; check of some logic by compiler - compilation only once - linking checks libraries and compatibility with operating system - executable much faster than scripting language Examples: - Fortran - C - C++ - Java Steps: - write code in an editor - compile -> object code (binary) - link -> executable (binary) - test/validate Steps: - write code in a shell/editor - execute (test/validate) See more examples at: See also:

See more examples at:

Fortran (2000): originally based on ANSI Standards, now ISO standards: compilers are reliable very good for numerical processing also good for handling of text variables/strings clear program control structures subroutines and functions very good tools for testing, validation, error detection not good for interactions with the operating system or a GUI There is a lot of code available in Fortran; mainly Fortran77 but also increasingly Fortran90/95/2000

C/C++: based on ISO standards, latest is C very good for numerical processing not that good for handling of text variables/strings clear program control structures procedures reasonable tools for testing, validation, error detection good for interactions with the operating system, less for a GUI C++ very good for object-based programming

PHP: no standard, de fact standard set by the interpreter “hypertext preprocessor” very good for web applications, generation of html code can be used for stand-alone graphical applications using a command-line interpreter (CLI)

Python: no standard handles variable types dynamically no limit to range of numbers excellent file handling

How different is the syntax of languages? See:

Data Types: Single-value: - Integer Numbers - Floating-point numbers - Logical/Booleans - Text/Strings Compound/collections: - Arrays - Objects Resources/Handles - links to external resources (e.g. files) NULL data type - has no value

Variables: depends on programming language Fortran: Variables need to be declared before being used; some implicit declarations integer, integer*2/*4/*8; same for complex real, real*4/*8/*16 logical, logical*1/*2/*4 character*n arrays: type name(n1:m1,..., nN,mN) Examples: integer nmax,nadd,nlines parameter (nmax=1000,nadd=100,nlines=10) real*8 y(0:nmax),x(0:nmax,5) complex*8 z(nmax) character addresses*80(0:nadd,nlines)

Variables: depends on programming language PHP: Variables are declared by usage (except for static variables) $a = 1; $b = “MARI”; $person[0] = “Jim”; $person[1] = “Smith”; $person[3] = “Norfolk”; $address[‘Name’] = “Jim Smith”; $address[‘City’] =”Norfolk”;

See more examples at:

Scope of Variables: depends on programming language Many languages have local and global variables, depending on the declaration Fortran has local variables and common blocks