9.5 Abstract Syntax

Consider the string ((lambda (x) (f x)) (g y)) representing an expression in λ-calculus. An implementation of a programming language, such as an interpreter or compiler, reads strings like this, typically from standard input, and processes them. This program string is an external representation (i.e., it is external to the system processing it) and uses concrete syntax. Programs in concrete syntax are not readily processable. Scheme, however, is a homoiconic language, meaning that program codes and data are both represented using the same representation—in the case of Scheme as a list. In consequence, the availability of a Scheme program as an S-expression is convenient for any system processing it. The (read) facility in ...

Get Programming Languages: Concepts and Implementation now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.