COMPSCI 61A Lecture Notes - Lecture 26: Init, Generic Function, Eval

23 views5 pages
zogo39484755 and 6 others unlocked
COMPSCI 61A Full Course Notes
22
COMPSCI 61A Full Course Notes
Verified Note
22 documents

Document Summary

A scheme list is written as elements in parenthesis ( ) Each element can be a combination or primitive. The task of parsing a language involves coercing a string repr of an expression to the expression itself. Taking in text input and turning it into expression. Text (lexical analysis) tokens (syntactical analysis) expressions. A predictive recursive descent parser inspects only k tokens to decide how to proceed, for some fixed k. Identifies hierarchical structure of an expression which may be nested. Each call to scheme_read consusmes the input tokens for exactly one expression. Walks through from left to write, if hits parenthesis, evaluates that expression. The pair class represents scheme pairs and lists. A list is a pair whose second element is either a list or nil. >>> s = pair (1, pair(2, pair(3, nil))) print(s) (1 2 3) Scheme expressions are represented as scheme lists: homoiconic means source code is data.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents