Language Translation Issues General Syntactic Criteria.

Slides:



Advertisements
Similar presentations
Programming Language Concepts
Advertisements

An Introduction to Programming General Concepts. What is a program? A program is an algorithm expressed in a programming language. programming language.
Chapter 8 High-Level Programming Languages. 8-2 Chapter Goals Describe the translation process and distinguish between assembly, compilation, interpretation,
Introduction to Programming Languages Nai-Wei Lin Department of Computer Science and Information Engineering National Chung Cheng University.
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
G Programming Languages G Walter Williams.
High-Level Programming Languages
Fall 2007CS 2251 Miscellaneous Topics Deque Recursion and Grammars.
Chapter 3 Program translation1 Chapt. 3 Language Translation Syntax and Semantics Translation phases Formal translation models.
Chapter 8 High-Level Programming Languages Nell Dale John Lewis.
Introduction and Syntax. Course objectives Discuss features of programming languages. Discuss how the features are implemented in a simple computer architecture.
G Programming Languages T he main themes of programming language design and use: –Model of computation –Expressiveness types and their operations.
Computer Science 101 Introduction to Programming.
Programming Languages
Chapter 2 Syntax A language that is simple to parse for the compiler is also simple to parse for the human programmer. N. Wirth.
Chapter 8 High-Level Programming Languages (modified by Erin Chambers)
High-Level Programming Languages: C++
Software II: Principles of Programming Languages
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
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.
Expressions and Statements. Expressions Literals and identifiers are expressions More complex expressions are built from simple expressions by the application.
Programming Languages Meeting 14 December 9/10, 2014.
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.
CPS 506 Comparative Programming Languages Syntax Specification.
Language Translation A programming language processor is any system that manipulates programs expressed in a PL A source program in some source language.
Structured COBOL Programming, Stern & Stern, 9th Edition CHAPTER 2 Cobol Language Fundamentals.
Chapter 8 High-Level Programming Languages. 2 Chapter Goals Describe the translation process and distinguish between assembly, compilation, interpretation,
IBM-Mainframes COBOL Class-1. Background and History  COBOL is an acronym for: Common Business Oriented Language  COBOL was developed in 1959 by the.
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,
Week 2/3 - 2nd Lecture Intro to COBOL Programming Defining Files and Processing Data.
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)
An Introduction to Programming
CSCE 330 Programming Language Structures Ch.2: Syntax and Semantics
High Level Programming Languages
Low Level Programming Languages
Language Translation Issues
Overview of Programming Paradigms
강의 내용 및 방법 접근방법 리포트 시험 Lambda Calculus, Proof of Correctness
Language Translation Issues
An Introduction to Programming
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
Types and Related Issues
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
Presentation transcript:

Language Translation Issues General Syntactic Criteria

2 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

3 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

4 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

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

6 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

7 Others  Ease of verifiability  Ease of translation –LISP  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)

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

9 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

10 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 – 각각 다르게

11 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)

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

13 LISP 예제

14 ************************************************************ *** 이 프로그램은 정보처리기사 실기 준비용으로 작성한 것임. ************************************************************ IDENTIFICATIONDIVISION. PROGRAM-ID.T ENVIRONMENT DIVISION. CONFIGURATION SECTION. SOURCE-COMPUTER.PC-586. OBJECT-COMPUTER.PC-586. INPUT-OUTPUTSECTION. FILE-CONTROL. SELECT IN-F ASSIGN TO "0811AIN.DAT". SELECT OUT-F ASSIGN TO "0811AOUT.DAT". * ORGANIZATION IS LINE SEQUENTIAL. DATADIVISION. FILESECTION. FD IN-F. 01 IN-REC. 03 I-HAKBUNPIC X(7). 03 I-NAMEPIC X(16). 03 I-SUNGJUKOCCURS I-KAMOK-CODEPIC 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 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. COBOL 예제

15 SNOBOL 예제