OSDN Git Service

Revert "[UPDATE]add test for syntax-error"
authormzp <mzpppp@gmail.com>
Sun, 16 Nov 2008 14:55:41 +0000 (23:55 +0900)
committermzp <mzpppp@gmail.com>
Sun, 16 Nov 2008 14:55:41 +0000 (23:55 +0900)
This reverts commit 76b6a7ef01fd90a613b4d99075203410bf4b3bbe.

src/.ocamlinit
src/lisp.ml
src/lisp.mli
src/parsec.ml
test/test_lisp.ml

index b3b50aa..bea329d 100644 (file)
@@ -22,4 +22,4 @@
 #load "lexer.cmo";;
 #load "sexp.cmo";;
 #load "lisp.cmo";;
-#load "codegen.cmo";;
+#load "codegen.cmo";;
\ No newline at end of file
index 2761629..b2ff605 100644 (file)
@@ -1,9 +1,6 @@
 open Base
 open Sexp
 open ClosTrans
-open Parsec
-
-exception Syntax_error
 
 let symbol = function
     Symbol n -> n
@@ -21,43 +18,6 @@ let qname symbol =
   with Not_found ->
     "",symbol
 
-let symbol v =
-  Parsec.char (Symbol v)
-
-
-
-
-::List vars::body | Symbol "letrec"::List vars::body ->
-             let inits = 
-               List.map 
-                 (function 
-                      (List [Symbol n;init]) -> (n,make_expr init) 
-                    | _ -> failwith "") 
-                 vars in
-             let body' =
-               List.map make_expr body in
-               if List.hd xs = Symbol "let" then
-                 Ast.Let (inits,Ast.Block body')
-               else
-                 Ast.LetRec (inits,Ast.Block body')
-         | Symbol "begin"::body ->
-             Ast.Block (List.map make_expr body)
-         | Symbol "lambda"::List args::body ->
-             let body' =
-               List.map make_expr body in
-             Ast.Lambda (List.map symbol args,Ast.Block body')
-         | Symbol "new"::Symbol name::args ->
-             Ast.New (qname name,List.map make_expr args)
-         | [Symbol "."; obj; List (Symbol name::args)] ->
-             Ast.Invoke (make_expr obj,name,List.map make_expr args)
-         | [Symbol "slot-ref";obj;Symbol name] ->
-             Ast.SlotRef (make_expr obj,name)
-         | [Symbol "slot-set!";obj;Symbol name;value] ->
-             Ast.SlotSet (make_expr obj,name,make_expr value)
-         | _ ->
-             Ast.Call (List.map make_expr xs)
-
-
 let rec make_expr =
   function
       String s -> Ast.String s 
index d6150b8..b11d557 100644 (file)
@@ -1,3 +1,2 @@
-exception Syntax_error
 val compile : char Stream.t -> ClosTrans.program
 val compile_string : string -> ClosTrans.program
index 92a6232..d45a3e2 100644 (file)
@@ -21,6 +21,9 @@ let rec repeat n f stream =
 let repeat_l n f stream =
   repeat (Int32.to_int n) f stream
 
+
+
+  
 let string str stream = 
   let cs =
     ExtString.String.explode str in
index 905d464..d7b3597 100644 (file)
@@ -147,12 +147,7 @@ let _ =
      "slot-set!" >::
        (fun () ->
          ok (result (SlotSet (Var "obj","name",Int 42))) @@
-           Lisp.compile_string "(slot-set! obj name 42)");
-     "syntax error" >::
-       (fun () ->
-         assert_raises 
-           Lisp.Syntax_error 
-           (fun () -> Lisp.compile_string "(if 1)"))
+           Lisp.compile_string "(slot-set! obj name 42)")
    ]) +> run_test_tt