Original Grammar for Algebra Programs Change #1: Move ...
Original Grammar for Algebra Programs
::= * ::= () = ::= ( + )
::= ( - ) ::= () ::= | ::= a variable name: f, x, y, z, ... ::= a number: 1, 42, 17, ...
Change step-by-step to Scheme
Change #1: Move Parens and Add "define"
::= * ::= (define ( ) ) ::= (+ )
::= (- ) ::= ( ) ::= | ::= a variable name: f, x, y, z, ... ::= a number: 1, 42, 17, ...
+ and - moved to initial position
Change #1: Move Parens and Add "define"
::= * ::= (define ( ) ) ::= (+ )
::= (- ) ::= ( ) ::= | ::= a variable name: f, x, y, z, ... ::= a number: 1, 42, 17, ...
Open parenthesis for function call moved to before the function name
Change #1: Move Parens and Add "define"
::= * ::= (define ( ) ) ::= (+ )
::= (- ) ::= ( ) ::= | ::= a variable name: f, x, y, z, ... ::= a number: 1, 42, 17, ...
Definition use the define keyword, and parenthesis moved
1-6
Change #1: Move Parens and Add "define"
::= * ::= (define ( ) ) ::= (+ )
::= (- ) ::= ( ) ::= |
::= a variable name: f, x, y, z, ... ::= a number: 1, 42, 17, ...
f(x) = (x + 1) f((2 + 3))
(define (f x) (+ x 1)) (f (+ 2 3))
Change #2: Generalize + and -, Add Primitives
::= ... ::= (+ *) ::= (- +) ::= ( *) ::= (/ +) ::= (modulo ) ::= (expt ) ::= ...
(+) 0
Change #2: Generalize + and -, Add Primitives
::= ... ::= (+ *) ::= (- +) ::= ( *) ::= (/ +) ::= (modulo ) ::= (expt ) ::= ... (+ 1 2 3 7) 13
Change #2: Generalize + and -, Add Primitives
::= ... ::= (+ *) ::= (- +) ::= ( *) ::= (/ +) ::= (modulo ) ::= (expt ) ::= ... (- 1) -1
7-11
Change #2: Generalize + and -, Add Primitives
::= ... ::= (+ *) ::= (- +) ::= ( *) ::= (/ +) ::= (modulo ) ::= (expt ) ::= ...
() 1
Change #2: Generalize + and -, Add Primitives
::= ... ::= (+ *) ::= (- +) ::= ( *) ::= (/ +) ::= (modulo ) ::= (expt ) ::= ...
(/ 2) 1/2
Change #2: Generalize + and -, Add Primitives
::= ... ::= (+ *) ::= (- +) ::= ( *) ::= (/ +) ::= (modulo ) ::= (expt ) ::= ...
(expt 13 20) 19004963774880799438801
Change #3: Generalize Defined Functions
::= (define ( *) ) ::= ...
::= ( *)
(define (f a b) (+ a b)) (f 1 2)
(define (f a b) (+ a b)) 3
12-16
Change #3: Generalize Defined Functions
::= (define ( *) ) ::= ...
::= ( *)
... (define (0 1...k) 0) ... ... (0 1...k) ...
... (define (0 1...k) 0) ... ... 3 ... where 3 is 0 with i replaced by i
Change #4: Add Booleans
::= ... ::= ::= (and *) ::= (or *) ::= (zero? ) ::= ...
::= #f ::= #t
(zero? 1) #f
Change #4: Add Booleans
::= ... ::= ::= (and *) ::= (or *) ::= (zero? ) ::= ...
::= #f ::= #t
(and #t #f) #f
Change #4: Add Booleans
::= ... ::= ::= (and *) ::= (or *) ::= (zero? ) ::= ...
::= #f ::= #t
(zero? 0) #t
17-21
Change #5: Add Symbols
::= ... ::= ::= (eq? ) ::= ...
::= '
(eq? 'a 'a) #t
Change #6: Add Conditionals
::= ...
::= (cond *)
::= [ ]
::= [else ]
(cond [#t 1]) 1
Change #5: Add Symbols
::= ... ::= ::= (eq? ) ::= ...
::= '
(eq? 'a 'b) #f
Change #6: Add Conditionals
::= ...
::= (cond *)
::= [ ]
::= [else ]
(cond [#f 1] [#t 2]) (cond [#t 2]) (cond [#t 2]) 2
22-28
................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related download
- september forecast by source millions of dollars
- user s guide wf 3820
- cisco webex room kit administrator guide collaboration
- june forecast by source millions of dollars
- original grammar for algebra programs change 1 move
- ip camera user manual provision isr
- cisco ios lan switching command reference
- dell color multifunction printer e525w user s guide
- 1 0 3 implementation of topical reports change control
- 0 6 0 1 change 1 annual tradables
Related searches
- improving grammar for adults
- grammar for 8th graders
- grammar for 8th grade worksheets
- basic english grammar for beginners
- english grammar for beginners pdf
- mortal kombat 1 move list
- original mg42 for sale
- math notes for algebra 1
- algebra properties worksheet 1 27
- app for algebra problems
- apps for algebra 1
- math apps for algebra 1