Docsity

Programming Languages and Translators, Study notes of Programming Languages

Partial preview of the text

Download Programming Languages and Translators and more Study notes Programming Languages in PDF only on Docsity!

Programming Languages and Translators

Stephen A. Edwards

Columbia University

Fall 2013

Pieter Bruegel, The Tower of Babel , 1563

Instructor

Prof. Stephen A. Edwards [email protected] http://www.cs.columbia.edu/~sedwards/ 462 Computer Science Building

Objectives

Theory of language design œ (^) Finer points of languages œ (^) Different languages and paradigms Practice of Compiler Construction œ (^) Overall structure of a compiler œ (^) Automated tools and their use œ (^) Lexical analysis to assembly generation

Required Text

Alfred V. Aho, Monica S. Lam, Ravi Sethi, and Jeffrey D. Ullman. Compilers: Principles, Techniques, and Tools. Addison-Wesley, 2006. Second Edition. Bug Al about all bugs. You can get away with the first edition.

Prerequisites

COMS W3261 Computer Science Theory œ (^) You need to understand grammars œ (^) We will be working with regular and context-free languages COMS W3157 Advanced Programming œ (^) Teams will build a large software system œ (^) Makefiles, version control, test suites œ (^) Testing will be as important as development

Class Website

Off my home page, http://www.cs.columbia.edu/~sedwards/ Contains syllabus, lecture notes, and assignments. Schedule may be updated

Part I

The Project

The Project

Design and implement your own little language. Five deliverables:

  1. A proposal describing and motivating your language
  2. A language reference manual defining it formally
  3. A compiler or interpreter for your language running on some sample programs
  4. A final project report
  5. A final project presentation

First Three Tasks

  1. Decide who you will work with You’ll be stuck with them for the term; choose wisely.
  2. Elect a team leader Languages come out better from dictatorships, not democracies. Besides, you’ll have someone to blame.
  3. Select a weekly meeting time Harder than you might think.

Teams

œ (^) There should be one leader. S/he should resolve all contentious design decisions. œ (^) If you have any doubt about your team dynamics, have no doubt: you are headed for trouble. Tell your TA or me about it as soon as possible. Each member of a group gets a separate grade for the project.

Language Reference Manual

A careful definition of the syntax and semantics of your language. Follow the style of the C language reference manual (Appendix A of Kernighan and Ritchie, The C Programming Langauge ; see the class website).

Final Report Sections

  1. Introduction: the proposal
  2. Language Tutorial
  3. Language Reference Manual
  4. Project Plan
  5. Architectural Design
  6. Test Plan
  7. Lessons Learned
  8. Complete listing

Design a language?

A small, domain-specific language. Think of awk or php, not Java or C++. Examples from earlier terms: Geometric figure drawing language Matlab-like array manipulation language Quantum computing language Screenplay animation language Escher-like pattern generator Music manipulation language (harmony) Web surfing language Mathematical function manipulator Simple scripting language (à lá Tcl)

Three Common Mistakes to Avoid

  1. Configuration File Syndrome œ (^) Your language must be able to express algorithms , not just data œ (^) If your language looks like “a bird and a bird and a turtle and a pond and grass and a rock,” it has fallen victim to configuration file syndrome and needs to be changed