User Tools

Site Tools


Sidebar


Introduction


Basic Tutorials


Advance Tutorials


Useful Techniques


Examples

  • Simple Pipe Weight Calculator
  • Unit Convertor

Sidebar

introduction:pascalprogramming

This is an old revision of the document!


ภาษา Pascal

ประวัติความเป็นมา

ภาษา Pascal พัฒนาโดยศาสตราจารย์นิคลอส เวียร์ต (Professor Niklaus Wirth) และทีมงานในสถาบัน The Eidgenossische Technische Hoschule ประเทศสวิสเซอร์แลนด์ โดยตั้งชื่อเพื่อเป็นเกียรติแก่นักคณิตศาสตร์ชาวฝรั่งเศส Blaise Pascal ผู้ประดิษฐ์เครื่องคิดเลขคนแรกของโลก

ภาษา Pascal เป็นภาษาระดับสูงที่ถูกนำมาใช้ตั้งแต่ปี 1970 โดยมีลักษณะเด่น คือ เป็นภาษาที่ไม่ซับซ้อน เรียนรู้ได้เร็ว เข้าใจง่าย มีประสิทธิภาพสูง รองรับการเขียนโปรแกรมในเชิงโครงสร้าง (Structured Programming and Data Structure)

รูปแบบการเขียนของภาษา Pascal ถูกพัฒนามาจากภาษา ALGOL 60 โดยจะมีการใช้คำสั่ง Begin … End ในการกำหนดบล๊อกของคำสั่ง (ในขณะที่ภาษา C ใช้ {…})

ภาษาเชิงวัตถุ Object Pascal

ในปี 1980 ได้มีการนำภาษา Pascal มาพัฒนาต่อยอดให้รองรับการเขียนโปรแกรมเชิงวัตถุ (Object Oriented Programming) และใช้ชื่อภาษาใหม่ว่า Object Pascal เวอร์ชันแรกถูกนำมาใช้ราวปี 1985 โดย Apple Computer (สำหรับระบบปฏิบัติการ Macintosh) และ Borland (สำหรับระบบปฏิบัติการ Dos และ Microsoft Window)

ตัวแปลภาษา (Compiler) ที่เป็นที่รู้จักมีดังนี้

  • Delphi พัฒนาโดย Borland Software Corporation (ปัจจุบันถูกขายให้กับ Embarcadero Technologies) เพื่อใช้งานบน Microsoft Window Platform เป็นแปลภาษาที่มีประสิทธิภาพสูง โดยเวอร์ชั่นที่เป็นที่นิยมสำหรับ Programmer ในยุคนั้น คือ Delphi 7
  • Free Pascal Compiler(FPC) มีคุณสมบัติรองรับระบบปฎิบัติการได้หลากหลาย (Cross Platform) เป็นอีกหนึ่งตัวแปลภาษาที่มีประสิทธิภาพสูงที่ติดตั้งมากับ Lazarus IDE และที่สำคัญคือเป็นแบบ Opensource

ตัวอย่างโปรแกรม Object Pascal

program ObjectPascalExample;

   type
      THelloWorld = object
         procedure Put;
      end;

   var
      HelloWorld: THelloWorld;
      Value:integer;

   procedure THelloWorld.Put;
   begin
      ShowMessage('Hello, World!');
   end;

begin
   //This is line comment
   {This is block 
   comments}
   Value:=15;
   New(HelloWorld);
   HelloWorld.Put;
   Dispose(HelloWorld);
end.


introduction/pascalprogramming.1545621033.txt.gz · Last modified: 2018/12/24 10:10 by admin