This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Last revision Both sides next revision | ||
introduction:pascalprogramming [2018/12/24 10:09] admin |
introduction:pascalprogramming [2019/01/04 11:11] admin [ภาษาเชิงวัตถุ Object Pascal] |
||
---|---|---|---|
Line 12: | Line 12: | ||
ตัวแปลภาษา (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|Pascal Programming~~ | + | ~~DISCUSSION:closed~~ |