زبانهای برنامهنویسی محرمانه
فارسی | English | ||||||||
زبان برنامهنویسی ترسناک یک زبان برنامهنویسی است که برای تست کردن محدودیتهای طراحی دیگر زبانهای برنامهنویسی طراحی شدهاست. کلمه محرمانه این زبانها را از دیگر زبانهای برنامهنویسی که برای نوشتن نرمافزار استفاده میشوند متمایز میکند. معمولاً نویسندههای برنامههای محرمانه خیال ندارند جریان برنامهنویسی را منحرف کنند به جز در مواردی خاص مانند الگوهای visuospatial که برای این منظور در نظر گرفته شدهاند. این زبانها مورد علاقه هکرها و افرادی است که میخواهند جریان داده را به هم بزنند. مورد استفاده بودن از اهداف طراحان زبانهای محرمانه نیست بلکه معمولاً هدف آنها حذف یا جایگزینی اشکال قراردادی در زبان است که هنوز زبان را تورینگ کامل نگاه میدارد. محتویاتتاریخچه[ویرایش]اولین و هنوز یکی از مثالهای استاندارد زبان INTERACAL است در سال ۱۹۹۲ توسط Don Woods وJames M Lyon طراحی شد که با زبانهای برنامهنویسی که کاربران معمول با آن آشنا هستند تفاوتهایی دارد. این زبان از قسمتهایی از زبانهای برنامهنویسی تقلید میکند مانند زبانهای فورترن، کوبول و زبان اسمبلی که از قسمتهایی از آن تقلید شدهاست. سابق بر این پیادهسازی INTERCAL با IBM System/360 بود و کامپیوترهای آتاری که بعد از آن به حیات خود ادامه نداد و بنابراین این زبان در برههای از میان رفت. احیاگران زبان در ۱۹۹۰ در جریان ساخت سیستم عامل یونیکس به وسیله زبان سی از یک زبان محرمانه استفاده کردند. در سال 1992 Wouter van Ootmerssen یک زبان برنامهنویسی مبتنی بر پشته را ابداع کرد که بهطور ذاتی کدهای آن بسیار مبهم و ناخوانا بود اما نکته قابل توجه این بود که در این زبان از یک کامپایلر با ۱۰۲۴ بایت استفاده میشود اما با اصلاحاتی این زبان جز زبانهای محرمانه محبوب شد نام این زبان brainfuck است. اصطلاحات برنامهنویسی محرمانه[ویرایش]Turing Tarpit یک زبان توینگ کامل است که تعداد عملگر و دستورها اجزای مشابه آن خیلی کم است. این شامل brainf,osic,tue میشود. Turning tarpit یک تورینگ تارپیت با کدگذاری تمام حالات است به عنوان مثال زبانی است که یک بخش از عملگرها را در جریان حالت فعلی برنامه دخالت میدهد. کدگذاری حالات یک متد برای کدگذاری برنامه است که هر زیر رشته از کد یک دستورالعمل از هر دو:
نکته اینکه یک دستور تک معمولاً دو فاز ترتیبی را دارد:انتخاب عملگر و اجرای آن. عملگرها میتوانند ایستا(reMorse یا Thrat) یا پویا(reMorse4ever) باشند. در اینجا نمونهای بر مبنای (reMorse یا Thrat) است:
مدل زبان[ویرایش]مدل زبان میتواند اینگونه دستهبندی شود و این دستهبندیها میتوانند یک یادگیری عمومی از راههایی که یک زبان خاص کار میکند در اختیار بگذارد. این شامل زبانهای مستبدانه/اجباری میشود (مانند brainfuck) که دستورات اینگونه توضیح داده میشوند که چگونه میتوانند دادهها را تغییر دهند. زبانهای تابعی مانند unlamda که دادهها و کدها کمتر قابل تغییر و تعویض هستند و اجرا با اجرای توابع که توابع دیگر را نتیجه میدهند ادامه پیدا میکند و زبانهای بازنویسی مانند thue که تابعهای انتقالی در وضعیت مقدار دهی اولیه به کار میروند. funges[ویرایش]funge یک زبان محرمانه است که یک مدل برنامه سازی متریک فاصله دار متناسب با سیستم دارد و دستورهایی که اشاره شدهاند اجرا میشوند. دستورهای متفاوت نشان دهنده جهت دستورهایی است که باید اجرا شوند. استاندارد اداری فعلی که برای این زبان برنامهنویسی به کار میرود funge-98 است. این مشخصه مربوط به خصوصیات عمومی زبان برنامهنویسی :en:befungeاست که دو بعد حلقوی توپولوژی دارد. زبانهای غیرقطعی[ویرایش]برای زبانهای قطعی اگر وضعیتی داده شده در برنامه وضعیت بعدی قابل پیشبینی است. بیشتر زبانها قطعی هستند اما زبانهایی مانند befunge و java2k کدهایشان به صورت رندوم در صورت غیر قطعی بودن اجرا میشوند. زبانهای غیر قطعی معمولاً برای جستجو در فضاهای بزرگتر استفاده میشوند. ایجاد کننده تکست تصادفی the Data Engine و rmutt نمونهای از زبانهای غیر قطعی میباشند. انجمن اینترنت[ویرایش]یک انجمن کوچک اما پر رونق از برنامه نویسان و طراحان زبانهای محرمانه در اینترنت موجود است. این انجمن گاهوبیگاه فعال میشود و گفتگوهای آنها مربوط به مباحث تورینگ کامل بودن زبانها و میزان سختی دیداری کردن مفاهیم ریاضی در زبانهای برنامهنویسی است. کامل بودن تورینگ از جمله مباحثی است که طرفداران زیادی دارد و دیگر موضوع مورد علاقه نوشتن کدهای بدون ابهام است. مثالها[ویرایش]در زیر نمونههایی از زبانهای برنامهنویسی محرمانه آورده شدهاست: Befunge[ویرایش]زبان Befunge و هم خانوادههای آن به اشاره گر کد اجازه میدهند که در جاهای مختلف کد قرار داشته باشند. برای نمونه این برنامه یک برنامه hello world است با قرار دادن برعکس کاراکترها در پشته بعد چاپ آنها به وسیله چاپ ساعت گرد با این کدها [>], [:],و، [_], [,], d [^]. "dlroW olleH">:v ^,_@ Binary Lambda Calculus[ویرایش]به وسیله تئوری دادهها الگوریتمیک ابداع شد و دید آن اینگونه است که کد چگال تر با معنای حداقلی طرح ۲۹ بایت خود مترجم و غیره. Brainfuck[ویرایش]این زبان برای حداقل کردن کد طراحی شده که منجر به ناخوانا شدن کد میشود. خروجی این برنامه hello world است. ++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+. +++++++ .. +++.>++.<<+++++++++++++++.>. +++. ----. ----.>+.>. Chef[ویرایش]این زبان پشته گرا توسط David Morgan-Mar برای اینکه برنامهها را مانند دستور آشپزی کند طراحی شدهاست. برنامهها شامل عنوان و مقادیر دادها و لیستی از دستورات پشتههای پیادهسازی شدهاست. FALSE[ویرایش]این زبان یک زبان بر مبنای پشته با دستورها و مقادیر تک کاراکتری است. برای مثال ۳+۱ میتواند به وسیله![+λ x → x + 1)(3): 3[1) محاسبه شود. INTERCAL[ویرایش]کوتاه شده یک «زبان کامپایلری بدون سرنام» است. LOLCODE[ویرایش]برای بازسازی [:en:lolcats]طراحی شدهاست. در ذیل یک سثال hello world آورده شدهاست. HAI CAN HAS STDIO? VISIBLE "HAI WORLD!" KTHXBYE Malbolge[ویرایش]Malbolge برای زبانهای بسیار سخت و محرمانه طراحی شدهاست. کامپیوتر تک دستوری[ویرایش]یک ماشین زبان با فقط یک عملگر است. Piet[ویرایش]piet زبانی است که توسط David Morgan-Mar ابداع شد کسی برنامه سازی بیت مپهای آن مانند یک هنر انتزاعی است. کامپایل شدن به وسیله یک اشاره گر که در اطراف تصویر حرکت میکند برای یک دامنه رنگی ادامه دار تا رنگ بعدی انجام میشود. ۲۰ رنگ موجود است که رفتار آنها پیشبینی شدهاست. ۱۸ تا از آنها رنگهای رنگی هستند که به صورت ۶ رنگ و ۳ طیف روشنایی مختلف مرتب شدهاند؛ و رنگ سیاه و سفید مرتب نشدهاند. زمانی که یک رنگ رنگی موجود است و یک رنگ دیگر وارد میشود پروسه انجام شده توسط تعداد سطوح رنگ و روشنایی که تغییر کردهاند مشخص میشود. سیاه نمیتواند وارد شود؛ زمانی که اشاره گر سعی میکند که به یک ناحیه سیاه وارد شود قوانین انتخاب بلوک بعدی تغییر میکند. اگر تمامی قوانین انجام شوند برنامه تمام خواهد شد. سفید عملی را انجام نمیدهد فقط به اشاره گر اجازه میدهد که عبور کند. رنگهای غیر از این ۲۰ رنگ به کامپایلر یا مترجم ارجاع داده میشوند. متغیرها در یک پشته به عنوان یک متغیر integer علامت دار ذخیره میشوند. بیشتر پروسههای مشخص شده مربوط به عملیات پشته خواهد بود. بقیه به وسیله دستورهای ورودی خروجی و به وسیله دستوراهایی که اشاره گر کامپایل در حرکتش مشخص میکند مشخص میشود. شکسپیر[ویرایش]زبان برنامهنویسی شکسپیر طراحی شدهاست که برنامهها را مانند نمایش نامههای شکسپیر کند برای مثال دستور زیر مانند یک دستور goto است: Act I: Hamlet's insults and flattery.. فضای خالی (Whitespace)[ویرایش]این زبان فقط از کاراکتر فضای خالی استفاده میکند(space,tabو return). این برخلاف خیلی از زبانهای برنامهنویسی است که تفاوتی بین کاراکترهای فضای خالی نمیگذاراند. برنامههای با این زبان میتوانند در سورس کدهای زبانهایی مانند c پنهان شوند. |
An esoteric programming language (sometimes shortened to esolang) is a programming language designed to test the boundaries of computer programming language design, as a proof of concept, as software art, as a hacking interface to another language (particularly functional programming or procedural programming languages), or as a joke. The use of esoteric distinguishes these languages from programming languages that working developers use to write software. Usually, an esolang's creators do not intend the language to be used for mainstream programming, although some esoteric features, such as visuospatial syntax,[1] have inspired practical applications in the arts. Such languages are often popular among hackers and hobbyists. Usability is rarely a goal for esoteric programming language designers—often it is quite the opposite. Their usual aim is to remove or replace conventional language features while still maintaining a language that is Turing-complete, or even one for which the computational class is unknown. Contents
HistoryThe earliest, and still the canonical example of an esoteric language was INTERCAL,[2] designed in 1972 by Don Woods and James M. Lyon, with the stated intention of being unlike any other programming language the authors were familiar with.[3][4] It parodied elements of established programming languages of the day, such as Fortran, COBOL, and assembly language. For many years INTERCAL was represented only by paper copies of the INTERCAL manual. The language's revival in 1990 as an implementation in C under Unix stimulated a wave of interest in the intentional design of esoteric computer languages. In 1993, Wouter van Oortmerssen created FALSE, a small stack-oriented programming language, with syntax designed to make the code inherently obfuscated, confusing, and unreadable. It also has a compiler of only 1024 bytes.[5] This inspired Urban Müller to create an even smaller language, the now-infamous brainfuck, which consists of only eight recognized characters. Along with Chris Pressey's Befunge (like FALSE, but with a two-dimensional instruction pointer), brainfuck is now one of the best-supported esoteric programming languages. These are canonical examples of minimal Turing tarpits and needlessly obfuscated language features. Brainfuck is related to the P′′ family of Turing machines. Esoteric programming termsTuring tarpitA Turing tarpit is a Turing-complete programming language in which any computable function could theoretically be written, but in which it is impractically difficult to do so. Esoteric languages may be described as Turing tarpits, especially when they aim to minimize the number of language features. Stateful encodingA method of encoding programs, such that each substring of the encoding is an instruction to both:
A single instruction always includes two sequential phases: choosing an operation, and executing it. The list of operations may either be static—as in reMorse or THRAT—or dynamic—as in reMorse4ever. Here is an example based on reMorse or THRAT: Select Next Operation in list Perform Operation Language paradigmThe paradigm of a language can fall into a number of categories, and these categories are used to get a general understanding of the way that a specific language operates. These include imperative languages such as brainfuck, in which instructions describe how to change data; functional languages such as Unlambda, in which data and code are more or less interchangeable and execution is the repeated application of functions to the results of other functions; and rewriting languages such as Thue, in which transformation functions are applied to an initial state. FungesA funge is an esoteric programming language which models its programs as metric spaces with coordinate systems (often, but not necessarily, Cartesian) and which execute instructions located at points in their program space by moving an instruction pointer (a position vector which indicates the currently executing instruction) through that space. Different instructions determine the direction in which the instruction pointer moves, and consequently, the sequence of instructions that is executed. The current official standard for the behaviour of these programming languages is the Funge-98 specification. This specification is a generalisation of the semantics of the Befunge programming language, which has a two-dimensional toroidal topology. Languages which adhere closely to this standard, such as Unefunge (one-dimensional) and Trefunge (three-dimensional), are sometimes called funges, while more "distant relatives" which differ in significant respects, such as Wierd, are referred to as fungeoids. One instruction set computerA one instruction set computer is a machine which supports only one operation. Nondeterministic languageFor a deterministic language, if one is given the current state of a program, the next state can always be predicted. This is not true for a nondeterministic language. Most languages are deterministic, but some languages, such as Befunge, supply a built-in randomization instruction. Moreover, languages such as Java2k have only randomized instructions. Thus, getting even trivial programs to have a reliable output is often a monumental, if not outright impossible, task. Nondeterministic languages can be used to explore large search spaces, such as grammars, where exhaustive search is impractical. Random text generators such as the Dada Engine and rmutt are examples of this kind of nondeterminstic language. More esoterically, nondeterministic algorithms have been employed in the theoretical investigation of hypercomputation. ExamplesBelow are some characteristic examples of esoteric programming languages: ArnoldcArnoldc is an esoteric programming language based on one-liners of Arnold Schwarzenegger. Following is the "Hello, World!" programmed in arnoldc: IT'S SHOWTIME
TALK TO THE HAND "Hello, World!"
YOU HAVE BEEN TERMINATED
AsciiDots
AsciiDots is an esoteric programming language based on ascii art. In this language, dots, represented by periods ( /#$<.
*-[+]
\#1/
BefungeBefunge allows the instruction pointer to roam in multiple dimensions through the code. For example, the following program displays "Hello World" by pushing the characters in reverse order onto the stack, then printing the characters in a loop which circulates clockwise through the instructions [>], [:], [v], [_], [,], and [^]. "dlroW olleH">:v
^,_@
Binary lambda calculusBinary lambda calculus is designed from an algorithmic information theory perspective to allow for the densest possible code with the most minimal means, featuring a 29 byte self interpreter, a 21 byte prime number sieve, and a 112 byte Brainfuck interpreter. BrainfuckBrainfuck is designed for extreme minimalism and leads to obfuscated code, with programs containing only eight distinct characters. The following program outputs "Hello World!": ++++++++++[>+++++++>++++++++++>+++<<<-]>++.>+.+++++++
..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.
ChefChef by David Morgan-Mar is a stack-oriented programming language designed to make programs look like cooking recipes.[6] Programs consist of a title, a list of variables and their data values and a list of stack manipulation instructions.[7] A joking design principle states that "program recipes should not only generate valid output, but be easy to prepare and delicious", and Morgan-Mar notes that an example Hello World program with "101 eggs" and "111 cups oil" would produce "a lot of food for one person."[7][8] FALSEFALSE is a stack-based language with single-character commands and variables.[9] For example, 3 + 1 can be calculated by evaluating (λ x → x + 1)(3): 3[1+]! FiM++FiM++ is an object-oriented programming language based on the My Little Pony television show.[10] FiM++ programs read like plain English, in the style of the show's 'friendship reports'. The following program prints "Hello World!" Dear Princess Celestia: Hello World!
Today I learned how to say Hello World!
I said "Hello World!".
That's all about how to say Hello World.
Your faithful student, Twilight Sparkle.
FRACTRANA FRACTRAN program is an ordered list of positive fractions together with an initial positive integer input n. The program is run by multiplying the integer n by the first fraction f in the list for which nf is an integer. The integer n is then replaced by nf and the rule is repeated. If no fraction in the list produces an integer when multiplied by n then the program halts. FRACTRAN was invented by mathematician John Conway. .Gertrude.Gertrude[11] is named after Gertrude Stein, and was designed (by Gerson Kurz) to enable programs to vaguely resemble her poetry. GolfScriptPrograms in GolfScript consist of lists of items, each of which is pushed onto the stack as it is encountered with the exception of variables which have code blocks as their value, in which case the code is executed. GrassGrass is a functional programming language that only uses the characters "W", "w", and "v". Thus, programs in Grass are said to look like ASCII art of grass. Grass has the formal specification which is based on untyped lambda calculus and the SECD machine.[12] Grass should not be confused with GRASS, a different programming language. INTERCALINTERCAL, short for "Compiler Language With No Pronounceable Acronym", was created in 1972 as a parody to satirize aspects of the various programming languages at the time.[4] JSFuckJSFuck is an esoteric programming style of JavaScript, where code is written using only six characters: [, ], (, ), !, and +. Unlike Brainfuck, which requires its own compiler or interpreter, JSFuck is valid JavaScript code, meaning JSFuck programs can be run in any web browser or engine that interprets JavaScript.[13][better source needed] LOLCODELOLCODE is designed to resemble the speech of lolcats. The following is the "hello world" example: HAI CAN HAS STDIO? VISIBLE "HAI WORLD!" KTHXBYE LOLCODE is frequently criticized for not being very esoteric, but rather being an ordinary procedural language with an unusual vocabulary.[14] MalbolgeMalbolge (the 8th circle of Hell) was designed to be the most difficult and esoteric programming language. Among other features, code is self-modifying by design and the effect of an instruction depends on its address in memory. ModiScriptModiScript[15] is an esoteric programming language that entirely consists of quotes from Indian Prime Minister Narendra Modi's speeches. The language follows many of his ideologies such as the "No import rule', in which importation of code is not allowed, consistent with his "Make in India" campaign. The following code prints "Mandir Wahin Banayenge": mitrooon
UP "BJP governed state hai"
SP "opposition me hai"
agar ye sach hai
bhaiyo aur behno "Mandir wahin banayenge"
nahi toh
bhaiyo aur behno "Abhi decision nahi liya gaya hai"
achhe din aa gaye
PietPiet is a language designed by David Morgan-Mar, whose programs are bitmaps that look like abstract art.[16] The compilation is guided by a "pointer" that moves around the image, from one continuous coloured region to the next. Procedures are carried through when the pointer exits a region. There are 20 colours for which behaviour is specified: 18 "colourful" colours, which are ordered by a 6-step hue cycle and a 3-step brightness cycle; and black and white which are not ordered. When exiting a "colourful" colour and entering another one, the performed procedure is determined by the number of steps of change in hue and brightness. Black cannot be entered; when the pointer tries to enter a black region, the rules of choosing the next block are changed instead. If all possible rules are tried, the program terminates. Regions outside the borders of the image are also treated as black. White does not perform operations, but allows the pointer to "pass through". The behaviour of colours other than the 20 specified is left to the compiler or interpreter. Variables are stored in memory as signed integers in a single stack. Most specified procedures deal with operations on that stack, others with input/output and with the rules by which the compilation pointer moves. Piet was named after the Dutch painter Piet Mondrian.[17] The originally intended name, Mondrian, was already taken. PikachuPikachu is an esoteric programming language developed by Nilabhro Datta, whose programs look like the dialect of Pikachu. Its stated purpose is to be easily usable by Pikachu. Programs written in the language should be readable and writable by any Pikachu.[18] To this end, Pikachu makes use of only 3 valid syntax elements - pi, pika and pikachu.[19][18] RockstarRockstar is designed for creating computer programs that are also song lyrics, and is heavily influenced by the lyrical conventions of 1980s hard rock and power ballads. It is dynamically typed and Turing-Complete. In the following example the line of code multiplies the value of your heart by the whole and stores it in my hands.
Put the whole of your heart into my hands ShakespeareShakespeare is designed to make programs look like Shakespearean plays. For example, the following statement declares a point in the program which can be reached via a GOTO-type statement: Act I: Hamlet's insults and flattery. TrainTrain is a completely visual programming language that looks like a wooden train set. Engines are threads, train cars are memory, and cargo on the cars are variables. Train contains multiple data types including blocks, numbers, colors, and dinosaurs. Stations operate on cargo to e.g. increment, decrement, add, subtract, or catapult and can be type specific. Wyes direct the flow of trains and include greater than, less than, prompt, and random. Magic tunnels allow for the creation of functions. Unlike other programming languages, there is no distinction between code, memory, and output in Train; a program and its state are just defined by the arrangement of Train pieces. UnlambdaUnlambda is a minimalist functional programming language. Most programs consist solely of the characters s, k, and `. WhitespaceWhitespace uses only whitespace characters (space, tab, and return), ignoring all other characters. This is the reverse of many traditional languages, which do not distinguish between different whitespace characters, treating tab and space the same. It also allows Whitespace programs to be hidden in the source code of programs in languages like C. Fictional Examples~ath~ath is an esoteric programming language used by the humans and trolls in the webcomic Homestuck. The name when spoken is "tilde ath", a pun on "til death." It is known to be insufferable to work with, despite its relative simplistic syntax. The language can only compile when using infinite loops. In the context of the story, it has the capability to import and change objects from a wide library, such as the author and the universe itself. This wide range, combined with the inability to interact with anything that has a short lifespan, leads to files being tied to long-term events, such as the deaths of characters and universes. ~ath is also sensitive to the color that the text is written in, and accepts unusual characters. One ~ath program shown in the story uses a command called bifurcate to split the program into red text and blue text. Another ~ath program contains a character that appears as an animated flickering billiard ball. ~ATH(THIS) { // ADDITIONAL GRAVES... } EXECUTE(NULL); THIS.DIE(); The ~ath code above is the simplest in the language, and any code deviating from the pattern does not compile. Cultural context of esolangsThe cultural context of esolangs has been studied by people like Geoff Cox, who writes that esolangs "shift attention from command and control toward cultural expression and refusal",[20] seeing esolangs as similar to code art and code poetry, such as Mez Breeze's mezangelle. Daniel Temkin describes brainfuck as "refusing to ease the boundary between human expression and assembly code and thereby taking us on a ludicrous journey of logic,"[21] exposing the inherent conflict between human thinking and computer logic. He connects programming within an esolang to performing an event score such as those of the Fluxus movement, where playing out the rules of the logic in code makes the point of view of the language clear.[22] References
Further reading
External links
|