[bitc-dev] Progress report

Jonathan S. Shapiro shap at eros-os.org
Mon Jun 19 17:01:17 EDT 2006


May I have your permission to add this example as a unit test?

shap

On Mon, 2006-06-19 at 22:28 +0200, Tom Bachmann wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> >> - - is closure conversion implemented or not? I still have the example
> >>   here where you said it needs closure conversion, and it still does not
> >>   compile.
> > 
> > Closure conversion is implemented, but there appear to be some bugs in
> > the typing. Try pulling the very latest (there were some checkins last
> > night). Run the compiler by hand with the --showpasses option.
> 
> No clconv pass is shown here, it dies just after (while) polyinstantiation.
> 
> Here is the complete code:
> (bitc-version "0.10")
> (provide main bitc.main)
> (import stdio bitc.stdio)
> 
> (define (main.main argv:(vector string))
>   (let
>     ((print (lambda (s)
>               (stdio.write-string stdio.stdout s)
>               (stdio.write-char stdio.stdout #\linefeed)))
>      (vector-for-each (lambda (f v)
>                         (letrec
>                           ((iter (lambda (f v i)
>                                    (if (== i (vector-length v))
>                                      ()
>                                      (begin
>                                        (f (vector-nth v i))
>                                        (iter f v (+ i 1)))))))
>                           (iter f v 0)))))
>     (vector-for-each print argv))
>   (the int32 0))
> 
> And the error message (without --showpasses):
> FINAL Polyinstantiation (s):
> echo2.bitc:17:12: Identifier `_4iter' used here, Undefined.
> 
> FINAL Polyinstantiation (s):
> echo2.bitc:17:12: _4iter Unbound in Gamma
> 
>  while RandTing (bitc-version "0.10")
> (defstruct _19bitc.stdio.iostream:ref external bitc_iostream)
> (defexception _24bitc.prelude.OutOfMemory)
> (defexception _29bitc.prelude.IndexBoundsError)
> (defexception _23bitc.stdio.NoPermission)
> (defexception _16bitc.stdio.AtEOF)
> (defexception _18bitc.stdio.NotUTF8)
> (defunion _17bitc.prelude.list#UR1_20_17bitc.prelude.list_4char:ref
> _16bitc.prelude.nil#UR1_20_17bitc.prelude.list_4char
> (_17bitc.prelude.cons#UR1_20_17bitc.prelude.list_4char _3car:char
> _3cdr:_17bitc.prelude.list#UR1_20_17bitc.prelude.list_4char))
> (proclaim _24bitc.prelude.OutOfMemory : exception external ExOutOfMemory)
> (proclaim _29bitc.prelude.IndexBoundsError : exception external
> ExIndexBoundsError)
> (proclaim _16bitc.prelude.__+#FN2_4word_4word_4word : (fn (word word)
> word) external)
> (proclaim _17bitc.prelude.__==#FN2_4word_4word_4bool : (fn (word word)
> bool) external)
> (proclaim _23bitc.prelude.__index_lt : (fn (word word) bool) external
> bitc_index_lt)
> (define
> _13bitc.list.map#FN2FN1_4char_4unitUR1_20_17bitc.prelude.list_4char_4bool:(fn
> ((fn (char) ()) _17bitc.prelude.list#UR1_20_17bitc.prelude.list_4char)
> bool) (lambda (_1f
> _3lst:_17bitc.prelude.list#UR1_20_17bitc.prelude.list_4char) (begin
> (switch _3lst (_1x (begin #t)
> _16bitc.prelude.nil#UR1_20_17bitc.prelude.list_4char) (_1x (begin (begin
> (_1f _1x._3car)
> (_13bitc.list.map#FN2FN1_4char_4unitUR1_20_17bitc.prelude.list_4char_4bool
> _1f _1x._3cdr))) _17bitc.prelude.cons#UR1_20_17bitc.prelude.list_4char) ))))
> (define
> _17bitc.list.reverse#FN1UR1_20_17bitc.prelude.list_4charUR1_20_17bitc.prelude.list_4char:(fn
> (_17bitc.prelude.list#UR1_20_17bitc.prelude.list_4char)
> _17bitc.prelude.list#UR1_20_17bitc.prelude.list_4char) (lambda (_3lst)
> (begin (letrec ((_10do-reverse (lambda (_2l1 _2l2) (begin (switch (the
> _17bitc.prelude.list#UR1_20_17bitc.prelude.list_4char _2l1) (_1x (begin
> _2l2) _16bitc.prelude.nil#UR1_20_17bitc.prelude.list_4char) (_1x (begin
> (_10do-reverse _1x._3cdr
> (_17bitc.prelude.cons#UR1_20_17bitc.prelude.list_4char _1x._3car _2l2)))
> _17bitc.prelude.cons#UR1_20_17bitc.prelude.list_4char) ))))) (begin
> (_10do-reverse _3lst
> _16bitc.prelude.nil#UR1_20_17bitc.prelude.list_4char))))))
> (proclaim _25bitc.string.string-length : (fn (string) word) external
> bitc_string_length)
> (proclaim _22bitc.string.string-nth : (fn (string word) char) external
> bitc_string_nth)
> (define  (_24bitc.string.string->list _1s) (begin (let ((_3len
> (_25bitc.string.string-length _1s)) (_1l:( mutable
> _17bitc.prelude.list#UR1_20_17bitc.prelude.list_4char)
> _16bitc.prelude.nil#UR1_20_17bitc.prelude.list_4char)) (begin (let
> ((_3pos (the word 0))) (do ((_17bitc.prelude.__==#FN2_4word_4word_4bool
> _3pos _3len) _1l) (begin (set! _1l
> (_17bitc.prelude.cons#UR1_20_17bitc.prelude.list_4char
> (_22bitc.string.string-nth _1s _3pos) _1l))) (begin
> (_16bitc.prelude.__+#FN2_4word_4word_4word (the word 1) _3pos))))
> (_17bitc.list.reverse#FN1UR1_20_17bitc.prelude.list_4charUR1_20_17bitc.prelude.list_4char
> _1l)))))
> (proclaim _24bitc.string.list->string : (fn
> (_17bitc.prelude.list#UR1_20_17bitc.prelude.list_4char) string) external
> bitc_list_string)
> (proclaim _23bitc.stdio.NoPermission : exception external ExNoPermission)
> (proclaim _16bitc.stdio.AtEOF : exception external ExAtEOF)
> (proclaim _18bitc.stdio.NotUTF8 : exception external ExNotUTF8)
> (proclaim _15bitc.stdio.eof? : (fn (_19bitc.stdio.iostream) bool)
> external bitc_stdio_eofp)
> (proclaim _15bitc.stdio.open : (fn (string string)
> _19bitc.stdio.iostream) external bitc_stdio_open)
> (proclaim _16bitc.stdio.close : (fn (_19bitc.stdio.iostream) ())
> external bitc_stdio_close)
> (proclaim _16bitc.stdio.stdin : _19bitc.stdio.iostream external
> bitc_stdio_stdin)
> (proclaim _17bitc.stdio.stdout : _19bitc.stdio.iostream external
> bitc_stdio_stdout)
> (proclaim _17bitc.stdio.stderr : _19bitc.stdio.iostream external
> bitc_stdio_stderr)
> (proclaim _20bitc.stdio.read-char : (fn (_19bitc.stdio.iostream) char)
> external bitc_stdio_read_char)
> (proclaim _21bitc.stdio.write-char : (fn (_19bitc.stdio.iostream char)
> ()) external bitc_stdio_write_char)
> (proclaim _20bitc.stdio.read-byte : (fn (_19bitc.stdio.iostream) uint8)
> external bitc_stdio_read_byte)
> (proclaim _21bitc.stdio.write-byte : (fn (_19bitc.stdio.iostream uint8)
> ()) external bitc_stdio_write_byte)
> (define  (_23bitc.stdio.write-string _3ios _1s) (begin
> (_13bitc.list.map#FN2FN1_4char_4unitUR1_20_17bitc.prelude.list_4char_4bool
> (lambda (_1c) (begin (_21bitc.stdio.write-char _3ios _1c)))
> (_24bitc.string.string->list _1s))))
> (define  (_14bitc.main.main _4argv:(vector string)) (begin (let
> ((_5print (lambda (_1s) (begin (_23bitc.stdio.write-string
> _17bitc.stdio.stdout _1s) (_21bitc.stdio.write-char _17bitc.stdio.stdout
> #\linefeed))))
> (_15vector-for-each#FN2FN1_6string_4unitK_6string_4unit:(fn ((fn
> (string) ()) (vector string)) ()) (lambda (_1f _1v) (begin (letrec
> ((_4iter#FN3FN1_6string_4unitK_6string_4word_4unit:(fn ((fn (string) ())
> (vector string) word) ()) (lambda (_1f _1v _1i) (begin (if
> (_17bitc.prelude.__==#FN2_4word_4word_4bool _1i (vector_length _1v)) ()
> (begin (_1f (vector-nth _1v _1i)) (_4iter _1f _1v
> (_16bitc.prelude.__+#FN2_4word_4word_4word _1i (the word (the word (the
> word 1))))))))))) (begin
> (_4iter#FN3FN1_6string_4unitK_6string_4word_4unit _1f _1v (the word (the
> word 0))))))))) (begin
> (_15vector-for-each#FN2FN1_6string_4unitK_6string_4unit _5print
> _4argv))) (the int32 (the int32 0))))
> 
> 
> bitcc: Polyinst.cxx:1333: bool
> UocInfo::be_polyinstantiate(std::ostream&, bool, long unsigned int):
> Assertion `ans' failed.
> - --
> - -ness-
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.2.2 (GNU/Linux)
> 
> iD8DBQFElwjgvD/ijq9JWhsRAs6sAJ9vwiY/y78C/vS2HY1WUw0VIKUx5gCfViRf
> oNVrVIlS1ILo5LvU4FeOgyY=
> =0DhT
> -----END PGP SIGNATURE-----
> _______________________________________________
> bitc-dev mailing list
> bitc-dev at coyotos.org
> http://www.coyotos.org/mailman/listinfo/bitc-dev



More information about the bitc-dev mailing list