관리 메뉴

IT 컴퓨터공학 자료실

Flow Control에 대해 본문

영어 번역 & 일본어 번역

Flow Control에 대해

윤맨1 2015. 7. 19. 21:09


 

In computer science, control flow (or alternatively, flow of control) refers to the specification of the order in which the individual statements, instructions or function calls of an imperative program are executed or evaluated. The emphasis on explicit control flow distinguishes an imperative programming language from a declarative programming language.

 

컴퓨터공학에서, 컨트롤 플로우는 (다르게 표현하면 flow of control라고도 한다.) 개별적인 statementinstruction, function call의 명령에 대한 명세를 언급하는 것이다. 분명한 컨트롤 플로우에 대한 강조는 서술적 프로그래밍 언어와 명령적 프로그래밍 언어와 구별한다.

 

Within an imperative programming language, a control flow statement is a statement whose execution results in a choice being made as to which of two or more paths should be followed. For non-strict functional languages, functions and language constructs exist to achieve the same result, but they are not necessarily called control flow statements.

 

명령적 프로그래밍 언어안에서는, 컨트롤 플로우 statement는 두 개 혹은 그이상의 경로가 흐르도록 만들어진 선택 안에서 실행된다. 반대로 서술적 프로그래밍 언어에서는 function과 언어는 같은 결과를 얻기 위해 설계되었으나, 컨트롤 플로우 statement라고 부를 필요는 없다.

The kinds of control flow statements supported by different languages vary, but can be categorized by their effect:

컨트롤 플로우 statement의 종류는 언어의 각기 다름에 차이에 따라 달라지나, 언어가 낳는 결과에 따라 카테고리화 시킬 수 있다:

 

continuation at a different statement (unconditional branch or jump),

다른 statement에서 계속됨

executing a set of statements only if some condition is met (choice - i.e., conditional branch),

어느 조건을 만나면 statement들을 실행함

executing a set of statements zero or more times, until some condition is met (i.e., loop - the same as conditional branch),

어느 조건을 만날 때까지 statement들을 실행함

executing a set of distant statements, after which the flow of control usually returns (subroutines, coroutines, and continuations),

플로우 컨트롤이 리턴된 후 statement들을 실행함

stopping the program, preventing any further execution (unconditional halt).

A set of statements is in turn generally structured as a block, which in addition to grouping also defines a lexical scope.

statement들이 차례로 대부분이 블록이 되어서, 어휘의 스코프로 정의되어 그룹 설정이 됨.

 

Interrupts and signals are low-level mechanisms that can alter the flow of control in a way similar to a subroutine, but usually occur as a response to some external stimulus or event (that can occur asynchronously), rather than execution of an 'in-line' control flow statement.

 

인터럽트와 시그널은 저수준 메커니즘으로 서브루틴과 비슷한 방법으로 컨트롤 플로우를 바꿀 수 있지만, 컨트롤 플로우를 인라인실행하지 않고 보통 외부자극이나 이벤트에 대해 반응을 일으킨다.

 

At the level of machine or assembly language, control flow instructions usually work by altering the program counter. For some CPUs the only control flow instructions available are conditional or unconditional branch instructions (also called jumps).

 

기계어나 어셈플리어 레벨에서는 보통, 컨트롤 플로우는 프로그램 카운터를 고쳐가면서 명령어를 수행한다. 일부 CPU들에 대해서는 컨트롤 플로우 명령어는 조건적이거나 무조건적인 브랜치 명령어 ( 점프라고 불리는) 들의 수행이 가능하다.



출처 : https://en.wikipedia.org/wiki/Control_flow