Honu:
- top.ss - commented out compile-failure tests for now - cce-notes.txt - added my preliminary notes about the Honu codebase - examples/*-test.ss - added *-test.ss files for all *.honu files svn: r943
This commit is contained in:
parent
a31d901061
commit
365754f55c
25
collects/honu/cce-notes.txt
Normal file
25
collects/honu/cce-notes.txt
Normal file
|
@ -0,0 +1,25 @@
|
|||
doc.txt: implementation notes
|
||||
tool.ss: definition of language level
|
||||
compile.ss: top-level compilation functions
|
||||
util.ss: general functions (similar to list.ss)
|
||||
tenv.ss: definition of type environment
|
||||
- don't understand all the types defined
|
||||
tenv-utils.ss: manipulate environments
|
||||
base.ss: top-level honu definitions
|
||||
ast.ss: ast structs
|
||||
private/typechecker/type-utils.ss: simple type operations
|
||||
|
||||
------------------------------------------------------------
|
||||
|
||||
Mixins: new form NYI
|
||||
|
||||
------------------------------------------------------------
|
||||
|
||||
3 phases:
|
||||
- parser tools (-> AST)
|
||||
- post-parsing
|
||||
- static references to "my" references (my.x for static fields, etc.)
|
||||
- references to "this" only in member access (this.x) or in casts ((IFace)this)
|
||||
- adds casts to this.x
|
||||
- simplify-ast : gather asts/sequences into big lets/sequences
|
||||
|
8
collects/honu/examples/EvenOddClass-test.ss
Normal file
8
collects/honu/examples/EvenOddClass-test.ss
Normal file
|
@ -0,0 +1,8 @@
|
|||
(define EO (new EvenOddC%))
|
||||
|
||||
(list (interface? EvenOdd<%>)
|
||||
(class? EvenOddC%)
|
||||
(send EO EvenOdd<%>-even 4)
|
||||
(not (send EO EvenOdd<%>-even 5))
|
||||
(send EO EvenOdd<%>-odd 7)
|
||||
(not (send EO EvenOdd<%>-odd 6)))
|
19
collects/honu/examples/List-test.ss
Normal file
19
collects/honu/examples/List-test.ss
Normal file
|
@ -0,0 +1,19 @@
|
|||
(define MT (new MTList%))
|
||||
(define (Cons first rest) (new ConsList% [car first] [cdr rest]))
|
||||
|
||||
(define l0 MT)
|
||||
(define l1 (Cons 0 l0))
|
||||
(define l2 (Cons 1 l1))
|
||||
(define l3 (Cons 2 l2))
|
||||
|
||||
(list (interface? List<%>)
|
||||
(class? MTList%)
|
||||
(class? ConsList%)
|
||||
(send l0 List<%>-empty '())
|
||||
(not (send l1 List<%>-empty '()))
|
||||
(not (send l2 List<%>-empty '()))
|
||||
(not (send l3 List<%>-empty '()))
|
||||
(equal? (send l0 List<%>-length '()) 0)
|
||||
(equal? (send l1 List<%>-length '()) 1)
|
||||
(equal? (send l2 List<%>-length '()) 2)
|
||||
(equal? (send l3 List<%>-length '()) 3))
|
7
collects/honu/examples/Y-test.ss
Normal file
7
collects/honu/examples/Y-test.ss
Normal file
|
@ -0,0 +1,7 @@
|
|||
(list (interface? T<%>)
|
||||
(class? Y%)
|
||||
(= (main 5) 120)
|
||||
(= ((fix (lambda (f)
|
||||
(lambda (n)
|
||||
(if (zero? n) 0 (+ n (f (- n 1))))))) 5)
|
||||
15))
|
1
collects/honu/examples/bind-tup-top-test.ss
Normal file
1
collects/honu/examples/bind-tup-top-test.ss
Normal file
|
@ -0,0 +1 @@
|
|||
(list (= x 3) (= y 4))
|
1
collects/honu/examples/cond-test-test.ss
Normal file
1
collects/honu/examples/cond-test-test.ss
Normal file
|
@ -0,0 +1 @@
|
|||
(list (= x 2))
|
4
collects/honu/examples/even-odd-test.ss
Normal file
4
collects/honu/examples/even-odd-test.ss
Normal file
|
@ -0,0 +1,4 @@
|
|||
(list (even 4)
|
||||
(not (even 5))
|
||||
(not (odd 4))
|
||||
(odd 5))
|
19
collects/honu/examples/exprs-test.ss
Normal file
19
collects/honu/examples/exprs-test.ss
Normal file
|
@ -0,0 +1,19 @@
|
|||
(define (testfact fact)
|
||||
(list (= (fact 1) 1)
|
||||
(= (fact 2) 2)
|
||||
(= (fact 3) 6)
|
||||
(= (fact 4) 24)
|
||||
(= (fact 5) 120)))
|
||||
|
||||
(define (testfib fib)
|
||||
(list (= (fib 0) 0)
|
||||
(= (fib 2) 1)
|
||||
(= (fib 4) 3)
|
||||
(= (fib 6) 8)))
|
||||
|
||||
(append (testfact fact)
|
||||
(testfact fact2)
|
||||
(testfact impfact)
|
||||
(testfact (lambda (n) (cadr (fibfact n))))
|
||||
(testfib fib)
|
||||
(testfib (lambda (n) (car (fibfact n)))))
|
3
collects/honu/examples/struct-test.ss
Normal file
3
collects/honu/examples/struct-test.ss
Normal file
|
@ -0,0 +1,3 @@
|
|||
(append (map interface? (list Color<%> Posn<%> ColorPosn<%>))
|
||||
(map class? (list PosnC% ColorC% ColorPosnC%))
|
||||
(map mixin? (list $ColorPosnC-mixin)))
|
5
collects/honu/examples/tup-bind-test.ss
Normal file
5
collects/honu/examples/tup-bind-test.ss
Normal file
|
@ -0,0 +1,5 @@
|
|||
(list (interface? T<%>)
|
||||
(class? C%)
|
||||
(equal? (f 'dummy) '(dummy dummy))
|
||||
(= (send (new C%) T<%>-x-get '()) 3)
|
||||
(= (send (new C%) T<%>-y-get '()) 3))
|
1
collects/honu/examples/types-test.ss
Normal file
1
collects/honu/examples/types-test.ss
Normal file
|
@ -0,0 +1 @@
|
|||
(map interface? (list t1<%> t2<%> t3<%>))
|
|
@ -112,9 +112,10 @@
|
|||
"examples/point.honu"
|
||||
"examples/struct.honu"
|
||||
"examples/tup-bind.honu"
|
||||
"examples/types-error.honu"
|
||||
; "examples/types-error.honu"
|
||||
"examples/types.honu"
|
||||
"examples/nonexistent.honu"))
|
||||
; "examples/nonexistent.honu"
|
||||
))
|
||||
|
||||
(define (program-syntax file)
|
||||
(let* ([port (open-input-file file)])
|
||||
|
|
Loading…
Reference in New Issue
Block a user