20101028 - The internal form improves the efficiency....

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

View Full Document Right Arrow Icon
============================ CS 441 Fall 2010 -- JWJ Pre-class notes - do not distribute Tuesday, October 28, 2010 ============================ Topics Interpretation. Intermediate code generation. Preparation for the syntax-directed translation. Concepts A guide to this presentation: - Interpretation – Chapter a (our textbook) Compiler -- translator from a high-level language to an assembly or machine language. Assembler - a translator form the assembly to the machine language. Interpreter -- accepts an input program in the source language and directly executes it, without producing a target language program. A pure interpreter analyzes each construct in the input and immediately executes it. A two phase interpreter translates the input program into an intermediate form and then executes the resulting code in the internal form.
Background image of page 1

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

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

Unformatted text preview: The internal form improves the efficiency. [Example from Tom Niemann's tutorial (see below)] x = 0; while (x < 3) { print x; x = x + 1; } with output for the interpretive version, 1 2 and output for the compiler version. push 0 pop x L000: push x push 3 compLT jz L001 push x print push x push 1 add pop x jmp L000 L001: Sources Textbook - Chapter 5 On-line resource: http://www.lugbe.ch/action/reports/lex_yacc.pdf (Tom Niemann tutorial on Lex and Yacc) http://www.epaperpress.com/lexandyacc/index.html Programming Assignment PA2a Play with the code from the above Web pages. Write three programs in the language described in the above tutorial. Show the syntax-trees and the code for your sample programs. One of the programs should compute the number of combinations C(n,k) using an iterative algorithm....
View Full Document

This document was uploaded on 12/14/2010.

Page1 / 2

20101028 - The internal form improves the efficiency....

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