) y + 1 * => square ( January 31, 2005MacrosClaus Brabrand y + 1 Widespread … ……… … ……... Dylan Dylan Macro Mechamism M4 Unix Macro Preprocessor L A T.

Slides:



Advertisements
Similar presentations
Programming Languages Third Edition Chapter 6 Syntax.
Advertisements

Software & Services Group, Developer Products Division Copyright© 2010, Intel Corporation. All rights reserved. *Other brands and names are the property.
Introduction To Compilers And Phase 1 Inside a compiler. Inside a C-- compiler. The compilation process. Example C-- code. Extended Backus-Naur.
Principles of programming languages 1: Introduction (with a simple language) Isao Sasano Department of Information Science and Engineering.
Prof Fateman CS 164 Lecture 371 Review: Programming Languages and Compilers CS AM MWF 10 Evans.
Fall Semantics Juan Carlos Guzmán CS 3123 Programming Languages Concepts Southern Polytechnic State University.
Unified Modeling Language
CPSC Compiler Tutorial 9 Review of Compiler.
By Neng-Fa Zhou Compiler Construction CIS 707 Prof. Neng-Fa Zhou
Lecture 01 - Introduction Eran Yahav 1. 2 Who? Eran Yahav Taub 734 Tel: Monday 13:30-14:30
C. Varela; Adapted w/permission from S. Haridi and P. Van Roy1 Declarative Computation Model Defining practical programming languages Carlos Varela RPI.
1/18 CS 693/793 Lecture 09 Special Topics in Domain Specific Languages CS 693/793-1C Spring 2004 Mo, We, Fr 10:10 – 11:00 CH 430.
Maya: Multiple-Dispatch Syntax Extension in Java Jason Baker and Wilson C. Hsieh University of Utah.
Compilation 2007 Domain-Specific Languages Syntax Extensions Michael I. Schwartzbach BRICS, University of Aarhus.
Compiler Design Lexical Analysis Syntactical Analysis Semantic Analysis Optimization Code Generation.
May 14, 2002 Macro Languages AoPL, S'02 Macro Languages Claus Brabrand Michael I. Schwartzbach BRICS, University of Aarhus, Denmark.
Maya: Multiple-Dispatch Syntax Extension in Java Jason Baker and Wilson C. Hsieh University of Utah.
Introduction & Overview CS4533 from Cooper & Torczon.
Generative Programming. Generic vs Generative Generic Programming focuses on representing families of domain concepts Generic Programming focuses on representing.
Lecture 2 Phases of Compiler. Preprocessors, Compilers, Assemblers, and Linkers Preprocessor Compiler Assembler Linker Skeletal Source Program Source.
CSE 425: Intro to Programming Languages and their Design A Few Key Ideas No particular language is a prerequisite for this course –However you should be.
The College of Saint Rose CIS 433 – Programming Languages David Goldschmidt, Ph.D. from Concepts of Programming Languages, 9th edition by Robert W. Sebesta,
2.2 A Simple Syntax-Directed Translator Syntax-Directed Translation 2.4 Parsing 2.5 A Translator for Simple Expressions 2.6 Lexical Analysis.
Course Revision Contents  Compilers  Compilers Vs Interpreters  Structure of Compiler  Compilation Phases  Compiler Construction Tools  A Simple.
CS 355 – Programming Languages
(1.1) COEN 171 Programming Languages Winter 2000 Ron Danielson.
Compiler1 Chapter V: Compiler Overview: r To study the design and operation of compiler for high-level programming languages. r Contents m Basic compiler.
Chapter 1 Introduction Dr. Frank Lee. 1.1 Why Study Compiler? To write more efficient code in a high-level language To provide solid foundation in parsing.
CISC 471 First Exam Review Game Questions. Overview 1 Draw the standard phases of a compiler for compiling a high level language to machine code, showing.
CST320 - Lec 11 Why study compilers? n n Ties lots of things you know together: –Theory (finite automata, grammars) –Data structures –Modularization –Utilization.
1 COMP 3438 – Part II-Lecture 1: Overview of Compiler Design Dr. Zili Shao Department of Computing The Hong Kong Polytechnic Univ.
Copyright © 2007 Addison-Wesley. All rights reserved.1-1 Reasons for Studying Concepts of Programming Languages Increased ability to express ideas Improved.
COMPILER OVERVIEW. Compiler Phases  Syntactic Analysis (Lexing, Parsing)  c = (a + b) * (a + b);
1.  10% Assignments/ class participation  10% Pop Quizzes  05% Attendance  25% Mid Term  50% Final Term 2.
BUILD ON THE POLYGLOT COMPILER FRAMEWORK MIHAL BRUMBULLI 7th Workshop “SEERE” Montenegro-Risan 9-14 September 2007 SimJ Programming Language.
Parse & Syntax Trees Syntax & Semantic Errors Mini-Lecture.
ProgrammingLanguages Programming Languages Language Definition, Translation and Design.
Computer Engineering Rabie A. Ramadan Lecture 5.
CPS 506 Comparative Programming Languages Syntax Specification.
1. 2 Preface In the time since the 1986 edition of this book, the world of compiler design has changed significantly 3.
Daisy Arias Math 382/Lab November 16, 2010 Fall 2010.
Introduction to Compilers. Related Area Programming languages Machine architecture Language theory Algorithms Data structures Operating systems Software.
Topic #1: Introduction EE 456 – Compiling Techniques Prof. Carl Sable Fall 2003.
3.2 Semantics. 2 Semantics Attribute Grammars The Meanings of Programs: Semantics Sebesta Chapter 3.
Compiler Introduction 1 Kavita Patel. Outlines 2  1.1 What Do Compilers Do?  1.2 The Structure of a Compiler  1.3 Compilation Process  1.4 Phases.
1 Compiler & its Phases Krishan Kumar Asstt. Prof. (CSE) BPRCE, Gohana.
1 A Simple Syntax-Directed Translator CS308 Compiler Theory.
Compiler Construction CPCS302 Dr. Manal Abdulaziz.
CSC 4181 Compiler Construction
1 Asstt. Prof Navjot Kaur Computer Dept PRESENTED BY.
ICS312 Introduction to Compilers Set 23. What is a Compiler? A compiler is software (a program) that translates a high-level programming language to machine.
CS 404Ahmed Ezzat 1 CS 404 Introduction to Compiler Design Lecture 1 Ahmed Ezzat.
Programming Languages Concepts Chapter 1: Programming Languages Concepts Lecture # 4.
Chapter 3 – Describing Syntax CSCE 343. Syntax vs. Semantics Syntax: The form or structure of the expressions, statements, and program units. Semantics:
Reasoning about Hygienic Macros David Herman Northeastern University
Concepts of Programming Languages Lecturer: Dr. Emad Nabil Lecture # 2.
Compiler Summary Lexical analysis—scanner – String of characters  token – Finite automata. Syntactical analysis – parser – Sequence of tokens –> language.
PEPM 2002 Growing Languages with Metamorphic Syntax Macros January 14, 2002 Growing Languages with Metamorphic Syntax Macros Claus Brabrand Michael Schwartzbach.
Compilers Principles, Techniques, & Tools Taught by Jing Zhang
Advanced Computer Systems
Chapter 1 Introduction.
Language Translation Compilation vs. interpretation.
Information Science and Engineering
Chapter 1 Introduction.
Compiler Lecture 1 CS510.
CSE401 Introduction to Compiler Construction
Compilers B V Sai Aravind (11CS10008).
High-Level Programming Language
Compilers Principles, Techniques, & Tools Taught by Jing Zhang
Faculty of Computer Science and Information System
Presentation transcript:

) y + 1 * => square ( January 31, 2005MacrosClaus Brabrand y + 1 Widespread … ……… … ……... Dylan Dylan Macro Mechamism M4 Unix Macro Preprocessor L A T E X T E X Macro Mechanism C C preprocessor, CPP C++ C++ Templates Scheme Scheme Macros Java/JTS The Jakarta Tool Suite … ………

) y + 1 * => square ( January 31, 2005MacrosClaus Brabrand y + 1 “Macro” Webster’s( “macro” ) = Main Entry: 2 macro Pronunciation: 'ma-(")krO Function: noun Inflected Form(s): plural macros Etymology: short for macroinstruction Date: 1959 “a single computer instruction that stands for a sequence of operations”

) y + 1 * => square ( January 31, 2005MacrosClaus Brabrand y + 1 The Setup compilation / 2) interpretation / analysis / … m: L+  L program. l + program. l 1) macro expansion You are programming in L…...but you wish you had construction m In fact: Macros give you exactly that!

) y + 1 * => square ( January 31, 2005MacrosClaus Brabrand y + 1 MyJava enum { foo, bar, baz };... for (String s : list) { System.out.println("" + s); } static final int foo = 0; static final int bar = 1; static final int baz = 2;... Iterator i = list.iterator(); while (i.hasNext()) { String s = (String) i.next(); System.out.println("" + s); } Decl : enum... = {... } Stm : for... = {... } Java program Macros: MyJava  Java MyJava program

) y + 1 * => square ( January 31, 2005MacrosClaus Brabrand y + 1 Benefits Abstraction // language extension Consistency // modularity Encapsulation // hide complexity Code Reuse // Smsitis Genericity // uniform abstraction mechanism for (String s : list) { System.out.println(s); } for (String s : list) { System.out.println(s); } vs. “An excuse to invent languages and write compilers…” :) Iterator iterator = list.iterator(); while (iterator.hasNext()) { String s = (String) iterator.next(); System.out.println(s); } Iterator iterator = list.iterator(); while (iterator.hasNext()) { String s = (String) iterator.next(); System.out.println(s); }

) y + 1 * => square ( January 31, 2005MacrosClaus Brabrand y + 1 Immensely Different Lexical Macros: Operate on token sequences: Syntactic Macros: Operate on parse trees: ()z + 1 * => square

) y + 1 * => square ( January 31, 2005MacrosClaus Brabrand y + 1 Study Group: Pathway to “Speciale” Study Group “Macros” (5 ECTS) A B C … speciale synergy

) y + 1 * => square ( January 31, 2005MacrosClaus Brabrand y + 1 Investigate macro languages: CPP, M4, T E X, Dylan, C++ Templates, Scheme, JTS, MS 2, … Identify relevant properties: Level of operation, body expansion time, order of expansion, … Macro Survey

) y + 1 * => square ( January 31, 2005MacrosClaus Brabrand y + 1 Speciale Ideas #1: Macro Survey #2: Macro System Generator #4: Parameterized Macros #7: Static Semantics (def/use) #19: Syntax Transformation (x: S  T) #146: Grammar Toolkit …