L06 - ECE251: Programming Languages & Translators Fall...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Fall 2010 Lecture 6 — September 23, 2010 Patrick Lam version 1 Interlude: Interpreters and Domain-Specific Languages Before we discuss parsing, let’s talk about interpreters and DSLs, which are both relevant to lab 1. Interpreters What are examples of interpreters? Main characteristic. An interpreter reads a program as input and runs the program; contrast this to a traditional compiler, which produces a binary. Implementing an interpreter is like implementing a compiler; however, you need to carry out the program’s instructions rather than emit code. (Note that modern interpreters can translate to native code just-in-time.) As you visit the AST 1 , execute the instructions. scan parse weed type execute store Figure 1: Parts of an interpreter. Figure 1 presents one possible way to write an interpreter. Compare it to the parts of a compiler from Lecture 1. Note in particular the store, where the interpreter puts values of variables. We also will need scope information for these variables; we’ll talk about that later. For now, use a
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 10/28/2010 for the course ECE 493 taught by Professor Lam during the Spring '09 term at Waterloo.

Page1 / 3

L06 - ECE251: Programming Languages & Translators Fall...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online