Teknik Kompilasi I TEKNIK KOMPILASI. Ernastuti & Sulistyo 1/45. Ernastuti & Sulistyo

Similar documents
03 - Lexical Analysis

Programming Languages

Compiler I: Syntax Analysis Human Thought

Advanced compiler construction. General course information. Teacher & assistant. Course goals. Evaluation. Grading scheme. Michel Schinz

Chapter 1. Dr. Chris Irwin Davis Phone: (972) Office: ECSS CS-4337 Organization of Programming Languages

Programming Languages

1/20/2016 INTRODUCTION

Compilers. Introduction to Compilers. Lecture 1. Spring term. Mick O Donnell: michael.odonnell@uam.es Alfonso Ortega: alfonso.ortega@uam.

Parsing Technology and its role in Legacy Modernization. A Metaware White Paper

How to make the computer understand? Lecture 15: Putting it all together. Example (Output assembly code) Example (input program) Anatomy of a Computer

Language Evaluation Criteria. Evaluation Criteria: Readability. Evaluation Criteria: Writability. ICOM 4036 Programming Languages

Lab Experience 17. Programming Language Translation

CSCI 3136 Principles of Programming Languages

Lecture 9. Semantic Analysis Scoping and Symbol Table

n Introduction n Art of programming language design n Programming language spectrum n Why study programming languages? n Overview of compilation

1 Introduction. 2 An Interpreter. 2.1 Handling Source Code

CA Compiler Construction

Introduction. Compiler Design CSE 504. Overview. Programming problems are easier to solve in high-level languages

Language Processing Systems

1. Overview of the Java Language

Topics. Introduction. Java History CS 146. Introduction to Programming and Algorithms Module 1. Module Objectives

Semantic Analysis: Types and Type Checking

TRANSFORMATION-ORIENTED MIDDLEWARE FOR LEGACY SYSTEM INTEGRATION

Compiler Construction

CS / IT B.E. VII Semester Examination, December 2013 Cloud Computing Time : Three Hours Maximum Marks : 70

Chapter 13 Computer Programs and Programming Languages. Discovering Computers Your Interactive Guide to the Digital World

COMP 356 Programming Language Structures Notes for Chapter 4 of Concepts of Programming Languages Scanning and Parsing

Programming Languages

Scoping (Readings 7.1,7.4,7.6) Parameter passing methods (7.5) Building symbol tables (7.6)

Chapter 6: Programming Languages

C Compiler Targeting the Java Virtual Machine

Interpreters and virtual machines. Interpreters. Interpreters. Why interpreters? Tree-based interpreters. Text-based interpreters

Introduction to formal semantics -

Principles of Programming Languages Topic: Introduction Professor Louis Steinberg

KS3 Computing Group 1 Programme of Study hours per week

Bitemporal Extensions to Non-temporal RDBMS in Distributed Environment

COMPUTER SCIENCE TRIPOS

Compiler Construction

Lecture 1: Introduction

Programming Assignment II Due Date: See online CISC 672 schedule Individual Assignment

How To Understand Programming Languages And Programming Languages

ANT COLONY OPTIMIZATION (ACO) ALGORITHM FOR CNC ROUTE PROBLEM WAN NUR FARHANAR BT WAN ZAKARTA

Scanning and parsing. Topics. Announcements Pick a partner by Monday Makeup lecture will be on Monday August 29th at 3pm

HELP DESK SYSTEM IZZAT HAFIFI BIN AHMAD ARIZA

The previous chapter provided a definition of the semantics of a programming

Structure of Presentation. The Role of Programming in Informatics Curricula. Concepts of Informatics 2. Concepts of Informatics 1

DEVELOP AND DESIGN SHEMATIC DIAGRAM AND MECHANISM ON ONE SEATER DRAG BUGGY MUHAMMAD IBRAHIM B MD NUJID

Programming Project 1: Lexical Analyzer (Scanner)

Implementing Programming Languages. Aarne Ranta

Introduction to Automata Theory. Reading: Chapter 1

Massachusetts Institute of Technology Department of Electrical Engineering and Computer Science

FTP client Selection and Programming

Parrot in a Nutshell. Dan Sugalski dan@sidhe.org. Parrot in a nutshell 1

2 Introduction to Java. Introduction to Programming 1 1

Chapter 13: Program Development and Programming Languages

Car Rental Management System (CRMS) Lee Chen Yong

Java vs. Java Script

2. Advance Certificate Course in Information Technology

Artificial Intelligence. Class: 3 rd

Lexical Analysis and Scanning. Honors Compilers Feb 5 th 2001 Robert Dewar

Datavetenskapligt Program (kandidat) Computer Science Programme (master)

Richard Victor Ginting 1, Muhammad Kurniawan 2 1,2

University of Toronto Department of Electrical and Computer Engineering. Midterm Examination. CSC467 Compilers and Interpreters Fall Semester, 2005

02 B The Java Virtual Machine

PROG0101 Fundamentals of Programming PROG0101 FUNDAMENTALS OF PROGRAMMING. Chapter 3 Algorithms

A TOOL FOR DATA STRUCTURE VISUALIZATION AND USER-DEFINED ALGORITHM ANIMATION

Introduction to programming

Optimization of SQL Queries in Main-Memory Databases

PRODUCTIVITY IMPROVEMENT VIA SIMULATION METHOD (MANUFACTURING INDUSTRY) HASBULLAH BIN MAT ISA

Acknowledgements. In the name of Allah, the Merciful, the Compassionate

Human Ingenuity / How has the global trade influenced a person's and a community's life?

INTRODUCTION TO JAVA PROGRAMMING LANGUAGE

CS 51 Intro to CS. Art Lee. September 2, 2014

Compiler and Language Processing Tools

Chapter 2: Elements of Java

ao consult Basic Experience: Must have 7 years of experience in the development and maintenance of database systems.

Module: Software Instruction Scheduling Part I

Teori Himpunan. Bagian III

Effective Java Programming. efficient software development

A STUDY ON MOTIVATION TO START UP A BUSINESS AMONG CHINESE ENTREPRENEURS

CS 40 Computing for the Web

Design Patterns in Parsing

Parsing Expression Grammar as a Primitive Recursive-Descent Parser with Backtracking

Managing Variability in Software Architectures 1 Felix Bachmann*

Static vs. Dynamic. Lecture 10: Static Semantics Overview 1. Typical Semantic Errors: Java, C++ Typical Tasks of the Semantic Analyzer

1. Process Modeling. Process Modeling (Cont.) Content. Chapter 7 Structuring System Process Requirements

Application Architectures

6-1. Process Modeling

RFID BASED SYSTEMATIC STUDENT S ATTENDANCE MANAGEMENT SYSTEM HANISAH BINTI HAMID. Faculty of Electrical and Electronic Engineering

ATSBA: Advanced Technologies Supporting Business Areas. Programming with Java. 1 Overview and Introduction

Algorithm & Flowchart & Pseudo code. Staff Incharge: S.Sasirekha

Lexical analysis FORMAL LANGUAGES AND COMPILERS. Floriano Scioscia. Formal Languages and Compilers A.Y. 2015/2016

CS 3530 Operating Systems. L02 OS Intro Part 1 Dr. Ken Hoganson

DVD COVERS: A STUDY OF SEMIOTIC. I Putu Agus Tira Andika. Non-regular Program English Department Faculty of Letters and Culture Udayana.

Programming Languages CIS 443

Panduan Program Power Led

Fachbereich Informatik und Elektrotechnik SunSPOT. Ubiquitous Computing. Ubiquitous Computing, Helmut Dispert

COMPARATIVE STUDY OF ERP IMPLEMENTATION METHODOLOGY CASE STUDY: ACCELERATED SAP VS DANTES & HASIBUAN METHODOLOGY

Machine-Code Generation for Functions

Transcription:

TEKNIK KOMPILASI 1/45

2/45

MATERI Teknik Kompilasi I 3/45

ARTI KATA TEKNIK KOMPILASI 4/45

TRANSLATOR: COMPILER & INTERPRETER 5/45

COMPILER & INTERPRETER 6/45

COMPILER Teknik Kompilasi I 7/45

KENAPA PERLU TRANSLATOR? 8/45

LATAR BELAKANG 9/45

Bagaimana dengan orang yang tidak mengerti bahasa mesin? 10/45

11/45

12/45

13/45

BAHASA TINGKAT TINGGI Pemrograman bisa menggunakan Bahasa Tingkat Tinggi. 14/45

Bahasa Tingkat Tinggi adalah: 15/45

16/45

Jenis Translator: ASSEMBLER 17/45

Jenis Translator: COMPILER 18/45

Jenis Translator: Interpreter 19/45

Why study compilers? Most CS students do not go on to write a commercial compiler someday, but that's not why we study compilers. We study compiler construction for the following reasons: Writing a compiler gives experience with large-scale applications development. Your compiler program may be the largest program you write as a student. Experience working with really big data structures and complex interactions between algorithms will help you out on your next big programming project. Compiler writing is one of the shining triumphs of CS theory. It demonstrates the value of theory over the impulse to just "hack up" a solution. Compiler writing is a basic element of programming language research. Many language researchers write compilers for the languages they design. Many applications have similar properties to one or more phases of a compiler, and compiler expertise and tools can help an application programmer working on other projects besides compilers. 20/45

There is no software development method for writing large programs that doesn't involve pain: pain is inevitable in software development (Berry's Theorem). There is no way to learn the skills necessary for writing big programs without pain. A good CS course includes pain, and teaches pain management and minimization. The questions we should ask, then, are: (a) should CS majors be required to spend a lot of time becoming really good programmers? (b) are we providing students with the assistance and access to the tools and information they need to accomplish their goals with the minimal doses of inevitable pain that are required? 21/45

What Are They and What Kinds of Compilers are Out There? The purpose of a compiler is: to translate a program in some language (the source language) into a lower-level language (the target language). The compiler itself is written in some language, called the implementation language. To write a compiler you have to be very good at programming in the implementation language, and have to think about and understand the source language and target language. 22/45

Several major kinds of compilers Native Code Compiler Translates source code into hardware (assembly or machine code) instructions. Example: gcc. Virtual Machine Compiler Translates source code into an abstract machine code, for execution by a virtual machine interpreter. Example: javac. JIT Compiler Translates virtual machine code to native code. Operates within a virtual machine. Example: Sun's HotSpot java machine. Preprocessor Translates source code into simpler or slightly lower level source code, for compilation by another compiler. Examples: cpp, m4. Pure interpreter Executes source code on the fly, without generating machine code. Example: Lisp. 23/45

Phases of a Compiler Lexical Analysis: Converts a sequence of characters into words, or tokens Syntax Analysis: Converts a sequence of tokens into a parse tree Semantic Analysis: Manipulates parse tree to verify symbol and type information Intermediate Code Generation: Converts parse tree into a sequence of intermediate code instructions Optimization: Manipulates intermediate code to produce a more efficient program Final Code Generation: Translates intermediate code into final (machine/assembly) code 24/45

Blok Diagram Program Sumber Program Sasaran Penganalisa Leksikal (scanner) ANALISA Penganalisa Sintaks (parser) Penganalisa Semantik Pembangkit Kode antara Pembentuk kode SINTESA Pengoptimal kode TABEL SIMBOL Bagan pokok proses kompilasi 25/45

26/45

27/45

28/45

Contoh Source Program ke dalam Kode Mesin: 29/45

Contoh Source Program ke dalam Kode Mesin 30/45

Konsep dan Notasi Bahasa 31/45

Konsep dan Notasi Bahasa 32/45

Konsep dan Notasi Bahasa 33/45

Contoh Tata Bahasa Sederhana 34/45

Tabel Aturan Produksi 35/45

Hirarki CHOMSKY 36/45

37/45

ATURAN PRODUKSI 38/45

39/45

DIAGRAM STATE Teknik Kompilasi I 40/45

Notasi BNF (Backus Normal Form) 41/45

DIAGRAM SYNTAX 42/45

DIAGRAM SYNTAX 43/45

Kualitas dari Compiler: 44/45

Lanjut ke TEKNIK KOMPILASI II.ppt 45/45