티스토리 뷰

세상에는 많은 프로그래밍 언어가 있습니다. FORTRAN이나 COBOL같은 고전적인 언어에서 시작해서 Pascal, C 같은 보편적인 명령형 언어나 SML, Haskell 같은 함수형 언어, Java, C++ 같은 객체지향 언어 등이 있습니다. 그렇지만 세상에는 이런 보편적이고 사용하기 쉬운 언어 이외에 매우 괴상하고 엽기적인 프로그래밍 언어들도 있습니다. 사용의 편의를 별로 고려하지 않고 특정한 목적을 갖고 만든 언어에서 시작해서, 극도의 불편함을 목표로 만든 프로그래밍 언어까지...

일주일 쯤 전에 선배와 대화하다가 우연히 알게 된 건데, 정말 괴상한 언어들 많더군요. 아래는 대표적인 것 몇 개를 나열해본 것입니다.



1) Brainfuck [Wikipedia]

이쪽 업계에서 가장 유명한 언어가 아닐까 싶습니다. FALSE라는 엽기적인 언어에 자극을 받아 Urban Müller가 1993년에 개발한 프로그래밍 언어로, 오직 <>[]+-., 이렇게 8개의 문자만으로 프로그래밍을 짜며 200 byte 이하라는 경이적인 컴파일러 용량을 자랑합니다. 각 문자의 용도는 다음과 같습니다.

> 	increment the pointer (to point to the next cell to the right).
< decrement the pointer (to point to the next cell to the left).
+ increment (increase by one) the byte at the pointer.
- decrement (decrease by one) the byte at the pointer.
. output the value of the byte at the pointer.
, accept one byte of input, storing its value in the byte at the pointer.
[ jump forward to the command after the corresponding ] if the byte at the pointer is zero.
] jump back to the command after the corresponding [ if the byte at the pointer is nonzero.


당연하게도(!), 이 언어는 Turing-completeness를 가집니다. C나 C++이 할 수 있는 짓을 이론상으로는 Brainfuck으로도 할 수 있다는 거죠. 심지어 후에 Jacob I. Torrey에 의해 파일 I/O와 네트워킹까지 가능하게 만든 Brainfuck++도 나왔습니다. 물론 이름에서도 알 수 있듯이 극악하게 어렵겠지만... 예를 들어서, 어느 프로그래밍 언어에서나 기본적으로 소개하는 "Hello World!" 를 프린트하는 프로그램을 Brainfuck으로 짜보면 다음과 같습니다. (출처: Brainfuck - Wikipedia)

++++++++++
[>+++++++>++++++++++>+++>+<<<<-] The initial loop to set up useful values in the array
>++. Print 'H'
>+. Print 'e'
+++++++. Print 'l'
. Print 'l'
+++. Print 'o'
>++. Print ' '
<<+++++++++++++++. Print 'W'
>. Print 'o'
+++. Print 'r'
------. Print 'l'
--------. Print 'd'
>+. Print '!'
>. Print newline


정말 뇌가 관광당하는(f**king) 기분이 듭니다. 이렇게 보면 Brainfuck은 이런 업계에서 가장 악명높은 언어가 아닌가 생각할 수 있겠지만, 이 프로그램의 아성을 깬 프로그램이 있었으니, 바로 다음 소개할 언어입니다.



2. Whitespace [Wikipedia]

대부분의 프로그래밍 언어는 공백을 보통 무시합니다. 이렇게 함으로써 가독성을 높이이는 등의 여러가지 혜택을 보죠. 여기에 반기를 들어, 스페이스, 탭, 엔터 이렇게 '화면에서 공백으로 보이는' 문자 세 개만을 사용하고 나머지 글자를 모두 무시하는 언어가 Edwin Brady와 Chris Morris에 의해 개발된 바로 이 Whitespace입니다. 공식(?) 홈페이지에 대충 Turing-complete하다는 증명이 있다고 하는데, 검토된 적은 없다고 하는군요. 어쨋든, 아래는 이 프로그래밍 언어로 짠 "Hello World!" 의 코드입니다. 코드를 보여주기 위해서, 스페이스와 탭에 각각 분홍색과 연두색이 칠해져 있습니다.

   
   	  	   
		    	
   		  	 	
		    	 
   		 		  
		    		
   		 		  
		    
	  
   		 				
		    	 	
   	 		  
		    		 
   	     
		    			
   			 			
		  
  	   
   		 				
		    	  	
   			  	 
		    	 	 
   		 		  
		    	 		
   		  
	  
		    		  
   	    	
		    		 	
   		 	
		    			 
   	 	 
		    				
    
	
	     
empty-line
    	
empty-line
 			 
empty-line
	  	 
	
     	
	   
empty-line
  	
empty-line
   	 
empty-line
empty-line/EOF



... ㄱ-;;



3. Bifunge [Wikipedia]

대부분의 프로그래밍 언어가 1차원적인 직선 방향을 따라서 읽어가는 반면, 이 프로그램은 2차원 프로그래밍이 가능합니다. Chris Pressey가 93년 개발한 언어로, 컴파일러를 만들기 더럽게 어렵도록 설계된 언어였지만 (변태자식...), 그럼에도 불구하고 여러가지 컴파일러가 개발되었습니다. 이 때의 버전을 Bifunge-93 이라고 부르며, 그 뒤에 여러가지 변형 버전(Bifunge-98 등)이 만들어졌습니다.

이 언어는 > < ^ v 이렇게 네 개의 명령어로 읽는 순서를 샤바샤바 바꿔가면서 프로그래밍을 할 수 있습니다. 예를 들어서 "Hello World!" 프로그램

>              v
v ,,,,,"Hello"<
>48*, v
v,,,,,,"World!"<
>25*,@


에서는 데이터가 먼저 Hello로 읽히지 않고 olleH 로 읽힌 후, 뒤의 코드들에 의해 순서가 뒤집힙니다. 그리고 다른 프로그래밍 언어와 달리, 이 언어는 모든 글자 하나하나가 다 읽히기 때문에 코멘트라는 개념이 따로 없습니다. 그러므로 적당히 읽는 방향을 조절하여 '읽히지 않는 부분'을 만든 후에 거기에다가 코멘트를 써넣어야 합니다. 이건 이거 나름대로 좀 엽기적이죠. -_-;;



4. Shakespeare [Wikipedia]

Jon Åslund and Karl Hasselström가 개발한 언어로, 프로그래밍 코드가 마치 한 편의 쉐익스피어 연극 대본처럼 보이도록 만든 프로그래밍 언어입니다. 코멘트를 적절히 이용하여 정말로 그럴듯하게 보이는 것이 이 프로그래밍 코드를 잘 짜는 방법이라고 하는군요. 아래는 "Hello World!" 를 포함하는 프로그램 코드입니다.

Romeo, a young man with a remarkable patience.
Juliet, a likewise young woman of remarkable grace.
Ophelia, a remarkable woman much in dispute with Hamlet.
Hamlet, the flatterer of Andersen Insulting A/S.

Act I: Hamlet's insults and flattery.
Scene I: The insulting of Romeo.
[Enter Hamlet and Romeo]
Hamlet:
You lying stupid fatherless big smelly half-witted coward! You are as
stupid as the difference between a handsome rich brave hero and thyself!
Speak your mind!
You are as brave as the sum of your fat little stuffed misused dusty
old rotten codpiece and a beautiful fair warm peaceful sunny summer's
day. You are as healthy as the difference between the sum of the
sweetest reddest rose and my father and yourself! Speak your mind!
You are as cowardly as the sum of yourself and the difference
between a big mighty proud kingdom and a horse. Speak your mind.
Speak your mind!
[Exit Romeo]
Scene II: The praising of Juliet.
[Enter Juliet]
Hamlet:
Thou art as sweet as the sum of the sum of Romeo and his horse and his
black cat! Speak thy mind!
[Exit Juliet]
Scene III: The praising of Ophelia.
[Enter Ophelia]
Hamlet:
Thou art as lovely as the product of a large rural town and my amazing
bottomless embroidered purse. Speak thy mind!
Thou art as loving as the product of the bluest clearest sweetest sky
and the sum of a squirrel and a white horse. Thou art as beautiful as
the difference between Juliet and thyself. Speak thy mind!
[Exeunt Ophelia and Hamlet]

Act II: Behind Hamlet's back.
Scene I: Romeo and Juliet's conversation.
[Enter Romeo and Juliet]
Romeo:
Speak your mind. You are as worried as the sum of yourself and the
difference between my small smooth hamster and my nose. Speak your
mind!
Juliet:
Speak YOUR mind! You are as bad as Hamlet! You are as small as the
difference between the square of the difference between my little pony
and your big hairy hound and the cube of your sorry little
codpiece. Speak your mind!
[Exit Romeo]
Scene II: Juliet and Ophelia's conversation.
[Enter Ophelia]
Juliet:
Thou art as good as the quotient between Romeo and the sum of a small
furry animal and a leech. Speak your mind!
Ophelia:
Thou art as disgusting as the quotient between Romeo and twice the
difference between a mistletoe and an oozing infected blister! Speak
your mind!
[Exeunt]


이것과 비슷한 프로그래밍 언어로 Chef가 있는데, 이 언어는 프로그래밍 코드가 마치 요리책의 조리설명서와 같도록 개발된 언어입니다.







그 외에도 엽기적인 언어가 많습니다. 관심있는 분들은 [여기]를 참조하세요 -ㅁ-

개인적으로는 Brainfuck을 배워보고 싶군요 -3-;;
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
«   2024/04   »
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30
글 보관함