User Tools

Site Tools


introduction:pascalprogramming

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
introduction:pascalprogramming [2018/07/16 15:33]
admin [ภาษา Pascal]
introduction:pascalprogramming [2019/01/04 11:11] (current)
admin
Line 1: Line 1:
 =====ภาษา Pascal===== =====ภาษา Pascal=====
----- 
 ====ประวัติความเป็นมา==== ====ประวัติความเป็นมา====
 ภาษา Pascal พัฒนาโดยศาสตราจารย์นิคลอส เวียร์ต (Professor Niklaus Wirth) และทีมงานในสถาบัน The Eidgenossische Technische Hoschule ประเทศสวิสเซอร์แลนด์ โดยตั้งชื่อเพื่อเป็นเกียรติแก่นักคณิตศาสตร์ชาวฝรั่งเศส Blaise Pascal ผู้ประดิษฐ์เครื่องคิดเลขคนแรกของโลก ​ ภาษา Pascal พัฒนาโดยศาสตราจารย์นิคลอส เวียร์ต (Professor Niklaus Wirth) และทีมงานในสถาบัน The Eidgenossische Technische Hoschule ประเทศสวิสเซอร์แลนด์ โดยตั้งชื่อเพื่อเป็นเกียรติแก่นักคณิตศาสตร์ชาวฝรั่งเศส Blaise Pascal ผู้ประดิษฐ์เครื่องคิดเลขคนแรกของโลก ​
Line 8: Line 7:
 รูปแบบการเขียนของภาษา Pascal ถูกพัฒนามาจากภาษา ALGOL 60 โดยจะมีการใช้คำสั่ง Begin ... End ในการกำหนดบล๊อกของคำสั่ง (ในขณะที่ภาษา C ใช้ {...}) รูปแบบการเขียนของภาษา Pascal ถูกพัฒนามาจากภาษา ALGOL 60 โดยจะมีการใช้คำสั่ง Begin ... End ในการกำหนดบล๊อกของคำสั่ง (ในขณะที่ภาษา C ใช้ {...})
  
 +----
 ====ภาษาเชิงวัตถุ Object Pascal==== ====ภาษาเชิงวัตถุ Object Pascal====
 ในปี 1980 ได้มีการนำภาษา Pascal มาพัฒนาต่อยอดให้รองรับการเขียนโปรแกรมเชิงวัตถุ (Object Oriented Programming) และใช้ชื่อภาษาใหม่ว่า Object Pascal เวอร์ชันแรกถูกนำมาใช้ราวปี 1985 โดย Apple Computer (สำหรับระบบปฏิบัติการ Macintosh) และ Borland (สำหรับระบบปฏิบัติการ Dos และ Microsoft Window) ในปี 1980 ได้มีการนำภาษา Pascal มาพัฒนาต่อยอดให้รองรับการเขียนโปรแกรมเชิงวัตถุ (Object Oriented Programming) และใช้ชื่อภาษาใหม่ว่า Object Pascal เวอร์ชันแรกถูกนำมาใช้ราวปี 1985 โดย Apple Computer (สำหรับระบบปฏิบัติการ Macintosh) และ Borland (สำหรับระบบปฏิบัติการ Dos และ Microsoft Window)
Line 13: Line 13:
 ตัวแปลภาษา (Compiler) ที่เป็นที่รู้จักมีดังนี้ ตัวแปลภาษา (Compiler) ที่เป็นที่รู้จักมีดังนี้
   * **Delphi** พัฒนาโดย Borland Software Corporation (ปัจจุบันถูกขายให้กับ Embarcadero Technologies) เพื่อใช้งานบน Microsoft Window Platform เป็นแปลภาษาที่มีประสิทธิภาพสูง โดยเวอร์ชั่นที่เป็นที่นิยมสำหรับ Programmer ในยุคนั้น คือ Delphi 7   * **Delphi** พัฒนาโดย Borland Software Corporation (ปัจจุบันถูกขายให้กับ Embarcadero Technologies) เพื่อใช้งานบน Microsoft Window Platform เป็นแปลภาษาที่มีประสิทธิภาพสูง โดยเวอร์ชั่นที่เป็นที่นิยมสำหรับ Programmer ในยุคนั้น คือ Delphi 7
-  * **Free Pascal Compiler(FPC)** มีคุณสมบัติรองรับระบบปฎิบัติการได้หลากหลาย (Cross Platform) เป็นอีกหนึ่งตัวแปลภาษาที่มีประสิทธิภาพสูงที่ติดตั้งมากับ [[introduction:​LazarusIDE|Lazarus IDE]] และที่สำคัญคือเป็นแบบ Opensource ​+  * **Free Pascal Compiler(FPC)** มีคุณสมบัติรองรับระบบปฎิบัติการได้หลากหลาย (Cross Platform) เป็นอีกหนึ่งตัวแปลภาษาที่มีประสิทธิภาพสูงที่ติดตั้งมากับ [[introduction:​LazarusIDE|Lazarus IDE]] และที่สำคัญคือเป็นแบบ Opensource ​\\ 
 +  * Compiler อื่นๆอีกมากมายเช่น GNU Pascal, Oxygen เป็นต้น \\
  
-====ตัวอย่างโปรแกรม Object Pascal====+สำหรับ Free Pascal Compiler หรือ FPC นั้น ได้ถือกำเนิดขึ้นในช่วงที่ Borland Turbo Pascal 7 ถูกหยุดพัฒนา แล้วจะถูกแทนที่ด้วย Borland Delphi Compiler การพัฒนา FPC แรกเริ่มนั้น ถูกเขียนขึ้นและ Compile บน Turbo Pascal และต่อมาถูกพัฒนาจนสามารถ Compile ได้เอง  
 +นั่นทำให้ FPC มีความคล้ายคลึงกับ Turbo Pascal และ Delphi เป็นอย่างมาก และปัจจุบันมีโปรแรกมเมอร์หลายท่านใช้งาน FPC บน Lazarus-IDE ควบคู่ไปกับ Delphi \\ 
 + 
 +---- 
 +====ตัวอย่างโปรแกรม Object Pascal ​(บน Free Pascal Compiler)====
 <sxh delphi;> <sxh delphi;>
 program ObjectPascalExample;​ program ObjectPascalExample;​
 +type
 +   ​THelloWorld = object
 +      procedure Put;
 +   end;
  
-   type +var 
-      THelloWorld ​= object +   HelloWorld: ​THelloWorld;​ 
-         ​procedure Put+   Value:​integer;
-      end;+
  
-   var +procedure THelloWorld.Put;​ 
-      HelloWorld: THelloWorld;​ +begin 
-      Value:​integer;​ +   writeln('​Hello,​ World!'​);​ 
- +end;
-   procedure THelloWorld.Put;​ +
-   ​begin +
-      ​ShowMessage('​Hello,​ World!'​);​ +
-   ​end;+
  
 begin begin
-   //This is line comment +  ​//This is In-line comment 
-   ​{This is block  +  {This is Blog  
-   ​comments} +  comments} 
-   ​Value:​=15;​ +  Value:​=15;​ 
-   New(HelloWorld);​ +  HelloWorld.Put;​ 
-   HelloWorld.Put;​ +  ​readln(); 
-   Dispose(HelloWorld); +end. 
-end.+
 </​sxh>​ </​sxh>​
 +----
 +
 +~~DISCUSSION:​closed~~
introduction/pascalprogramming.1531730003.txt.gz · Last modified: 2018/07/16 15:33 by admin