Language Translation Issues

Slides:



Advertisements
Similar presentations
Programming Language Concepts
Advertisements

Chapter 8 High-Level Programming Languages. 8-2 Chapter Goals Describe the translation process and distinguish between assembly, compilation, interpretation,
Programming Languages Marjan Sirjani 2 2. Language Design Issues Design to Run efficiently : early languages Easy to write correctly : new languages.
Chapter 2 Syntax. Syntax The syntax of a programming language specifies the structure of the language The lexical structure specifies how words can be.
UNIVERSITY OF SOUTH CAROLINA Department of Computer Science and Engineering CSCE 330 Programming Language Structures Ch.2: Syntax and Semantics Fall 2005.
ALGOL 60 Design by committee of computer scientists: Naur, Backus, Bauer, McCarthy, van Wijngaarden, Landin, etc. Design by committee of computer scientists:
PZ07B Programming Language design and Implementation -4th Edition Copyright©Prentice Hall, PZ07B - Basic statements Programming Language Design.
Chapter3: Language Translation issues
High-Level Programming Languages
Chapter 3 Program translation1 Chapt. 3 Language Translation Syntax and Semantics Translation phases Formal translation models.
Introduction and Syntax. Course objectives Discuss features of programming languages. Discuss how the features are implemented in a simple computer architecture.
Computer Science 101 Introduction to Programming.
Chapter 8 High-Level Programming Languages (modified by Erin Chambers)
High-Level Programming Languages: C++
1Object-Oriented Program Development Using C++ Computer Science and Programming Languages Computers are ubiquitous Computer literacy is essential Computer.
(1.1) COEN 171 Programming Languages Winter 2000 Ron Danielson.
1 Computing Software. Programming Style Programs that are not documented internally, while they may do what is requested, can be difficult to understand.
CS 326 Programming Languages, Concepts and Implementation Instructor: Mircea Nicolescu Lecture 2.
Programming Languages The Beginning. In the beginning... Computers were very expensive; programmers were cheap Programming was by plugboards or binary.
1 Introduction Programming Language Design and Implementation (4th Edition) by T. Pratt and M. Zelkowitz Prentice Hall, 2001 Sections
Computer Science 101 Introduction to Programming.
Chapter 8 High-Level Programming Languages. 8-2 Chapter Goals Describe the translation process and distinguish between assembly, compilation, interpretation,
C H A P T E R TWO Syntax and Semantic.
D. M. Akbar Hussain: Department of Software & Media Technology 1 Compiler is tool: which translate notations from one system to another, usually from source.
CPSC3111/CISM3111 COBOL Structured COBOL Programming Text: murach’s structured COBOL Authors: Murach, Prince, Menendez.
Fortran Fortran – Formula Translation –Developed by John Backus (IBM) in the mid 1950s. –It was a team effort and the design goal was to produce a translation.
Language Translation Issues Lecture 5: Dolores Zage.
Chapter 8 High-Level Programming Languages. 2 Chapter Goals Describe the translation process and distinguish between assembly, compilation, interpretation,
Language Translation Issues General Syntactic Criteria.
1-1 1 Introduction  Programming linguistics: concepts and paradigms syntax, semantics, and pragmatics language processors.  Historical development of.
Programming Language Concepts (CIS 635) Elsa L Gunter 4303 GITC NJIT,
Programming Languages Concepts Chapter 1: Programming Languages Concepts Lecture # 4.
FG Group -Afrilia BP -Liana F.B.I -Maulidatun Nisa -Riza Amini F.
Basic statements Programming Language Design and Implementation (4th Edition) by T. Pratt and M. Zelkowitz Prentice Hall, 2001 Section
a medium allowing humans and computers to communicate an abstraction of the real world a notation for expressing algorithms the set of all syntactically.
CSE3302 Programming Languages (notes continued)
Chapter 3 – Describing Syntax
Languages and Compilers (SProg og Oversættere)
Zuse’s Plankalkül – 1945 Never implemented Problems Zuse Solved
Concepts of Programming Languages
CS 326 Programming Languages, Concepts and Implementation
CSCI-235 Micro-Computer Applications
A Simple Syntax-Directed Translator
Representation, Syntax, Paradigms, Types
An Introduction to Programming
Programming in COBOL.
Some Important Programming Languages
Use of Mathematics using Technology (Maltlab)
Representation, Syntax, Paradigms, Types
CSCE 330 Programming Language Structures Ch.2: Syntax and Semantics
High Level Programming Languages
Representation, Syntax, Paradigms, Types
Low Level Programming Languages
Principles of Programming Languages
Overview of Programming Paradigms
Representation, Syntax, Paradigms, Types
강의 내용 및 방법 접근방법 리포트 시험 Lambda Calculus, Proof of Correctness
Language Translation Issues
An Introduction to Programming
School of Computer & Information Engineering,
Language Translation Issues
Language Translation Issues
Basic statements Programming Language Design and Implementation (4th Edition) by T. Pratt and M. Zelkowitz Prentice Hall, 2001 Section
Basic statements Programming Language Design and Implementation (4th Edition) by T. Pratt and M. Zelkowitz Prentice Hall, 2001 Section
PZ07B - Basic statements Programming Language Design and Implementation (4th Edition) by T. Pratt and M. Zelkowitz Prentice Hall, 2001 Section
Language Translation Issues
Basic statements Programming Language Design and Implementation (4th Edition) by T. Pratt and M. Zelkowitz Prentice Hall, 2001 Section
Faculty of Computer Science and Information System
Some Important Programming Languages
Presentation transcript:

Language Translation Issues General Syntactic Criteria

General Syntax : the arrangement of words as elements in a sentence to show their relationship Formal grammar  CFG, BNF Yacc Semantics : Understanding of what a program means The use of declaration, operations, sequence control, referencing environments

PL and syntax To provide a notation for communication between the programmer and the programming language processor Value of type real number ?? 변수이름: C, FORTRAN(naming convention) 실수상수 표현: normalization, 3.2e-12 값(하드웨어): IEEE 표준, IBM 표준… Readability, writeability, Ease of verifiability, Ease of translation, Lack of ambiguity

Readability Self-documenting Natural statement format Structured statements Liberal use of keywords and noise words Provision for embedded comments Unrestricted length identifiers Mnemonic operator symbols Free-field format Complete data declarations

예 Few different syntactic constructs : 너무 단순함, Readability를 떨어뜨릴 수 있음 APL, SNOBOL  only one statement format LISP  parentheses To emphasize readability : 너무 복잡함 Expense of ease of writing and translation COBOL

Writeability Concise and regular syntactic structure C  hard to read but very concise programs Implicit syntactic convention Redundant syntax ::: same item of syntax in more than one way ML ::: data type induction to derived the type of a function’s argument

Others Ease of verifiability Ease of translation Lack of ambiguity LSIP  simple to translate COBOL  extremely difficult (syntax) Lack of ambiguity If-statement Dangling else  (Algol), (C, Pascal), synchronization keyword(Ada, guarded command) A(I,J) in FORTRAN  function call ? Subroutine call  PASCAL A[I,J]  array, A(I,J)

Syntactic Elements of a Language I Character set :: ASCII  일반적 APL Input/Output Identifiers Operator symbols LISP  PLUS, TIMES FORTRAN  .EQ., **

Syntactic Elements of a Language II Keywords and reserved keywords FORTRAN  DO, IF ?? COBOL  too many reserved words Noise words COBOL  GO TO (‘TO’ is optional) Comments : /* … */, //(C), !(FORTRAN90), --(Ada) Blanks (white spaces) Have meaning in SNOBOL sometimes

Syntactic Elements of a Language III Delimiters and brackets Begin – end (brackets) Free- and fixed-field format FORTRAN …. Cards Expressions Basic syntactic block  C, … Basic sequence control  LISP, ML Statements SNOBOL – 오직 하나, COBOL – 각각 다르게

Subprogram structure I Separate subprogram structures  C Separate data definitions Data에 대한 모든 연산을 모음 :: class <- Java, C++, Smalltalk Nested subprogram definitions ALGOL, FORTAN, PASCAL  object oriented language가 나오면서 사라져감 Separate interface definitions FORTRAN  Pascal ::: C, ML, Ada  양쪽 장점 이용, 보완 (.h <-C, package <- Ada)

Subprogram structure II Data descriptions separated from executable statements COBOL ::: data division, procedure division, environment division Unseparated subprogram definitions Snobol4 ::: Lack of organization Basic

LISP 예제

COBOL 예제 WORKING-STORAGE SECTION. ************************************************************ *** 이 프로그램은 정보처리기사 실기 준비용으로 작성한 것임. IDENTIFICATION DIVISION. PROGRAM-ID. T98081101. ENVIRONMENT DIVISION. CONFIGURATION SECTION. SOURCE-COMPUTER. PC-586. OBJECT-COMPUTER. PC-586. INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT IN-F ASSIGN TO "0811AIN.DAT". SELECT OUT-F ASSIGN TO "0811AOUT.DAT". * ORGANIZATION IS LINE SEQUENTIAL. DATA DIVISION. FILE SECTION. FD IN-F. 01 IN-REC. 03 I-HAKBUN PIC X(7). 03 I-NAME PIC X(16). 03 I-SUNGJUK OCCURS 5. 05 I-KAMOK-CODE PIC X(1). 05 I-JUMSU PIC 9(3). 03 I-ETC PIC X(7). FD OUT-F. 01 OUT-REC. 03 O-HAKBUN PIC X(7). 03 O-NAME PIC X(16). 03 O-SUNGJUK OCCURS 5. 05 O-KAMOK-CODE PIC X(1). 05 O-JUMSU PIC 9(3). 03 O-SUM PIC 9(3). 03 O-AVE PIC 9(3). 03 O-ETC PIC X(7). WORKING-STORAGE SECTION. 77 SUNG-SUM PIC 9(3). 77 SUNG-AVE PIC 9(3). 77 II PIC 9(3). PROCEDURE DIVISION. SIJAK. OPEN INPUT IN-F OUTPUT OUT-F. READ-RTN. READ IN-F AT END GO TO END-RTN. MOVE I-HAKBUN TO O-HAKBUN. MOVE I-NAME TO O-NAME. MOVE I-ETC TO O-ETC. MOVE 0 TO SUNG-SUM. MOVE 0 TO SUNG-AVE. PERFORM MOVE-RTN VARYING II FROM 1 BY 1 UNTIL II > 5. PERFORM TOTAL-RTN VARYING II FROM 1 BY 1 UNTIL II > 5. DIVIDE SUNG-SUM BY 5 GIVING SUNG-AVE. MOVE SUNG-SUM TO O-SUM. MOVE SUNG-AVE TO O-AVE. DISPLAY OUT-REC. WRITE OUT-REC. GO TO READ-RTN. END-RTN. CLOSE IN-F OUT-F. STOP RUN. TOTAL-RTN. ADD I-JUMSU(II) TO SUNG-SUM. TOTAL. EXIT. MOVE-RTN. MOVE I-KAMOK-CODE(II) TO O-KAMOK-CODE(II). MOVE I-JUMSU(II) TO O-JUMSU(II). MOVERTN. EXIT.

SNOBOL 예제