말붕이들중에 자바나 C언어같은 프로그래밍언어로 프로그램 만든다는거 모르는사람 없지?FIM++ 는 마이리틀포니 팬들이 만든 객체 지향 프로그래밍 언어임.
<img class='fr-dii _img_light_gallery cursor_pointer' src='https://cdn.imweb.me/upload/S2017092059c20823b72c3/9fffdb892f160.png' data-src='https://cdn.imweb.me/upload/S2017092059c20823b72c3/9fffdb892f160.png' style='box-sizing: border-box; vertical-align: bottom; cursor: pointer; relative; max-width: calc(100% - 10px); display: inline-block; float: none; margin: 5px 0px; left: auto; height: auto !important;'>(Hello World 를 출력하는 코드)
FIM++의 특징은 소스코드가 편지의 형식을 띄고 있다는거다.시즌 초기에 트와일라잇이랑 친구들이 그날 배운거를 셀레스티아한테 편지로 보내지 않냐그거 패러디임(https://docs.google.com/document/d/1gU-ZROmZu0Xitw_pfC1ktCDvJH5rM85TxxQf5pg_xmg/edit?pli=1 에서 FIM++의 문법을 볼 수 있음)
FIM++는 위에서 말했듯 편지의 형식을 띄고있어서 그냥 읽어도 될정도로 직관성이 뛰어남. 프로그래밍 언어에 대해서 약간의 지식만 있어도 소스코드를 해독할 수 있어.기본적인 문법을 알려줄테니 위 코드를 해독해 보자.
클래스는 "Dear"이라는 해더로 시작된다. 그리고 그 뒤에 클래스가 따라오는데, 이름을 지어주면 됨. 굳이 셀레스티아 말고도 다른거 해도 된다.클래스를 끝낼때는 "Your faithful student, +프로그래머가 선택한 별명"으로 끝냄
함수는 "I learned"로 시작하고, 그 뒤에 함수의 이름을 적음. 함수를 끝낼 때는 "That's all about"을 쓴 뒤 다시 함수명을 적음. 메인함수는 "Today"를 "I learned"앞에 적어서 나타낼 수 있다. 이것만 알아도 위 짤의 코드를 이해하는데에는 무리가 없음. 번역해서 써주자면셀레스티아 공주님께: Hello World!
오늘 저는 Hello world!를 말하는 법을 배웠습니다.전 "Hello World!" 라고 말했어요이게 Hello World!를 말하는 법에 대한 거예요!
당신의 충실한 제자, Kyli Rouge.
라는 뜻이다.FIM++의 특징은 이걸로 끝나지 않음위에서 말했듯 FIM++는 편지의 형식을 충실히 따르기때문에글을 자연스럽게 읽히게 하기 위해서 문법적으로는 기능이 같지만 형태는 다른게 있음.윗 짤의 "I said"라고 써져있는거 보이지? 저게 출력을 하는 코드임. C언어로 치면 printf 말이야.근데 "I said"말고도 "I wrote", "I Sang"으로도 출력이 된다. 때문에 같은 문법을 입력해도 어색하게 읽히지가 않아이것말도고 "If"의 기능을 하는게 If 랑 When으로 두가지 있는 등...여러 예시가 있어
이번엔 좀 더 어려운 코드를 읽어보자. 어렵다고 말은 했지만 직관성이 뛰어나서 이해하기엔 무리가 없을거야.Dear Princess Celestia: Numbers are fun! (클래스 시작, 이름을 지음) Today I learned some math. (매소드 시작, 프로그램 구동시 첫번째 파트) I wrote the sum of everything from 1 to 100 ("the sum of all the nuvers from 1 to 100" 매소드 실행, 리턴 값 프린트) That's all about some math. (프로그램이 구동을 마침) I learned the sum of everything from 1 to 100 to get a number. (새 매소드 시작) Did you know that the sum was the number 0? (새 변수를 선언하고, "the sum'으로 이름을 지어 숫자 변수로 만들고, 초기값을 0으로 설정) Did you know that the current count was the number 0? ("the current count"라는 새 숫자 변수를 선언하고, 초기값을 0으로 설정) As long as the current count was no more than 100: (조건문을 "the current count"가 100보다 작거나 같을 때 까지 반복하도록 설정 및 조건문 시작) I would add the current count to the sum. ("the current count"를 "the sum"에 더함) the current count got one more. ("the current count"는 1씩 증가) That’s what I did. (반복을 끝냄) Then you get the sum! ("the sum" 값을 받음) That’s all about the sum of everything from 1 to 100. (매소드 끝냄) Your faithful student, Kyli Rouge. (클래스를 끝내고, 자신의 이름을 적음)
1부터 100까지 더해주는 코드임. 각주는 넣었지만 영어는 굳이 번역 안할게. 이정도 영어는 다들 해석 가능하지?조건문과 반복문을 알고있으면 이게 어떤 원리로 돌아가는지도 파악할수있을거다
글은 99병의 맥주를 출력하는 코드로 마무리함. 이번엔 각주 없으니까 직접 해석해Dear Princess Celestia: Letter One.
Today I learned how to sing Applejack's Drinking Song.
Did you know that Applejack likes the number 99?
As long as Applejack had more than 1…I sang Applejack" jugs of cider on the wall, "Applejack" jugs of cider,".Applejack got one less. (Jug of cider)
When Applejack had more than 1… (Jugs of cider)I sang "Take one down and pass it around, "Applejack" jugs of cider on the wall.".
Otherwise: If Applejack had 1… (Jug of cider)I sang "Take one down and pass it around, 1 jug of cider on the wall.1 jug of cider on the wall, 1 jug of cider.Take one down and pass it around, no more jugs of cider on the wall.".
Otherwise…I sang "No more jugs of cider on the wall, no more jugs of cider.Go to the store and buy some more, 99 jugs of cider on the wall.".That's what I would do, That’s what I did.
That's all about how to sing Applejack's Drinking Song!
가독성 미쳐버리고 - dc App
유명했던 esolang인건 알겠는데 가독성도 난해하게 글 쓰셨네