아이콘 (프로그래밍 언어)

아이콘(Icon)은 프로그래밍 언어이다. 문자열 처리에 강점을 가지고 있다.

예제 편집

다음 예제는 문자열의 각 단어를 하나씩 출력한다.

 s := "this is a string"
 s ? {                               # Establish string scanning environment
     while not pos(0) do  {          # Test for end of string
         tab(many(' '))              # Skip past any blanks
         word := tab(upto(' ') | 0)  # the next word is up to the next blank -or- the end of the line
         write(word)                 # write the word
     }
  }

유니콘 언어 편집

아이콘 자체는 객체지향 언어가 아니다. 1996년에 객체지향개념을 포함한 아이콘의 변형 아이돌(idol) 언어를 만들었고, 지금은 유니콘(Unicon)으로 이름을 바꾸었다.

클래스 정의 문법은 다음과 같다.

package packagename

class classname : superclass(attributes)
   method meth1(att1)
       ...
       end

   method meth2(att1,att2)
      ...
      end

   initially (att1,att3)
      ...
end

외부 링크 편집