I've been playing with compiler trying to get used to syntax by
converting unit test cases to block syntax. It was just syntax
replacement so I may have changed the meaning of code accidentaly but I
attach diff with my work in case it is useful.

During attempt to migrate 'classunf' testcase I've found that following
code crashes compiler:


bitc version 0.11
import bitc.main as main
provide bitc.main main

def fnxn(x)
in
  let
    log = x == 0
  in
    true

def f2
in
  let
    p : mutable 'a = 0
  in
    p
//(def (f2) (let ((p:(mutable 'a) 0)) p))

(def main.main:(fn (vector string) -> int32)
  (lambda (argvec)
    (fnxn 0:word) 0))


with:

Bug: ../../compiler/BUILD/bitcc exited with status 1, expected 0
=== EXPECTED OUTPUT ===
=== EXPECTED ERROR OUTPUT ===
=== GOT OUTPUT ===
=== GOT ERROR ====
classunf.segfault0.bitc:13:4: Declaration forms require a type
Internal Compiler error: SIGSEGV. Please report this problem along with sample 
source.
==================
[BAD] ../../compiler/BUILD/bitcc -O -I ../../libbitc --nostdlib -v -o 
BUILD/classunf.segfault0 classunf.segfault0.bitc ../../libbitc/BUILD/libbitc.a 


This is on Debian testing on amd64.

diff -r a05fd1b6a5fc src/tests/unit/catchall.bitc
--- a/src/tests/unit/catchall.bitc	Tue Oct 26 18:20:18 2010 -0700
+++ b/src/tests/unit/catchall.bitc	Thu Oct 28 23:41:56 2010 +0200
@@ -39,14 +39,22 @@
 import bitc.main as main
 provide bitc.main main
 
-(def main.main:(fn (vector string) -> int32)
-  (lambda (argvec)
-    // The pattern being tested here is the "recovery block", wherein
-    // some piece of postaction code is supposed to happen even if an
-    // inner expression fails. To do that, we need to be able to write
-    // a try block having ONLY an otherwise clause:
-    (try 
-     0:int32
-     (catch e 
-	    (otherwise 0:int32 (throw e))))))
+// (def main.main:(fn (vector string) -> int32)
+//   (lambda (argvec)
+//     // The pattern being tested here is the "recovery block", wherein
+//     // some piece of postaction code is supposed to happen even if an
+//     // inner expression fails. To do that, we need to be able to write
+//     // a try block having ONLY an otherwise clause:
+//     (try 
+//      0:int32
+//      (catch e 
+// 	    (otherwise 0:int32 (throw e))))))
 
+def main.main(argvec : string[])
+in
+  try
+    0:int32
+  catch e
+  otherwise
+    0:int32
+    throw e        
\ No newline at end of file
diff -r a05fd1b6a5fc src/tests/unit/chars.bitc
--- a/src/tests/unit/chars.bitc	Tue Oct 26 18:20:18 2010 -0700
+++ b/src/tests/unit/chars.bitc	Thu Oct 28 23:41:56 2010 +0200
@@ -39,12 +39,17 @@
 import bitc.main as main
 provide bitc.main main
 
-(def (id x) x)
+def id(x)
+in
+  x
 
-(def a 'a')
-(def s '\space')
-(def d '\U+1ab')
+def a = 'a'
+def s = '\space'
+def d = '\U+1ab'
 
-(def main.main:(fn (vector string) -> int32)
-  (lambda (argvec) 
-    (id a) (id s) (id d) 0)) 
+def main.main(argvec : string[])
+in
+  id(a)
+  id(s)
+  id(d)
+  0:int32 
diff -r a05fd1b6a5fc src/tests/unit/classunf.bitc
--- a/src/tests/unit/classunf.bitc	Tue Oct 26 18:20:18 2010 -0700
+++ b/src/tests/unit/classunf.bitc	Thu Oct 28 23:41:56 2010 +0200
@@ -44,10 +44,20 @@
 import bitc.main as main
 provide bitc.main main
 
-(def (fnxn x) (let ((log (== x 0))) true))
+def fnxn(x)
+in
+  let
+    log = (x == 0)
+  in
+    true
 
-(def (f2) (let ((p:(mutable 'a) 0)) p))
+def f2 = 
+  let
+    p : mutable 'a = 0
+  in
+    p    
 
-(def main.main:(fn (vector string) -> int32)
-  (lambda (argvec)
-    (fnxn 0:word) 0))
+def main.main(argvec : string[])
+in
+  fnxn(0:word)
+  0:int32
diff -r a05fd1b6a5fc src/tests/unit/not.bitc
--- a/src/tests/unit/not.bitc	Tue Oct 26 18:20:18 2010 -0700
+++ b/src/tests/unit/not.bitc	Thu Oct 28 23:41:56 2010 +0200
@@ -39,6 +39,6 @@
 import bitc.main as main
 provide bitc.main main
 
-(def main.main:(fn (vector string) -> int32)
-  (lambda (argvec) 
-    (if (not false) 0 1)))
+def main.main(argvec: string[])
+in
+  if not false then 0 else 1:int32
Regards

-- 
Tomasz Gajewski
_______________________________________________
bitc-dev mailing list
[email protected]
http://www.coyotos.org/mailman/listinfo/bitc-dev

Reply via email to