Languages and tools. BY SA machine code.

Slides:



Advertisements
Similar presentations
Designing a Program & the Java Programming Language
Advertisements

Software. What Is Software? software –Also called Computer programs –Are a list of instructions –Instructions are called code –CPU performs the instructions.
Slides prepared by Rose Williams, Binghamton University Chapter 1 Getting Started 1.1 Introduction to Java.
CS-341 Dick Steflik Introduction. C++ General purpose programming language A superset of C (except for minor details) provides new flexible ways for defining.
CSE 1301 J Lecture 2 Intro to Java Programming Richard Gesick.
1 Building Java Programs Chapter 1: Introduction to Java Programming These lecture notes are copyright (C) Marty Stepp and Stuart Reges, They may.
IB Computer Science II Paul Bui
“C” Programming Language CIS 218. Description C is a procedural languages designed to provide lowlevel access to computer system resources, provide language.
History of Programming Languages
 Define a problem  Prepare sequence of instructions for the computer to execute  Verify that the program works as expected.
+ Java vs. Javascript Jessi Style. + Java Compiled Can stand on its own Written once, run anywhere Two-stage debugging Java is an Object Oriented Programming.
CS 355 – Programming Languages
Programming Languages
An intro to programming. The purpose of writing a program is to solve a problem or take advantage of an opportunity Consists of multiple steps:  Understanding.
Introduction to Programming Languages. Problem Solving in Programming.
Chapter 1. Introduction.
©Xiaoying Gao, Peter Andreae First Java Program COMP 102 #2 2014T2 Xiaoying Sharon Gao Computer Science Victoria University of Wellington.
First Java Program COMP 102 #2 2015T2 Xiaoying Sharon Gao Computer Science Victoria University of Wellington.
By Neng-Fa Zhou1 Evolution of programming languages –Machine language –Assembly language –Sub-routines and loop (Fortran) –Procedures and recursion (Algol,
Programming History. Who was the first programmer?
OOP (Java): Simple/ OOP (Java) Objectives – –give some simple examples of Java applications and one applet 2. Simple Java Programs Semester.
CS 11 java track: lecture 1 Administrivia need a CS cluster account cgi-bin/sysadmin/account_request.cgi need to know UNIX
Java Programming, Second Edition Chapter One Creating Your First Java Program.
Copyright © 2007 Addison-Wesley. All rights reserved.1-1 Reasons for Studying Concepts of Programming Languages Increased ability to express ideas Improved.
An Introduction to Software Development Java Methods A & AB Object-Oriented Programming and Data Structures Maria Litvin ● Gary Litvin Copyright © 2006.
2-1 Hardware CPU Memory - 2 kinds Network Graphics Input and Output Devices.
Chapt. 10. What’s a Program? A set of instructions -- that lead to the accomplishment of an objective.
Software for Translators Barcelona, January 2002.
Chapter 1 Section 1.1 Introduction to Java Slides prepared by Rose Williams, Binghamton University Kenrick Mock, University of Alaska Anchorage.
Chapter 0 Overview. Why you are here? Where will you go? What is this course for?
National Taiwan University Department of Computer Science and Information Engineering National Taiwan University Department of Computer Science and Information.
4-Nov-15 Air Force Institute of Technology Electrical and Computer Engineering Object-Oriented Programming Design Topic 1: The Java Environment Maj Joel.
Programming Languages
A Look at Java. Categorize Java Which paradigm? Which paradigm? Scripting? Scripting? Declarative or procedural? Declarative or procedural? Which generation?
12/8/2015\course\cpeg323-07Fs\Topic2b-323.ppt1 Topic 2b High-Level languages and System Software (Languages) Introduction to Computer Systems Engineering.
Overview of Java CSCI 392 Day One. Running C code vs Java code C Source Code C Compiler Object File (machine code) Library Files Linker Executable File.
Ch 1. A Python Q&A Session. Why do people use Python? Software Quality Developer productivity Program portability Support Libraries Component integration.
Programming Languages
First appeared Features Popular uses Assembly 1949 For code that must directly interact with the hardware (drivers), embedded processors, processor specific.
CSc 201 Introduction to Java George Wells Room 007, Hamilton Building
© 2012 Pearson Education, Inc. All rights reserved types of Java programs Application – Stand-alone program (run without a web browser) – Relaxed.
introductory lecture on java programming
Software Development Introduction
Assembly 08. Outline Local Labels Jump Lengths External Libraries Macros 1.
Invent Your Own Computer Games with Python
Computer Science A 1. Course plan Introduction to programming Basic concepts of typical programming languages. Tools: compiler, editor, integrated editor,
DR. MIGUEL ÁNGEL OROS HERNÁNDEZ 2. Software de bajo nivel.
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.
Program Execution and ELF Files Extended System Programming Laboratory (ESPL) CS BGU Fall 2013/2014 Abed Asi.
Software Engineering Algorithms, Compilers, & Lifecycle.
First appeared Features Popular uses Basic general-purpose, high-level programming languages small business owners, professionals, hobbyists, and consultants.
Introduction CMSC 202 Fall Instructors Mr. Ryan Bergeron – Lecture Section 01 Tues/Thu 1:00 – 2:15 am, Sondheim 111 – Lecture Section 04 Tues/Thu.
CS-140 Dick Steflik Lecture 3. Java C++ Interpreted optimized for the internet Runs on virtual ized machine Derived from C++ Good object model Widely.
Basic Concepts: computer, program, programming …
The language focusses on ease of use
Lecture 1b- Introduction
Overview of Compilers and Language Translation
Introduction to programming languages, Algorithms & flowcharts
Introduction to programming languages, Algorithms & flowcharts
Microprocessor and Assembly Language
slides created by Marty Stepp
Introduction to programming languages, Algorithms & flowcharts
Computer Science 210 Computer Organization
Introduction to Computers and Python
Развој софтвера 2.
and Program Development
IB Computer Science II Paul Bui
Presentation transcript:

languages and tools

BY SA

machine code

assembly

section.text global main main: mov eax, 4 ;system call number (sys_write) mov ebx, 1 ;first argument: file handle (stdout) mov ecx, msg ;second argument: pointer to message to write mov edx, len ;third argument: message length int 0x80 ;call kernel mov eax, 1 ;system call number (sys_exit) mov ebx, 0 ;first syscall argument: exit code int 0x80 ;call kernel section.data msg db "Hello, world!", 0xa len equ $ - msg

NASM (Netwide Assembler) GAS (Gnu Assembler) MASM (Microsoft Macro Assembler)

hello.asm (source) hello.o (object file) hello (executable) assemblerlinker

foo.asmfoo.o baz assembler bar.asm bar.o assembler linker

dynamic linking.so (Linux).dll (Windows) (linking at runtime)

low-level precise control efficiency high-level expressiveness portability

compiler

foo.cfoo.o baz compiler bar.cbar.o compiler linker

foo.o baz bar.c bar.o compiler linker

interpreter

hello (source) interpreter

foo interpreter bar

– 9 8 * (-3 + 5)

– 9 8 * (-3 + 5) 93

– 9 8 * (-3 + 5) -7

– 9 8 * (-3 + 5) 16

as foo foo 4

hello.java (source) hello.class (bytecode) compilervirtual machine

hello.java (source) hello.class (bytecode) compiler VM with JIT (Just-in-time) (machine code)

function factorial n as val 1 while (gt n 1) # error when n is not a number as val (mul n val) as n (sub n 1) return val (factorial true) # improper type Type error:

function num:factorial num:n as num:val 1 while (gt n 1) as val (mul n val) as n (sub n 1) return val (factorial true) # improper type Static typing:

as list:foo (list “hello” 14 8) as num:bar (get foo 1) # unknown type

polymorphism (print “hello”) (print 100) (print false) (accepts varied number and/or types of inputs)

function foo a b if (isNum a) … else … (foo 3 true) (foo “hello” true)

function foo a b if (isNull b) … else … (foo 3 true) (foo “hello”)

function num:foo num:a bool:b … function bool:foo str:a bool:b … function str:foo str:a …

function num:foo num:a bool:b … function bool:foo str:a bool:b … function str:foo str:a # illegal … function num:foo str:a # illegal …

function num:foo num:a bool:b … function bool:foo str:a bool:b … function str:foo str:a … (foo “hello”) (foo 3 true) (foo “hello” false)

function num:foo num:a bool:b … function bool:foo str:a bool:b … function str:foo str:a … as str:x (foo “hello”)

function foo a if (isNum a) … else … as bar 4 if x as bar false (foo bar)

function num:foo bool:a … function num:foo num:a … as num:bar 4 if x as bar false # illegal (foo bar)

function num:foo bool:a … function num:foo num:a … (foo (ack))

Strong typing: Operations only treat a piece of data appropriately to its type. Weak typing: Possible to modify any bytes of data in any way.

paradigms imperative (do modify state) functional (don’t modify state) procedural (action-centered design) object-oriented (data-centered design)

syntax semantics libraries idioms tools

compiler linker interpreter text editor debugger profiler version control IDE (Integrated Developer Environment)

C 1970’s static, compiled to machine code “portable assembly” #include int main() { printf(“Hello, world!\n"); return 0; } #include int main() { printf(“Hello, world!\n"); return 0; }

C ’s superset of C (almost) C with OOP #include int main() { std::cout << "Hello, world!\n"; return 0; } #include int main() { std::cout << "Hello, world!\n"; return 0; }

Objective-C 1980’s superset of C C with OOP mostly used by Apple #import int main() { printf(“Hello, world!\n”); return 0; } #import int main() { printf(“Hello, world!\n”); return 0; }

Java 1990’s by Sun Microsystems static OOP C-style syntax compiled to bytecode, run by VM JVM (Java Virtual Machine) public class HelloWorld { public static void main(String[] args) { System.out.println("Hello, world!"); } public class HelloWorld { public static void main(String[] args) { System.out.println("Hello, world!"); }

C# 2001 by Microsoft static OOP C-style syntax compiles to bytecode, run by VM CLR (Common Language Runtime) using System; class ExampleClass { static void Main() { Console.WriteLine("Hello, world!"); } using System; class ExampleClass { static void Main() { Console.WriteLine("Hello, world!"); }

Visual Basic 1990’s by Microsoft now basically C# with different syntax Module Module1 Sub Main() Console.WriteLine("Hello, world!") End Sub End Module Module Module1 Sub Main() Console.WriteLine("Hello, world!") End Sub End Module

Perl 1990’s dynamic OOP (weak) interpreted print "Hello, world!\n";

Python print("Hello, world!\n”) 1990’s dynamic OOP interpreted indentation-sensitive

Ruby puts “Hello, world!\n” 1990’s dynamic OOP interpreted generate webpages

PHP 1990’s dynamic OOP (weak) interpreted generate webpages

Javascript 1990’s dynamic OOP (prototypes) interpreted C-style syntax embedded in webpages alert(“Hello, world!\n”);

Fortran 1950’s static compiled many revisions science and engineering program hello print *, “Hello World!” end program hello program hello print *, “Hello World!” end program hello

Lisp 1950’s dynamic interpreted prefix notation meta-programming (macros) dialects (Common Lisp, Scheme, Clojure) (print “Hello, world!\n”)

efficiency 1)assembly, C, C++, Objective-C, Fortran 2)Java, C# 3)Perl, Python, Ruby, PHP, Javascript

portability CPU libraries capabilities

functional languages (Haskell, Scala, ML, F#) logic languages (Prolog) shell languages (BASH) scripting languages (Perl, Python) data languages (HTML, XML) query languages (SQL) domain-specific languages graphical languages

(Brian Will) created by