Overview ธนวัฒน์ แซ่ เอียบ. Why Study PL? เขียนโปรแกรมตามแนวคิดที่ออกแบบไว้ชัดเจนขึ้น –Appreciation for valuable laguage features and encourages programmers.

Slides:



Advertisements
งานนำเสนอที่คล้ายกัน
เอาไว้ใช้ในการอธิบายกระบวนการแปลภาษาให้เข้าใจได้ง่ายขึ้น
Advertisements

Introduction to C Introduction to C.
โครงสร้างโปรแกรมภาษา C
แนะนำการเขียนโปรแกรมภาษา C Introduction to C Programming Language
วิทยาการเชิงการคำนวณ?
ประเภทของโปรแกรมคอมพิวเตอร์
Intermediate Representation (รูปแบบการแทนในระยะกลาง)
สถาปัตยกรรมแบบ stack และ การผลิตโค๊ด
สภาวะแวดล้อมในขณะโปรแกรมทำงาน
Functional Programming
Functional programming part II
Functional programming part II
ภาษาคอมพิวเตอร์ กฎเกณฑ์เกี่ยวกับคำศัพท์ ไวยากรณ์ และ หลักภาษาในการเขียนคำสั่งงานให้คอมพิวเตอร์ทำงานอย่างใดอย่างหนึ่งให้กับเราได้ มีหลากหลายชนิดต่างๆ กัน.
Data Structures and Algorithms
Lecture No. 3 ทบทวนทฤษฎีและแบบฝึกหัด
CS Assembly Language Programming
Utility (โปรแกรมอรรถประโยชน์)
การแก้ปัญหาด้วยคอมพิวเตอร์
ความรู้เบื้องต้นเกี่ยวกับการเขียนโปรแกรม
ความหมาย และวิวัฒนาการ ของ ระบบปฏิบัติก าร.
THE WAY OF THE PROGRAM.
ภาษาคอมพิวเตอร์.
หน่วยที่ 1 ระบบคอมพิวเตอร์
โดย อาจารย์ณัฐพงศ์ พยัฆคิน
เนื้อหา ประเภทของโปรแกรมภาษา ขั้นตอนการพัฒนาโปรแกรม
วิชา การออกแบบและพัฒนาซอฟต์แวร์
Object-Oriented Programming
ภาษาโปรแกรมเชิงหน้าที่
Logic Programming โปรแกรมเชิงตรรกะ.
ความรู้เบื้องต้นเกี่ยวกับ JAVA
ขั้นตอนการแปลงไฟล์.
Surachai Wachirahatthapong
CHAPTER 1 Major Sources of Errors in Numerical Methods
Computer Architecture and Assembly Language
Functional components of a computer
ให้ประหยัดการใช้หน่วยความจำ (space) ด้วยความรวดเร็ว (time)
แนะนำการเขียนโปรแกรมภาษา C Introduction to C Programming Language
โครงสร้างควบคุมการทำงาน
หน่วยประมวลผลกลางและหน่วยความจำ Central Processing Unit and Memory
องค์ประกอบทางด้านซอฟต์แวร์
ความรู้พื้นฐานการเขียนโปรแกรม
List ADTs By Pantharee S..
ประวัติและขั้นตอนการพัฒนาโปรแกรมภาษาซี
2.1 วิธีแก้ปัญหาด้วยคอมพิวเตอร์ (Computer problem solving methods)
ระบบคอมพิวเตอร์และการประมวลผล
วิชา วิศวกรรมซอฟต์แวร์ (Software Engineering)
หลักการเขียนโปรแกรม ( )
หลักสูตรอบรมครู คอมพิวเตอร์ หลักสูตรอบรมครู คอมพิวเตอร์ หลักสูตรที่ ๑ ทักษะการโปรแกรม เบื้องต้น วันที่สาม.
Java Network Programming 1
Input / Output ธนวัฒน์ แซ่เอียบ.
Assembly Languages: PDP8
ความรู้พื้นฐานเกี่ยวกับการโปรแกรมคอมพิวเตอร์
ระบบคอมพิวเตอร์ (computer system)
นาย เกียรติศักดิ์ แสนนวล โรงเรียนจักรคำคณาทรลำพูน
แนะนำการเขียนโปรแกรมภาษา C Introduction to C Programming Language
Introduction ธนวัฒน์ แซ่เอียบ.
Programming & Algorithm
ซอฟต์แวร์ (Softwarre)
Function ธนวัฒน์ แซ่ เอียบ. What is a function ฟังก์ชันในภาษา C เป็นโปรแกรมที่ถูกออกแบบมาเพื่อ ใช้แก้ปัญหางานใดงานหนึ่งโดยเฉพาะ ฟังก์ชันจะเปลี่ยน input.
Programming Languages ธนวัฒน์ แซ่เอียบ โฮมเพจรายวิชา
Syntax and Semantics ธนวัฒน์ แซ่เอียบ.
คุณลักษณะของคำสั่งภาษาเครื่อง ชนิดของตัวถูกดำเนินการ
Introduction to Computer Organization and Architecture Flow of Control ภาษาเครื่อง สายงานของการ ควบคุม.
Subroutine ธนวัฒน์ แซ่ เอียบ. Subrountine – คือส่วนหนึ่งของ code จากโปรแกรมทั้งหมด สำหรับปฏิบัติงานโดยเฉพาะ และเป็นอิสระ จาก code ส่วนอื่นของโปรแกรม ประโยชน์
Names, Scopes and Bindings
หลักการโปรแกรม อ.ธนากร อุยพานิชย์.
โครงสร้างโปรแกรมภาษา C
ความรู้เบื้องต้นเกี่ยวกับการเขียนโปรแกรม
สื่อการสอนรายวิชา ง30204 โปรแกรมภาษาชี ภาษาคอมพิวเตอร์และโปรแกรม
Lecture no. 1: Introduction to Computer and Programming
ใบสำเนางานนำเสนอ:

Overview ธนวัฒน์ แซ่ เอียบ

Why Study PL? เขียนโปรแกรมตามแนวคิดที่ออกแบบไว้ชัดเจนขึ้น –Appreciation for valuable laguage features and encourages programmers to use them เข้าใจลักษณะและโครงสร้างของภาษาจริงๆ – ข้อดีและข้อเสีย ไม่มีภาษาที่สมบูรณ์แบบดังนั้นการ เลือกใช้ให้เหมาะสมกับงานจะช่วยในการพัฒนา –Many features now available in programming langusges were not widely known ทำให้เรียนรู้ภาษาใหม่ได้ง่ายขึ้น – ภาษามีการพัฒนาอย่างต่อเนื่องไม่หยุดนิ่ง การเรียนรู้ เพื่อเข้าใจให้ทันการเปลี่ยนแปลงเป็นสิ่งจำเป็นอย่าง ยิ่ง –Once a through understanding of the fundamental concepts of languages is acquired, it becomes far easier to see how these concepts are incorporated into the design of the language being learned

Why Study PL? ความสามารถในการออกแบบภาษาใหม่ – ช่วยให้โปรแกรมเมอร์ที่มีประสบการณ์สามารถ ออกแบบภาษาขึ้นมาใหม่ ตามความต้องการ และ ช่วยให้ผู้ใช้งานสามารถตรวจสอบและประเมินค่า ผลงานได้

Language Influences hardware architecture – ภาษาในสมัยก่อนออกแบบตามแนวคิดของ von Neumann เรียกว่า imperative languages

Language Influences Fetch-execute cycle Executing an instruction is generally much faster than moving things between memory and CPU. So the speed of this movement limits the speed of the computer. This is the “von Neumann bottleneck”.

Language Influences Program methodology Process oriented – เมื่อปัญหามีความซับซ้อนมากขึ้น ในปี 1970 มี แนวคิดกรรมวิธีพัฒนาซอฟต์แวร์ขึ้นมาเรียกว่า top- down design และ step-wise refinement ภาษาในยุคมีข้อเสียในเรื่อง type checking และ control statement –Process-oriented  data-oriented ( ปลายยุค 70) ต้นยุค 80 data-oriented พัฒนาไปเป็น object- oriented –Data abstraction –Encapsulation –Inheritance and polymorphism

Levels of programming languages Machine language –Operations are very simple things like Move contents of mem location to register 7 Add contents of mem location to register 7 Shift the contents if register 3 left one bit Jump to program line 85 Skip the next instruction if register i is sero –Instructions are encoded as numbers. –No variables: operands are memory addresses or register numbers. –Programming requires deep understanding of the machine architecture

Levels of programming languages Machine language –Programs are not portable because instructions and their encoding are machine- specific –Programs are extremely hard to write, debug and read

Levels of programming languages Assembly language –Operations and operands have symbolic names. –Can use macros as shorthand for common sequences of code. –An assembler translates into machine code. –Still machine dependent. –Almost as hard to write as machine code

Levels of programming languages High-level language Examples: C, Lisp, Java, Fortran, … Have higher level constructs. Example: Languages usually supports type checking and other checks that help detect bugs. Programs are much easier to write, debug and read. Programs are now machine independent. Programs may still be “language-implementation dependent”. Before 1957, it was commnly delieved that any compiler would produce code so teribly inefficient as to be useless 1 sub 3 5 ;sub 3 from reg 5 2 skp 5 ;skip if reg 5 is 0 3 jmp 10 ;jump to line if (x==3) else

Interpreters vs. Translators (compilers) Compiler – คอมไพเลอร์ทำ หน้าที่แปล (translation) โปรแกรมเป็น ภาษาเครื่อง ซึ่งทำ ให้การปฏิบัติงาน ของโปรแกรมเร็ว มาก เช่น คอมไพเลอร์ของ ภาษา C, COBOL

Interpreters vs. Translators (compilers) Pure Interpretation – โปรแกรมถูกตีความ (interpreted) แต่ละคำสั่งด้วย โปรแกรมที่เรียกว่า interpreter ซึ่งทำหน้าที่เป็น ซอฟต์แวร์จำลอง fetch-execute cycle สำหรับ ภาษาระดับสูง และประกอบด้วย virtual machine สำหรับภาษานั้น

Interpreters vs. Translators (compilers) Hybrid Implementation Systems – ระบบที่มีทั้ง compilers และ interpreters

Language Paradigms-1 Imperative languages –Program statements are commands. Ex.: “Add 17 to x.” –Key operations: Assignment. Looping. –Fits the von Neumann architecture closely. –Examples: Fortran, C, Pascal, Turing. Functional languages –Program statements describe the value of expressions, using(essentially) noun phrases. –Key operation: Expression evaluation, by applying a function. –Examples: Lisp, Scheme, ML

Language Paradigms-1 Logic-based languages –Program statements describe facts and rules. –Example: “Fact : Doug is Tom’s father. Rule : If x is y’s father and y is z’s father, then x is z’s grandfather.” –Programs don’t say how to find a solution. –Key operation: “Unification” (the how). –Example: Prolog.

Language Paradigms-1 Object-oriented languages –Program describes communication between objects. Example: “Fraction f1, simplify yourself.” –Key operation: Message passing, inheritance. –Can be imperative or functional. –Examples: Simula, C++, Java, CLOS.

Language Paradigms-2 Scientific Applications – เครื่องคอมพิวเตอร์เครื่องแรกในปี 1940 ประดิษฐ์ ขึ้นมาเพื่องานทางด้านวิทยาศาสตร์ โปรแกรมมี โครงสร้างข้อมูลแบบง่ายและมีการคำนวณตัวเลข ทางคณิตศาสตร์อย่างละเอียดเช่น FORTRAN ALGOL60 Business Applications – การนำคอมพิวเตอร์มาใช้ทางด้านธุรกิจเริ่มต้นในปี 1950 ภาษาระดับสูงที่ประสบความสำเร็จคือ COBOL Artificial Intelligence – ภาษาที่มีการคำนวณเชิงสัญลักษณ์มากกว่าเชิง ตัวเลข โครงสร้างข้อมูลสำหรับการคำนวณแบบนี้คือ linked lists เช่น ภาษา LISP Prolog

Language Paradigms-2 Systems Programming – ภาษาสำหรับสร้างระบบปฏิบัติการ ซึ่งจำเป็น ต้องการปฏิบัติงานที่มีประสิทธิภาพ เร็ว ทำงานได้ อย่างต่อเนื่อง และต้องทำงานในโหมด low-level เพื่อติดต่อกับอุปกรณ์ภายนอกได้ เช่น ภาษา C สร้างขึ้นเพื่อสร้างระบบปฏิบัติการ Unix และง่ายต่อ การ port ระหว่างเครื่องที่แตกต่างกัน Scripting Languages – ภาษานี้คือการนำรายการของคำสั่งมาวางเรียงต่อกัน เรียกว่า script เก็บในไฟล์ ภาษาแรกมีชื่อว่า sh (shell) จัดเก็บคำสั่งง่ายๆ สำหรับจัดการไฟล์ หรือ แบ่งไฟล์ออกจากกัน –Perl พัฒนามาจากภาษา sh และ awk รวมกัน ( โดย การเพิ่มส่วนต่างๆให้กับ sh ?) จนเป็นภาษาที่ สมบูรณ์ในการเขียนโปรแกรม

What Makes a Good Language General goals: –The language should be easy to learn. –Programs written in it should be easy to write and to read.

Language Evaluation Criteria Readability – สิ่งสำคัญในการตัดสินคือ เป็นภาษาที่สามารถอ่าน และเข้าใจได้ง่าย สมัยแรกการพัฒนาเน้นในเรื่อง ของการเขียน แต่หลังจากแนวคิด software lift cycle (1987) maintenance เป็นส่วนที่สำคัญที่สุด ของ cycle count = count + 1 count += 1 count++ ++count

Language Evaluation Criteria Writability – วัดความสามารถในการเขียนโปรแกรม Reliability – โปรแกรมมีเสถียรภาพ ถ้าสามารถปฏิบัติงานภายใต้ เงื่อนไขที่กำหนดได้ทั้งหมด int i = 1; float f = 9.5; i = f ; | f = i; Cost – ค่าใช้จ่ายในด้านต่างๆเช่น เวลาที่ใช้ในการเขียน ค่าใช้จ่ายในการฝึกอบรม เวลาที่ใช้ในการคอมไพล์ เวลาในการ execute

Language Evaluation Criteria Orthogonal – ลักษณะของคำสั่งที่ไม่ขึ้นอยู่กับบริบท (context) ของโปรแกรม – คำสั่งที่นำค่าตัวเลขขนาด 32 บิตในหน่วยความจำ หรือรีจีสเตอร์ไปบวกและแทนที่ค่าเดิมของรีจีสเตอร์ ปลายทาง เช่น – เครื่อง IBM mainframe ประกอบไปด้วยสองคำสั่ง A Reg1, memory_cell AR Reg1, Reg2 – เครื่อง VAX ประกอบด้วยหนึ่งคำสั่ง ADDL operand_1, operand_2

ที่มา Concepts of programming languages : Sebesta, Robert W. Joanis, Eric : University of Toronto