구글와이드(336x280)_상단 2개


Theory of Programming Languages IT 영문자료

Theory of Programming Languages

From Wikiversity

Jump to: navigation, search
Programming language is a set of special purpose language, which is used to instruct machines, to express the semantics of the algorythms, and controlling computerized devices. They were invented to make a generalized approach of making machines easier to use.
  • In difference of human languages they are: more formal, extremely logical, yet some of their constructs can be easily compared with those one of human languages.
  • Computer languages can be divided on low-level and high level languages. Low level languages are closer to machine languages.
    • Machine languages are the native languages of the computer hardware. They are just the string of electrical signals applied to the electronics inside the computers. Sometimes those signals are transferred to menemonics more understandable by humans.
    • higher level languages, feature a very logical languages-like interface to their "speakers" (i.e. programmers) They provide
      • readible notations
      • Machine Independence
      • Consistency checks during the detection of errors.
However they posess much more formalism, and less flexibility then human ones. Generally speaking, programming languages can be characterized as: Imperative, Object Oriented, Functional, and Logical.

Contents

[hide]

General Syntactic structure [edit]

Like programming languages letters form words, but words form statements not sentences. Programming languages have constructs which can be compared with parts of speech, as of human languages. They are rather variables/constants and functions over them.
  • The syntax of the languages tells how the program statements are built. And the semantic address the meaning of the language.
For example:
      • Dates can be written as follows: D denotes a digit of a day, M denotes a digit of a month, and Y denotes a digit of a year.
The American Format is MM/DD/YYYY, while the European Format is DD/MM/YYYY. In the American Format 07/17/2006 is July 17, 2006.
      • Let's study the different syntaxes of adding two integers: They can be
        • A + B
        • (+ A B)
        • AB+
        • ADD A to B
The semantics (meaning) are the same. However the different notations with different syntaxes are used.
        • Value1 OP VALUE2 is called an infix notation
        • OP VALUE1 VALUE2 is a prefix notation, where the operand stays first then Value 1 and Value 2 are listed.
        • VALUE1 VALUE2 Postfix Notation, which first list values and then states what to do this them
        • Sometimes it is a requirement to change the operand by a word.
The semantics of this structure can be represented by a tree.
   +
  / \
 a   b
The tree represents the placement of the operands and the operator, while the syntax is the order in which we traverse the tree. Following the tree structure in a normal fasion, the most obvious representation would be "(+ ((A) (B)))," or (by getting rid of useless parens), "+ A B." The reason for so many different syntaxes becomes apparent when abstracting to the linguistic terms of Verb, Subject, Object, and article/particle. Human languages exist using almost every possible gramatical structure: A + B (SVO: Arabic, Chinese or English), A B + (SOV: Chinese or Japanese), + A B (VSO: Arabic). I don't, however, have an example for a human or computer OSV, OVS, or VOS language.
This problem can be treated in more details studying langugage structure with regard of machine architecture

Imperative programming [edit]

The basic units of the imperative programming are actions. The actions make the values of the variables change as the program runs. Unlike computations, actions can occur. For example, lets look on assignment. x: = 3 + 4 the symbol ":=" is called an assignment. It appears between the variable x, and the "3+4" expression. ITs accosiated the x with the value of 7 wich is 3+4 and the older value of x is no longer valid.

static programs [edit]

flow control [edit]

Object Oriented Programming [edit]

Functional Programming [edit]

Logic Programming [edit]

The aim of logic programming is to focus not on giving commands to the computer, but rather on stating relationships between the objects of interest and letting the system derive results from these statements. The name of the discipline thus comes from the logical reasoning steps used to arrive at solutions.
Logic programs generally consist of a set of facts and rules that together express knowledge about some universe and ways to derive new knowledge. A computation is started by a user query; the logic programming system attempts to answer the query by applying rules to facts or the results of previously applied rules. Conceptually, the programmer need only represent relationships without caring for the exact way that results are derived.
A common first example of logic programming concerns family relationships. Consider a logic program (in the notation of the Prolog programming language) consisting of the following facts and rules:
female(alice).
male(bob).
male(clyde).
female(dora).

child_of(dora, clyde).
child_of(clyde, bob).
child_of(dora, alice).

father_of(F, P) :- male(F), child_of(P, F).
This program states some properties of and relationships between four people. The first seven lines are facts describing knowledge about these persons, the last line is a rule describing a way to derive new knowledge. The rule says the following: A person F is the father of a person P if F is male and P is a child of F. Note that this rule is completely general and independent of the concrete persons stated in the facts. The generality is achieved by using variables (symbols starting with a capital letter) that the system can bind to any object. In contrast, constants (symbols starting with a lowercase letter) represent a concrete unchangeable object.
The logic program can be used by passing queries to the logic programming system. For instance, to find out which persons X have Bob as their father, a Prolog system can be queried like this:
?- father_of(bob, X). 
The system will respond with the following answer:
X = clyde 
More general queries are also possible, for instance asking for all father-child pairs:
?- father_of(Father, Child).

Father = bob
Child = clyde ;

Father = clyde
Child = dora 
Logic programs involve symbolic computation, the system does not need information about 
the fact that Alice, Bob, etc. are persons—indeed it need not even be told 
that there is a concept called person. In most non-logical programming languages, 
such concepts (or types) would have to be defined before one could write programs 
processing information about persons.

Bibliography [edit]

Programming Languages, concepts and constructs by Ravi Sethi 1996

null



바보들의 영문법 카페(클릭!!)

오늘의 메모....

시사평론-정론직필 다음 카페
http://cafe.daum.net/sisa-1

바보들의 영문법 다음 카페
http://cafe.daum.net/babo-edu/

티스토리 내 블로그
http://earthly.tistory.com/

내 블로그에 있는 모든 글들과 자료에 대한 펌과 링크는 무제한 허용됩니다.
(단, 내 블로그에 덧글쓰기가 차단된 자들에게는 펌, 트랙백, 핑백 등이 일체 허용되지 않음.)

그리고 내 블로그 최근글 목록을 제목별로 보시려면....
바로 아래에 있는 이전글 목록의 최근달을 클릭하시면 됩니다.
그러면 제목을 보고 편하게 글을 골라 보실 수 있습니다.

그리고 내 블로그내 글을 검색하시려면 아래 검색버튼을 이용하시면 됩니다.


가가챗창

flag_Visitors

free counters