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
- field manual fm 1 0 human resources support april 2014
- oracle financial services regulatory reporting for us
- march 2015 forecast by source millions of dollars
- a note on beta approximation for change point estimator
- 0 6 0 1 change 1 annual tradables
- september forecast by source millions of dollars
- gb uk 798 066 2 0 836 373 2 1 38 307 4 6 0 1 848 085 2
- original grammar for algebra programs change 1 move
- attachment f rule 67 0 1 architectural coatings date of
- uk 1 324 725 3 2 1 389 688 3 4 64 963 4 7 0 2 gb
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