셰익스피어 (프로그래밍 언어)

위키백과, 우리 모두의 백과사전.

셰익스피어 프로그래밍 언어(Shakespeare Programming Language, SPL)는 Jon Åslund와 Karl Hasselström이 만든 난해한 프로그래밍 언어이다. 소스 코드가 마치 윌리엄 셰익스피어의 연극처럼 보이도록 만들었다.

프로그램의 첫 부분에서 ‘로미오’나 ‘줄리엣’ 같은 스택을 등장 인물로 선언하고, 이 등장 인물들은 서로 대화하면서 다른 인물의 값을 조작하거나 push, pop 같은 연산을 수행한다. 조건문도 대화 형식으로 되어 있다. 전체 구성은 어셈블리어와 비슷하지만 소스 코드 분량은 훨씬 장황하다.

예제[편집]

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]

위의 내용은 Hello world 프로그램의 일부분으로, 전체 코드는 설명서 Archived 2021년 10월 31일 - 웨이백 머신에 있다.

외부 링크[편집]