1st section - stacker
This commit is contained in:
commit
0e7f17311c
1
stacker/compiled/drracket/errortrace/stacker_rkt.dep
Normal file
1
stacker/compiled/drracket/errortrace/stacker_rkt.dep
Normal file
@ -0,0 +1 @@
|
|||||||
|
("7.5" racket ("7f677926d966a8cec92cb8a8b1e1bd44f09f4aab" . "f00a81ce44a6ee4c31b492d8e2e91c13a4a1e5aa") (collects #"br" #"quicklang.rkt") (collects #"errortrace" #"errortrace-key.rkt") (collects #"racket" #"runtime-config.rkt"))
|
||||||
BIN
stacker/compiled/drracket/errortrace/stacker_rkt.zo
Normal file
BIN
stacker/compiled/drracket/errortrace/stacker_rkt.zo
Normal file
Binary file not shown.
6
stacker/stacker-test.rkt
Normal file
6
stacker/stacker-test.rkt
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
#lang reader "stacker.rkt"
|
||||||
|
4
|
||||||
|
8
|
||||||
|
+
|
||||||
|
3
|
||||||
|
*
|
||||||
6
stacker/stacker-test.rkt~
Normal file
6
stacker/stacker-test.rkt~
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
#lang reader "stacker.rkt"
|
||||||
|
4
|
||||||
|
8
|
||||||
|
+
|
||||||
|
4
|
||||||
|
*
|
||||||
37
stacker/stacker.rkt
Normal file
37
stacker/stacker.rkt
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
#lang br/quicklang
|
||||||
|
|
||||||
|
(define (read-syntax path port)
|
||||||
|
(define src-lines (port->lines port))
|
||||||
|
(define src-datums (format-datums '(handle ~a) src-lines))
|
||||||
|
(define module-datum `(module stacker-mod "stacker.rkt"
|
||||||
|
,@src-datums))
|
||||||
|
(datum->syntax #f module-datum))
|
||||||
|
|
||||||
|
(provide read-syntax)
|
||||||
|
|
||||||
|
(define-macro (stacker-module-begin HANDLE-EXPR ...)
|
||||||
|
#'(#%module-begin
|
||||||
|
HANDLE-EXPR ...
|
||||||
|
(display (first stack))))
|
||||||
|
|
||||||
|
(provide (rename-out [stacker-module-begin #%module-begin]))
|
||||||
|
|
||||||
|
(define stack empty)
|
||||||
|
|
||||||
|
(define (pop-stack!)
|
||||||
|
(define arg (first stack))
|
||||||
|
(set! stack (rest stack))
|
||||||
|
arg)
|
||||||
|
|
||||||
|
(define (push-stack! arg)
|
||||||
|
(set! stack (cons arg stack)))
|
||||||
|
|
||||||
|
(define (handle [arg #f])
|
||||||
|
(cond
|
||||||
|
[(number? arg) (push-stack! arg)]
|
||||||
|
[(or (equal? + arg) (equal? * arg))
|
||||||
|
(define op-result (arg (pop-stack!) (pop-stack!)))
|
||||||
|
(push-stack! op-result)]))
|
||||||
|
|
||||||
|
(provide handle)
|
||||||
|
(provide + *)
|
||||||
2
stacker/stacker.rkt~
Normal file
2
stacker/stacker.rkt~
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
#lang br/quicklang
|
||||||
|
42
|
||||||
Loading…
x
Reference in New Issue
Block a user