Goals of my lectures A way of adding types DSL-making “tools”

Slides:



Advertisements
Similar presentations
CS3012: Formal Languages and Compilers Static Analysis the last of the analysis phases of compilation type checking - is an operator applied to an incompatible.
Advertisements

Compiler construction in4020 – lecture 2 Koen Langendoen Delft University of Technology The Netherlands.
Parsing III (Eliminating left recursion, recursive descent parsing)
Parsing — Part II (Ambiguity, Top-down parsing, Left-recursion Removal)
Macro & Function. Function consumes more time When a function is called, the copy of the arguments are passed to the parameters in the function. After.
CSE341: Programming Languages Lecture 15 Macros Dan Grossman Spring 2013.
Partial Sums An Addition Algorithm.
LANGUAGE TRANSLATORS: WEEK 3 LECTURE: Grammar Theory Introduction to Parsing Parser - Generators TUTORIAL: Questions on grammar theory WEEKLY WORK: Read.
410/510 1 of 18 Week 5 – Lecture 1 Semantic Analysis Compiler Construction.
Automata Based Method for Domain Specific Languages Definition Ulyana Tikhonova PhD student at St. Petersburg State Politechnical University, supervised.
CSE S. Tanimoto Macros 1 Defining Macros in Scheme Extensibility: A language is extensible if the language can be extended. New Scheme control structures.
Compiler Design Introduction 1. 2 Course Outline Introduction to Compiling Lexical Analysis Syntax Analysis –Context Free Grammars –Top-Down Parsing –Bottom-Up.
Top-down Parsing Recursive Descent & LL(1) Comp 412 Copyright 2010, Keith D. Cooper & Linda Torczon, all rights reserved. Students enrolled in Comp 412.
Top-Down Parsing CS 671 January 29, CS 671 – Spring Where Are We? Source code: if (b==0) a = “Hi”; Token Stream: if (b == 0) a = “Hi”; Abstract.
1 COSC generating functions, templates, and macros Yves Lespérance Adapted from Peter Roosen-Runge.
CS 139 Objects Based on a lecture by Dr. Farzana Rahman Assistant Professor Department of Computer Science.
FUNCTIONAL PROGRAMING AT WORK - HASKELL AND DOMAIN SPECIFIC LANGUAGES Dr. John Peterson Western State Colorado University.
Assignments Locate an assignment Attach an assignment Turn in an assignment.
Lecture # 10 Grammar Problems. Problems with grammar Ambiguity Left Recursion Left Factoring Removal of Useless Symbols These can create problems for.
CS 404Ahmed Ezzat 1 CS 404 Introduction to Compiler Design Lecture 1 Ahmed Ezzat.
LECTURE 5 Scanning. SYNTAX ANALYSIS We know from our previous lectures that the process of verifying the syntax of the program is performed in two stages:
COMMUTATIVE PROPERTY What does the word commute mean or in what context is it used? Definition: Commutative Property says that the ______________ in which.
LECTURE 10 Semantic Analysis. REVIEW So far, we’ve covered the following: Compilation methods: compilation vs. interpretation. The overall compilation.
Section 4-7: Arithmetic Sequences.
Abstract Syntax cs7100 (Prasad) L7AST.
Parsing & Context-Free Grammars
CS510 Compiler Lecture 4.
50/50 rule You need to get 50% from tests, AND
LIKE TERMS DEFINITION:
CSE341: Programming Languages Lecture 15 Macros
Delegates and Events 14: Delegates and Events
Programming Languages Dan Grossman 2013
CS 326 Programming Languages, Concepts and Implementation
Syntax Analysis Chapter 4.
Abstract Syntax Trees Lecture 14 Mon, Feb 28, 2005.
Compiler Lecture 1 CS510.
Compiler Construction
Emily Leland (Not Nick) Spring 2017
MACRO Processors CSCI/CMPE 3334 David Egle.
CSE341: Programming Languages Lecture 15 Macros
Syntax Analysis Sections :.
(Slides copied liberally from Ruth Anderson, Hal Perkins and others)
Top-Down Parsing CS 671 January 29, 2008.
קורס פיננסי – מושגים פיננסיים / כלכליים
Operator Overloading
Wrapping Up Copyright 2003, Keith D. Cooper, Ken Kennedy & Linda Torczon, all rights reserved. Students enrolled in Comp 412 at Rice University have explicit.
Lecture 7: Introduction to Parsing (Syntax Analysis)
Lecture 8: Top-Down Parsing
Racket Last Structs, Lambda, Module
CSE341: Programming Languages Lecture 15 Macros
Add or Subtract? x =.
Types and Type Checking (What is it good for?)
EEC-492/693/793 iPhone Application Development
2.2.2 Abstract Syntax Recall BNF definition of l-calculus expressions:
2.2.2 Abstract Syntax Recall BNF definition of l-calculus expressions:
CSE341: Programming Languages Lecture 15 Macros
Nicholas Shahan Spring 2016
CSE341: Programming Languages Lecture 15 Macros
Year 2 Spring Term Week 8 Lesson 5
Lecture 18 Bottom-Up Parsing or Shift-Reduce Parsing
5.6 Properties of Determinants
College I am thinking of and applying to
Greater Numbers Objective: I can read and write greater numbers up to the million place value in standard, word, and expanded form.
Year 2 Spring Term Week 8 Lesson 5
Lecture 5 Scanning.
Defining Macros in Scheme
Plenary
Plenary
CSE341: Programming Languages Lecture 15 Macros
CSE341: Programming Languages Lecture 15 Macros
Presentation transcript:

Goals of my lectures A way of adding types DSL-making “tools” Another DSL example

Goals of my lectures A way of adding types DSL-making “tools” Another DSL example Last time: type-of, type=?, assign-type define-type check-type #%datum add1 This time: #%app lambda Type constructors Type checking types

Goals of my lectures A way of adding types DSL-making “tools” Another DSL example Last time (basic): syntax-parse Syntax objects Syntax properties Interposition: #%app, #%datum Today (deep end): Phasing Pattern expanders Id macros Syntax classes Definition contexts

Goals of my lectures A way of adding types DSL-making “tools” Another DSL example Next time

Id macros are tricky! Racket macro expansion algorithm: For syntax object #’(x y z): If x is macro Pass #’(x y z) to syntax transformer registered as macro x Else Pass #’(#%app x y z) to #%app macro Ambiguity: what if x = id macro that expands to add1 We want to invoke x macro on just x, but algorithm doesn’t do that