Skip to Content
Programming Languages: Concepts and Implementation
book

Programming Languages: Concepts and Implementation

by Saverio Perugini
December 2021
Beginner
840 pages
47h 29m
English
Jones & Bartlett Learning
Content preview from Programming Languages: Concepts and Implementation

12.6 Implementing Pass-by-Name/Need in Camille: Lazy Camille

We demonstrate how to modify the Camille interpreter supporting pass-byreference from Section 12.4 so that it supports pass-by-name/need. To implement lazy evaluation in Camille, we extend the Reference data type with a third target variant: a thunk target. A thunk is the same as a direct target, except that it contains a thunk that evaluates to an expressed value, rather than containing an expressed value:

A set of 17 code lines in Camille for evaluating an expressed value.
Description

Note that we added frozen_expr flag to the dictionary of possible target types.

If the dereference function is passed a reference containing a thunk, it evaluates ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Concepts and Semantics of Programming Languages 1

Concepts and Semantics of Programming Languages 1

Therese Hardin, Mathieu Jaume, Francois Pessaux, Veronique Viguie Donzeau-Gouge
Programming C# 10

Programming C# 10

Ian Griffiths

Publisher Resources

ISBN: 9781284222739