Pseudocode

 

Wikipedia : Pseudocode : Pseudocode 는 어떤 특별한 프로그램과 관련된 표기를 사용하지 않고 알고리즘을 묘사하는 생성 방법이다. 컴퓨터 과학 교과서는 예제 속에 pseudocode 를 가끔 사용하는데, 그것은 똑같은 프로그램 언어를 알지 못하더라도 모든 프로그래머가 이해할 수 있도록 하기 위한 것이다.

다양한 스타일의 pseudocode 가 사용되고 있다. 가끔은 loop 같은 흔한 동작을 위해서 많이 쓰이는 언어 (C or Lisp) 의 문법을 사용하기도 하고, 자세한 것이 필요하지 않거나 혼란스러울 때는 영어 문장을 사용하기도 한다.

우리의 pseudocode 형식은 흔한 동작을 표현하기 위해 C 언어의 keyword 를 사용한다. Python 같은 것을 사용하여 loop 같은 것의 영역 (scope) 을 구분하기위해서 사용하기도 한다.

Example operations

Assignment:

<variable> = <expression>

Conditionals:

if <condition>
  do stuff
else
  do other stuff

Simple loops:

while <condition>
  do stuff

for <variable> from <first value> to <last value> by <step>
  do stuff with variable

Function calls:

<function>(<arguments>)

Function declarations:

function <function name>(<arguments>)
  do stuff with arguments
  return something (optional)

Variable declarations:

declare <variable-name> as <type>

Array declarations:

declare <array-name>[<lower-bound> to <upper-bound>] of <type>

Composite data structures (Object Oriented Programming):

struct <name_of_new_type>
  <declaration(s) of internal variables>

Accessing fields of a composite structure:

<structure variable name>.<field name>

This standard still needs work.