ผลต่างระหว่างรุ่นของ "ภาษาโปรแกรม"
เนื้อหาที่ลบ เนื้อหาที่เพิ่ม
Octahedron80 (คุย | ส่วนร่วม) |
Octahedron80 (คุย | ส่วนร่วม) ทัวริงบริบูรณ์ |
||
บรรทัด 6:
== คำจำกัดความ ==
ภาษาโปรแกรมเป็นสัญกรณ์อย่างหนึ่งสำหรับการเขียนโปรแกรม ซึ่งมีข้อกำหนดต่าง ๆ เกี่ยวกับการคิดคำนวณหรือขั้นตอนวิธี <ref name="Aaby 2004">{{cite book|last=Aaby|first=Anthony|title=Introduction to Programming Languages|year=2004|url=http://burks.brighton.ac.uk/burks/pcinfo/progdocs/plbook/index.htm}}</ref> ผู้แต่งตำราบางคน (ไม่ใช่ทั้งหมด) ได้ให้คำจำกัดความของ "ภาษาโปรแกรม" อย่างเข้มงวดว่า หมายถึงภาษาที่สามารถแสดงออกด้วยขั้นตอนวิธีที่เป็นไปได้''ทั้งหมด'' <ref name="Aaby 2004"/><ref>ในมโนทัศน์แบบคณิตศาสตร์ สิ่งนี้หมายความว่า ภาษาโปรแกรมคือ[[
* '''การทำงานและเป้าหมาย''' ''ภาษาโปรแกรมคอมพิวเตอร์'' คือภาษาชนิดหนึ่ง <ref name="Fischer">Steven R. Fischer, ''A history of language'', Reaktion Books, 2003, ISBN 186189080X, p. 205</ref> ที่ใช้สำหรับเขียน[[โปรแกรมคอมพิวเตอร์]] ซึ่งเกี่ยวข้องกับคอมพิวเตอร์ที่กระทำการคิดคำนวณหรือขั้นตอนวิธีบางอย่าง <ref name=sigplan>{{cite web|author=[[Association for Computing Machinery|ACM]] SIGPLAN|title=Bylaws of the Special Interest Group on Programming Languages of the Association for Computing Machinery|url=http://www.acm.org/sigs/sigplan/sigplan_bylaws.htm|accessdate=2006-06-19|year=2003}}, ''The scope of SIGPLAN is the theory, design, implementation, description, and application of computer programming languages - languages that permit the specification of a variety of different computations, thereby providing the user with significant control (immediate or delayed) over the computer's operation.''</ref> และควบคุมอุปกรณ์ภายนอกที่เป็นไปได้อาทิ [[เครื่องพิมพ์]] [[เครื่องขับจานบันทึก]] [[หุ่นยนต์]] <ref name="robots">{{cite web|url=http://www.cs.brown.edu/people/tld/courses/cs148/02/programming.html |title=Programming Robots |accessdate=2006-09-23 |last=Dean |first=Tom |date= |year=2002 |work=Building Intelligent Robots |publisher=Brown University Department of Computer Science}}</ref> และอื่น ๆ ตัวอย่างเช่น โปรแกรม[[โพสต์สคริปต์]]มักถูกสร้างโดยโปรแกรมอื่นเพื่อควบคุมเครื่องพิมพ์หรือจอภาพ ภาษาโปรแกรมโดยนัยทั่วไปมากขึ้น อาจใช้พรรณนาการคิดคำนวณบนเครื่องจักรบางชนิด ซึ่งอาจเป็นเครื่องจักรนามธรรมก็ได้ เป็นที่ยอมรับกันโดยทั่วไปว่า ข้อกำหนดภาษาโปรแกรมที่สมบูรณ์ จะต้องมีการพรรณนาลักษณะเครื่องจักรหรือหน่วยประมวลผลสำหรับภาษานั้น ซึ่งอาจเป็นการพรรณนาในอุดมคติก็ได้ <ref name=nara2>R. Narasimahan, Programming Languages and Computers: A Unified Metatheory, pp. 189--247 in Franz Alt, Morris Rubinoff (eds.) Advances in computers, Volume 8, Academic Press, 1994, ISBN 012012108, p.193 : "a complete specification of a programming language must, by definition, include a specification of a processor--idealized, if you will--for that language." [แหล่งข้อมูลนี้มีการอ้างอิงจากแหล่งอื่นที่รับรองข้อความดังกล่าว]</ref> ในทางปฏิบัติเป็นส่วนใหญ่ ภาษาโปรแกรมเกี่ยวข้องกับคอมพิวเตอร์ จึงทำให้ภาษาโปรแกรมต่าง ๆ โดยปกติถูกกำหนดและศึกษาในแนวทางนี้ <ref>{{cite book|last=Ben Ari|first=Mordechai|title=Understanding Programming Languages|publisher=John Wiley and Sons| year=1996|quote=Programs and languages can be defined as purely formal mathematical objects. However, more people are interested in programs than in other mathematical objects such as groups, precisely because it is possible to use the program—the sequence of symbols—to control the execution of a computer. While we highly recommend the study of the theory of programming, this text will generally limit itself to the study of programs as they are executed on a computer.}}</ref> ภาษาโปรแกรมต่างจาก[[ภาษาธรรมชาติ]]ตรงที่ ภาษาธรรมชาติใช้แสดงปฏิสัมพันธ์ระหว่างมนุษย์ด้วยกันเพียงเท่านั้น ในขณะที่ภาษาโปรแกรมทำให้มนุษย์สื่อสารชุดคำสั่งแก่เครื่องจักรได้อีกด้วย
* '''แนวคิดนามธรรม''' ภาษาโปรแกรมโดยปกติจะมี[[ภาวะนามธรรม (วิทยาการคอมพิวเตอร์)|ภาวะนามธรรม]] สำหรับนิยามและจัดดำเนินการ[[โครงสร้างข้อมูล]] หรือควบคุมกระแสการทำงาน ความจำเป็นในทางปฏิบัติที่ภาษาโปรแกรมสนับสนุนภาวะนามธรรมอย่างเพียงพอ แสดงออกมาด้วยหลักการที่เป็นนามธรรม <ref>David A. Schmidt, ''The structure of typed programming languages'', MIT Press, 1994, ISBN 0262193493, p. 32</ref> หลักการนี้บางครั้งก็คิดค้นขึ้นเพื่อเป็นข้อเสนอแนะให้โปรแกรมเมอร์สามารถใช้ภาวะนามธรรมเช่นนั้นได้อย่างถูกต้อง <ref>{{cite book|last=Pierce|first=Benjamin|title=Types and Programming Languages|publisher=MIT Press|year=2002|isbn=0-262-16209-1|page=339}}</ref>
* '''พลังในการแสดงออก''' [[ทฤษฎีการคำนวณ]]แบ่งประเภทภาษาต่าง ๆ ตามการคิดคำนวณโดยความสามารถในการแสดงออก ภาษา[[
[[ภาษามาร์กอัป]]อย่างเช่น [[เอกซ์เอ็มแอล]] [[เอชทีเอ็มแอล]] หรือ[[ทร็อฟฟ์]] เป็นต้น ซึ่งถูกนิยามว่าเป็น[[ข้อมูลเชิงโครงสร้าง]] โดยทั่วไปไม่ถือว่าเป็นภาษาโปรแกรม <ref>[http://www.w3.org/XML/1999/XML-in-10-points.html XML in 10 points] [[W3C]], 1999, ''XML is not a programming language.''</ref><ref>{{cite book|last=Powell|first=Thomas|title=HTML & XHTML: the complete reference|publisher=McGraw-Hill|year=2003|isbn=0-07-222-942-X|page=25|quote=''HTML is not a programming language.''}}</ref><ref>{{cite book|last1=Dykes|first1=Lucinda|first2=Ed|last2=Tittel|title=XML For Dummies, 4th Edition|publisher=Wiley|year=2005|isbn=0-7645-8845-1|page=20|quote=''...it's a markup language, not a programming language.''}}</ref> อย่างไรก็ตาม ภาษาโปรแกรมอาจจะใช้วากยสัมพันธ์เหมือนภาษามาร์กอัป ถ้าอรรถศาสตร์เชิงคำนวณมีการนิยามไว้ ตัวอย่างเช่น [[เอกซ์เอสแอลที]] ซึ่งเป็นภาษาย่อยของเอกซ์เอ็มแอลที่เป็น
วลี ''ภาษาคอมพิวเตอร์'' บางครั้งก็ใช้แทนความหมายของภาษาโปรแกรม <ref>Robert A. Edmunds, The Prentice-Hall standard glossary of computer terminology, Prentice-Hall, 1985, p. 91</ref> อย่างไรก็ตาม ผู้แต่งตำราแต่ละคนก็ใช้วลีทั้งสองรวมถึงขอบเขตที่ชัดเจนในแนวทางที่ต่างกัน แนวคิดหนึ่งอธิบายว่า ภาษาโปรแกรมเป็นเซตย่อยของภาษาคอมพิวเตอร์ <ref>Pascal Lando, Anne Lapujade, Gilles Kassel, and Frédéric Fürst, ''[http://www.loa-cnr.it/ICSOFT2007_final.pdf Towards a General Ontology of Computer Programs]'', [http://dblp.uni-trier.de/db/conf/icsoft/icsoft2007-1.html ICSOFT 2007], pp. 163-170</ref> ในทำนองนี้ ภาษาที่ใช้ในการคิดคำนวณอันมีเป้าหมายต่างกัน ที่แสดงออกเป็นโปรแกรมคอมพิวเตอร์ โดยนัยทั่วไปคือภาษาคอมพิวเตอร์ที่ถูกเลือกขึ้นมา ยกตัวอย่างเช่น ภาษามาร์กอัปบางครั้งก็ถูกพูดถึงว่าเป็นภาษาคอมพิวเตอร์ เพื่อเน้นย้ำว่ามันไม่ได้ออกแบบมาเพื่อเขียนโปรแกรม <ref>S.K. Bajpai, ''Introduction To Computers And C Programming'', New Age International, 2007, ISBN 812241379X, p. 346</ref> แนวคิดอีกอย่างหนึ่งอธิบายว่า ภาษาโปรแกรมคือโครงสร้างเชิงทฤษฎีสำหรับการเขียนโปรแกรมให้แก่เครื่องจักรนามธรรม และภาษาคอมพิวเตอร์คือเซตย่อยของสิ่งดังกล่าวที่ทำงานบนคอมพิวเตอร์ในทางกายภาพ ซึ่งมีทรัพยากรฮาร์ดแวร์จำกัด <ref>R. Narasimahan, Programming Languages and Computers: A Unified Metatheory, pp. 189--247 in Franz Alt, Morris Rubinoff (eds.) Advances in computers, Volume 8, Academic Press, 1994, ISBN 012012108, p.215: "[...] the model [...] for computer languages differs from that [...] for programming languages in only two respects. In a computer language, there are only finitely many names--or registers--which can assume only finitely many values--or states--and these states are not further distinguished in terms of any other attributes. [author's footnote:] This may sound like a truism but its implications are far reaching. For example, it would imply that any model for programming languages, by fixing certain of its parameters or features, should be reducible in a natural way to a model for computer languages."</ref> [[จอห์น ซี. เรย์โนลด์]] เน้นว่า ภาษา[[ข้อกำหนดรูปนัย]] (formal specification) มีลักษณะของภาษาโปรแกรมมากพอ ๆ กับภาษาที่ตั้งใจให้กระทำการ เขายังให้เหตุผลด้วยว่า รูปแบบรับเข้าเชิงข้อความหรือแม้แต่เชิงกราฟิกที่ส่งผลต่อพฤติกรรมของคอมพิวเตอร์ ก็ถือเป็นภาษาโปรแกรมเช่นกัน ถึงแม้ข้อเท็จจริงคือสิ่งเหล่านั้นไม่ใช่
== ลักษณะของภาษาโปรแกรม ==
|