[MLton-commit] r6345

Vesa Karvonen vesak at mlton.org
Fri Jan 18 15:28:37 PST 2008


Moved toy Parsec implementation to a separate library to be developed
further.

----------------------------------------------------------------------

U   mltonlib/trunk/com/ssh/generic/unstable/detail/ml/smlnj/unsealed.cm
D   mltonlib/trunk/com/ssh/generic/unstable/detail/util/sequence.sml
U   mltonlib/trunk/com/ssh/generic/unstable/detail/value/read.sml
U   mltonlib/trunk/com/ssh/generic/unstable/lib.mlb
U   mltonlib/trunk/com/ssh/generic/unstable/lib.use
A   mltonlib/trunk/org/mlton/vesak/parsec/
A   mltonlib/trunk/org/mlton/vesak/parsec/unstable/
A   mltonlib/trunk/org/mlton/vesak/parsec/unstable/LICENSE
A   mltonlib/trunk/org/mlton/vesak/parsec/unstable/detail/
A   mltonlib/trunk/org/mlton/vesak/parsec/unstable/detail/mk-parsec.fun
A   mltonlib/trunk/org/mlton/vesak/parsec/unstable/detail/ml/
A   mltonlib/trunk/org/mlton/vesak/parsec/unstable/detail/ml/smlnj/
A   mltonlib/trunk/org/mlton/vesak/parsec/unstable/detail/ml/smlnj/unsealed.cm
A   mltonlib/trunk/org/mlton/vesak/parsec/unstable/detail/string-sequence.sml
A   mltonlib/trunk/org/mlton/vesak/parsec/unstable/lib.cm
A   mltonlib/trunk/org/mlton/vesak/parsec/unstable/lib.mlb
A   mltonlib/trunk/org/mlton/vesak/parsec/unstable/lib.use
A   mltonlib/trunk/org/mlton/vesak/parsec/unstable/public/
A   mltonlib/trunk/org/mlton/vesak/parsec/unstable/public/export.sml
A   mltonlib/trunk/org/mlton/vesak/parsec/unstable/public/parsec.sig
A   mltonlib/trunk/org/mlton/vesak/parsec/unstable/public/sequence.sig

----------------------------------------------------------------------

Modified: mltonlib/trunk/com/ssh/generic/unstable/detail/ml/smlnj/unsealed.cm
===================================================================
--- mltonlib/trunk/com/ssh/generic/unstable/detail/ml/smlnj/unsealed.cm	2008-01-18 19:34:01 UTC (rev 6344)
+++ mltonlib/trunk/com/ssh/generic/unstable/detail/ml/smlnj/unsealed.cm	2008-01-18 23:28:35 UTC (rev 6345)
@@ -9,6 +9,7 @@
    source(-)
 is
    ../../../../../../../org/mlton/vesak/ds/unstable/lib.cm
+   ../../../../../../../org/mlton/vesak/parsec/unstable/lib.cm
    ../../../../../extended-basis/unstable/basis.cm
    ../../../../../prettier/unstable/lib.cm
    ../../../../../random/unstable/lib.cm

Deleted: mltonlib/trunk/com/ssh/generic/unstable/detail/util/sequence.sml
===================================================================
--- mltonlib/trunk/com/ssh/generic/unstable/detail/util/sequence.sml	2008-01-18 19:34:01 UTC (rev 6344)
+++ mltonlib/trunk/com/ssh/generic/unstable/detail/util/sequence.sml	2008-01-18 23:28:35 UTC (rev 6345)
@@ -1,33 +0,0 @@
-(* Copyright (C) 2008 Vesa Karvonen
- *
- * This code is released under the MLton license, a BSD-style license.
- * See the LICENSE file or http://mlton.org/License for details.
- *)
-
-signature SEQUENCE = sig
-   type t
-   structure Elem : T
-   structure Pos : T
-   val pos : t -> Pos.t
-   val get : (Elem.t, t) Reader.t
-end
-
-structure StringSequence :> sig
-   include SEQUENCE
-      where type Pos.t = Int.t
-      where type Elem.t = Char.t
-   val full : String.t -> t
-   val string : t -> String.t
-end = struct
-   structure Pos = Int
-   structure Elem = Char
-   type t = {pos : Pos.t, data : String.t}
-   fun full s : t = {pos = 0, data = s}
-   val pos : t -> Pos.t = #pos
-   val string : t -> String.t = #data
-   val get : (Elem.t, t) Reader.t =
-    fn {pos, data} =>
-       if pos < size data
-       then SOME (String.sub (data, pos), {pos = pos+1, data = data})
-       else NONE
-end

Modified: mltonlib/trunk/com/ssh/generic/unstable/detail/value/read.sml
===================================================================
--- mltonlib/trunk/com/ssh/generic/unstable/detail/value/read.sml	2008-01-18 19:34:01 UTC (rev 6344)
+++ mltonlib/trunk/com/ssh/generic/unstable/detail/value/read.sml	2008-01-18 23:28:35 UTC (rev 6345)
@@ -4,190 +4,6 @@
  * See the LICENSE file or http://mlton.org/License for details.
  *)
 
-signature MK_PARSEC_DOM = sig
-   structure Sequence : SEQUENCE
-   structure State : T
-end
-
-signature PARSEC = sig
-   include MK_PARSEC_DOM
-
-   include ETAEXP'
-   include MONADP where type 'a monad = 'a etaexp
-
-   type 'a t = 'a etaexp
-
-   val parse : 'a t -> Sequence.t * State.t
-               -> (Sequence.Pos.t, 'a * (Sequence.t * State.t)) Sum.t
-
-   val getState : State.t t
-   val setState : State.t -> Unit.t t
-
-   val fromScan : ((Sequence.Elem.t, Sequence.t) Reader.t
-                   -> ('a, Sequence.t) Reader.t) -> 'a t
-   val fromReader : ('a, Sequence.t) Reader.t -> 'a t
-
-   val guess : 'a t UnOp.t
-
-   val elem : Sequence.Elem.t t
-   val drop : Sequence.Elem.t UnPr.t -> Unit.t t
-   val sat : Sequence.Elem.t UnPr.t -> Sequence.Elem.t t
-   val take : Sequence.Elem.t UnPr.t -> Sequence.Elem.t List.t t
-
-   val peek : 'a t UnOp.t
-   val ^* : 'a t -> 'a List.t t
-end
-
-functor MkParsec (Arg : MK_PARSEC_DOM) :> PARSEC
-   where type Sequence.t      = Arg.Sequence.t
-   where type Sequence.Elem.t = Arg.Sequence.Elem.t
-   where type Sequence.Pos.t  = Arg.Sequence.Pos.t
-   where type State.t         = Arg.State.t =
-struct
-   (* <-- SML/NJ workaround *)
-   open TopLevel
-   infix  7 *`
-   infix  6 +`
-   infixr 6 <^> <+>
-   infixr 5 <$> <$$> </> <//>
-   infix  4 <\ \>
-   infixr 4 </ />
-   infix  2 >| andAlso
-   infixr 2 |<
-   infix  1 orElse >>=
-   infix  0 & <|>
-   infixr 0 -->
-   (* SML/NJ workaround --> *)
-
-   open Arg
-   type 'a etaexp_dom = Sequence.t * State.t
-   type msg = Sequence.Pos.t
-   datatype 'a reply =
-      OK   of 'a * 'a etaexp_dom * msg
-    | FAIL of msg
-   datatype 'a etaexp_cod =
-      TASTE of 'a reply Thunk.t
-    | EMPTY of 'a reply
-   type 'a etaexp = 'a etaexp_dom -> 'a etaexp_cod
-   type 'a t = 'a etaexp
-
-   fun get (s, t) = Option.map (fn (e, s) => (e, (s, t))) (Sequence.get s)
-   fun pos (s, _) = Sequence.pos s
-
-   fun getState (s, t) = EMPTY (OK (t, (s, t), Sequence.pos s))
-   fun setState t (s, _) = EMPTY (OK ((), (s, t), Sequence.pos s))
-
-   fun taste r = TASTE (const r)
-
-   fun parse p s =
-       case case p s
-             of EMPTY r  => r
-              | TASTE th => th ()
-        of FAIL p       => INL p
-         | OK (x, s, _) => INR (x, s)
-
-   fun fromReader reader (s, t) =
-       case reader s
-        of SOME (x, s) => taste (OK (x, (s, t), Sequence.pos s))
-         | NONE        => EMPTY (FAIL (Sequence.pos s))
-
-   fun fromScan scan = fromReader (scan Sequence.get)
-
-   fun merge m =
-    fn OK (x, s, _) => OK (x, s, m)
-     | FAIL _       => FAIL m
-
-   fun bindSome m =
-    fn EMPTY r  => merge m r
-     | TASTE th => th ()
-
-   fun replyNone m =
-    fn EMPTY r => EMPTY (merge m r)
-     | other   => other
-
-   fun return x s = EMPTY (OK (x, s, pos s))
-
-   fun (xM >>= x2yM) s =
-       case xM s
-        of EMPTY (FAIL m)       => EMPTY (FAIL m)
-         | EMPTY (OK (x, s, m)) => replyNone m (x2yM x s)
-         | TASTE th             =>
-           TASTE (fn () => case th ()
-                            of FAIL e       => FAIL e
-                             | OK (x, s, m) => bindSome m (x2yM x s))
-
-   fun zero s = EMPTY (FAIL (pos s))
-
-   fun (p <|> q) s =
-       case p s
-        of EMPTY (FAIL m) => replyNone m (q s)
-         | other          => other
-
-   fun guess p s =
-       case p s
-        of EMPTY r  => EMPTY r
-         | TASTE th => case th ()
-                        of FAIL _ => EMPTY (FAIL (pos s))
-                         | result => taste result
-
-   fun elem s =
-       case get s
-        of NONE        => EMPTY (FAIL (pos s))
-         | SOME (c, s) => taste (OK (c, s, pos s))
-
-   fun drop p s = let
-      fun done f s = f (OK ((), s, pos s))
-      fun some (c, s') s = if p c then lp s' else done taste s
-      and body f s =
-          case get s
-           of NONE    => done f s
-            | SOME cs => some cs s
-      and lp s = body taste s
-   in
-      body EMPTY s
-   end
-
-   fun sat p s =
-       case get s
-        of NONE         => EMPTY (FAIL (pos s))
-         | SOME (c, s') =>
-           if p c then taste (OK (c, s', pos s')) else EMPTY (FAIL (pos s))
-
-   fun take p = let
-      fun done s =
-       fn [] => EMPTY (OK ([], s, pos s))
-        | cs => taste (OK (rev cs, s, pos s))
-      fun lp cs s =
-          case get s
-           of NONE => done s cs
-            | SOME (c, s') =>
-              if p c
-              then lp (c::cs) s'
-              else done s cs
-   in
-      lp []
-   end
-
-   fun peek p s =
-       case p s
-        of EMPTY (OK (x, _, m)) => EMPTY (OK (x, s, m))
-         | EMPTY (FAIL m)       => EMPTY (FAIL m)
-         | TASTE th             => case th ()
-                                    of OK (x, _, m) => taste (OK (x, s, m))
-                                     | FAIL m       => taste (FAIL m)
-
-   fun ^* p = p >>= (fn x => ^* p >>= (fn xs => return (x::xs))) <|> return []
-
-   structure Monad = MkMonadP
-     (type 'a monad = 'a t
-      val return = return
-      val op >>= = op >>=
-      val zero = zero
-      val op <|> = op <|>)
-
-   open Monad
-end
-
 functor WithRead (Arg : WITH_READ_DOM) : READ_CASES = struct
    (* <-- SML/NJ workaround *)
    open TopLevel

Modified: mltonlib/trunk/com/ssh/generic/unstable/lib.mlb
===================================================================
--- mltonlib/trunk/com/ssh/generic/unstable/lib.mlb	2008-01-18 19:34:01 UTC (rev 6344)
+++ mltonlib/trunk/com/ssh/generic/unstable/lib.mlb	2008-01-18 23:28:35 UTC (rev 6345)
@@ -9,6 +9,7 @@
    $(MLTON_LIB)/com/ssh/prettier/unstable/lib.mlb
    $(MLTON_LIB)/com/ssh/random/unstable/lib.mlb
    $(MLTON_LIB)/org/mlton/vesak/ds/unstable/lib.mlb
+   $(MLTON_LIB)/org/mlton/vesak/parsec/unstable/lib.mlb
 in
    ann
       "forceUsed"
@@ -47,7 +48,6 @@
          detail/util/ops.sml
          detail/util/opt-int.sml (* XXX Should really go to Extended Basis? *)
          detail/util/hash-univ.sml
-         detail/util/sequence.sml
 
          (* Framework *)
 

Modified: mltonlib/trunk/com/ssh/generic/unstable/lib.use
===================================================================
--- mltonlib/trunk/com/ssh/generic/unstable/lib.use	2008-01-18 19:34:01 UTC (rev 6344)
+++ mltonlib/trunk/com/ssh/generic/unstable/lib.use	2008-01-18 23:28:35 UTC (rev 6345)
@@ -5,6 +5,7 @@
  *)
 
 lib ["${MLTON_LIB}/org/mlton/vesak/ds/unstable/lib.use",
+     "${MLTON_LIB}/org/mlton/vesak/parsec/unstable/lib.use",
      "${MLTON_LIB}/com/ssh/extended-basis/unstable/basis.use",
      "${MLTON_LIB}/com/ssh/prettier/unstable/lib.use",
      "${MLTON_LIB}/com/ssh/random/unstable/lib.use",
@@ -26,7 +27,6 @@
      "detail/util/ops.sml",
      "detail/util/opt-int.sml",
      "detail/util/hash-univ.sml",
-     "detail/util/sequence.sml",
      "detail/framework/mk-closed-rep.fun",
      "detail/framework/root-generic.sml",
      "detail/framework/close-generic.fun",


Property changes on: mltonlib/trunk/org/mlton/vesak/parsec/unstable
___________________________________________________________________
Name: svn:ignore
   + generated


Copied: mltonlib/trunk/org/mlton/vesak/parsec/unstable/LICENSE (from rev 5753, mltonlib/trunk/org/mlton/vesak/libc/unstable/LICENSE)
===================================================================
--- mltonlib/trunk/org/mlton/vesak/libc/unstable/LICENSE	2007-07-10 07:39:05 UTC (rev 5753)
+++ mltonlib/trunk/org/mlton/vesak/parsec/unstable/LICENSE	2008-01-18 23:28:35 UTC (rev 6345)
@@ -0,0 +1,20 @@
+COPYRIGHT NOTICE, LICENSE AND DISCLAIMER.
+
+Copyright (C) 2008 Vesa Karvonen
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both the copyright notice and this permission notice and warranty
+disclaimer appear in supporting documentation, and that the name of
+the above copyright holders, or their entities, not be used in
+advertising or publicity pertaining to distribution of the software
+without specific, written prior permission.
+
+The above copyright holders disclaim all warranties with regard to
+this software, including all implied warranties of merchantability and
+fitness. In no event shall the above copyright holders be liable for
+any special, indirect or consequential damages or any damages
+whatsoever resulting from loss of use, data or profits, whether in an
+action of contract, negligence or other tortious action, arising out
+of or in connection with the use or performance of this software.

Copied: mltonlib/trunk/org/mlton/vesak/parsec/unstable/detail/mk-parsec.fun (from rev 6344, mltonlib/trunk/com/ssh/generic/unstable/detail/value/read.sml)
===================================================================
--- mltonlib/trunk/com/ssh/generic/unstable/detail/value/read.sml	2008-01-18 19:34:01 UTC (rev 6344)
+++ mltonlib/trunk/org/mlton/vesak/parsec/unstable/detail/mk-parsec.fun	2008-01-18 23:28:35 UTC (rev 6345)
@@ -0,0 +1,155 @@
+(* Copyright (C) 2008 Vesa Karvonen
+ *
+ * This code is released under the MLton license, a BSD-style license.
+ * See the LICENSE file or http://mlton.org/License for details.
+ *)
+
+functor MkParsec (Arg : MK_PARSEC_DOM) :> PARSEC
+   where type Sequence.t      = Arg.Sequence.t
+   where type Sequence.Elem.t = Arg.Sequence.Elem.t
+   where type Sequence.Pos.t  = Arg.Sequence.Pos.t
+   where type State.t         = Arg.State.t =
+struct
+   (* <-- SML/NJ workaround *)
+   open TopLevel
+   infix  7 *`
+   infix  6 +`
+   infixr 6 <^> <+>
+   infixr 5 <$> <$$> </> <//>
+   infix  4 <\ \>
+   infixr 4 </ />
+   infix  2 >| andAlso
+   infixr 2 |<
+   infix  1 orElse >>=
+   infix  0 & <|>
+   infixr 0 -->
+   (* SML/NJ workaround --> *)
+
+   open Arg
+   type 'a etaexp_dom = Sequence.t * State.t
+   type msg = Sequence.Pos.t
+   datatype 'a reply =
+      OK   of 'a * 'a etaexp_dom * msg
+    | FAIL of msg
+   datatype 'a etaexp_cod =
+      TASTE of 'a reply Thunk.t
+    | EMPTY of 'a reply
+   type 'a etaexp = 'a etaexp_dom -> 'a etaexp_cod
+   type 'a t = 'a etaexp
+
+   fun get (s, t) = Option.map (fn (e, s) => (e, (s, t))) (Sequence.get s)
+   fun pos (s, _) = Sequence.pos s
+
+   fun getState (s, t) = EMPTY (OK (t, (s, t), Sequence.pos s))
+   fun setState t (s, _) = EMPTY (OK ((), (s, t), Sequence.pos s))
+
+   fun taste r = TASTE (const r)
+
+   fun parse p s =
+       case case p s
+             of EMPTY r  => r
+              | TASTE th => th ()
+        of FAIL p       => INL p
+         | OK (x, s, _) => INR (x, s)
+
+   fun fromReader reader (s, t) =
+       case reader s
+        of SOME (x, s) => taste (OK (x, (s, t), Sequence.pos s))
+         | NONE        => EMPTY (FAIL (Sequence.pos s))
+
+   fun fromScan scan = fromReader (scan Sequence.get)
+
+   fun merge m =
+    fn OK (x, s, _) => OK (x, s, m)
+     | FAIL _       => FAIL m
+
+   fun bindSome m =
+    fn EMPTY r  => merge m r
+     | TASTE th => th ()
+
+   fun replyNone m =
+    fn EMPTY r => EMPTY (merge m r)
+     | other   => other
+
+   fun return x s = EMPTY (OK (x, s, pos s))
+
+   fun (xM >>= x2yM) s =
+       case xM s
+        of EMPTY (FAIL m)       => EMPTY (FAIL m)
+         | EMPTY (OK (x, s, m)) => replyNone m (x2yM x s)
+         | TASTE th             =>
+           TASTE (fn () => case th ()
+                            of FAIL e       => FAIL e
+                             | OK (x, s, m) => bindSome m (x2yM x s))
+
+   fun zero s = EMPTY (FAIL (pos s))
+
+   fun (p <|> q) s =
+       case p s
+        of EMPTY (FAIL m) => replyNone m (q s)
+         | other          => other
+
+   fun guess p s =
+       case p s
+        of EMPTY r  => EMPTY r
+         | TASTE th => case th ()
+                        of FAIL _ => EMPTY (FAIL (pos s))
+                         | result => taste result
+
+   fun elem s =
+       case get s
+        of NONE        => EMPTY (FAIL (pos s))
+         | SOME (c, s) => taste (OK (c, s, pos s))
+
+   fun drop p s = let
+      fun done f s = f (OK ((), s, pos s))
+      fun some (c, s') s = if p c then lp s' else done taste s
+      and body f s =
+          case get s
+           of NONE    => done f s
+            | SOME cs => some cs s
+      and lp s = body taste s
+   in
+      body EMPTY s
+   end
+
+   fun sat p s =
+       case get s
+        of NONE         => EMPTY (FAIL (pos s))
+         | SOME (c, s') =>
+           if p c then taste (OK (c, s', pos s')) else EMPTY (FAIL (pos s))
+
+   fun take p = let
+      fun done s =
+       fn [] => EMPTY (OK ([], s, pos s))
+        | cs => taste (OK (rev cs, s, pos s))
+      fun lp cs s =
+          case get s
+           of NONE => done s cs
+            | SOME (c, s') =>
+              if p c
+              then lp (c::cs) s'
+              else done s cs
+   in
+      lp []
+   end
+
+   fun peek p s =
+       case p s
+        of EMPTY (OK (x, _, m)) => EMPTY (OK (x, s, m))
+         | EMPTY (FAIL m)       => EMPTY (FAIL m)
+         | TASTE th             => case th ()
+                                    of OK (x, _, m) => taste (OK (x, s, m))
+                                     | FAIL m       => taste (FAIL m)
+
+   fun ^* p = p >>= (fn x => ^* p >>= (fn xs => return (x::xs))) <|> return []
+
+   structure Monad = MkMonadP
+     (type 'a monad = 'a t
+      val return = return
+      val op >>= = op >>=
+      val zero = zero
+      val op <|> = op <|>)
+
+   open Monad
+end

Added: mltonlib/trunk/org/mlton/vesak/parsec/unstable/detail/ml/smlnj/unsealed.cm
===================================================================
--- mltonlib/trunk/org/mlton/vesak/parsec/unstable/detail/ml/smlnj/unsealed.cm	2008-01-18 19:34:01 UTC (rev 6344)
+++ mltonlib/trunk/org/mlton/vesak/parsec/unstable/detail/ml/smlnj/unsealed.cm	2008-01-18 23:28:35 UTC (rev 6345)
@@ -0,0 +1,12 @@
+(* Copyright (C) 2008 Vesa Karvonen
+ *
+ * This code is released under the MLton license, a BSD-style license.
+ * See the LICENSE file or http://mlton.org/License for details.
+ *)
+
+group is
+  ../../../../../../../../com/ssh/extended-basis/unstable/basis.cm
+  ../../../public/parsec.sig
+  ../../../public/sequence.sig
+  ../../mk-parsec.fun
+  ../../string-sequence.sml

Copied: mltonlib/trunk/org/mlton/vesak/parsec/unstable/detail/string-sequence.sml (from rev 6324, mltonlib/trunk/com/ssh/generic/unstable/detail/util/sequence.sml)
===================================================================
--- mltonlib/trunk/com/ssh/generic/unstable/detail/util/sequence.sml	2008-01-13 20:38:59 UTC (rev 6324)
+++ mltonlib/trunk/org/mlton/vesak/parsec/unstable/detail/string-sequence.sml	2008-01-18 23:28:35 UTC (rev 6345)
@@ -0,0 +1,19 @@
+(* Copyright (C) 2008 Vesa Karvonen
+ *
+ * This code is released under the MLton license, a BSD-style license.
+ * See the LICENSE file or http://mlton.org/License for details.
+ *)
+
+structure StringSequence :> STRING_SEQUENCE = struct
+   structure Pos = Int
+   structure Elem = Char
+   type t = {pos : Pos.t, data : String.t}
+   fun full s : t = {pos = 0, data = s}
+   val pos : t -> Pos.t = #pos
+   val string : t -> String.t = #data
+   val get : (Elem.t, t) Reader.t =
+    fn {pos, data} =>
+       if pos < size data
+       then SOME (String.sub (data, pos), {pos = pos+1, data = data})
+       else NONE
+end

Added: mltonlib/trunk/org/mlton/vesak/parsec/unstable/lib.cm
===================================================================
--- mltonlib/trunk/org/mlton/vesak/parsec/unstable/lib.cm	2008-01-18 19:34:01 UTC (rev 6344)
+++ mltonlib/trunk/org/mlton/vesak/parsec/unstable/lib.cm	2008-01-18 23:28:35 UTC (rev 6345)
@@ -0,0 +1,12 @@
+(* Copyright (C) 2008 Vesa Karvonen
+ *
+ * This code is released under the MLton license, a BSD-style license.
+ * See the LICENSE file or http://mlton.org/License for details.
+ *)
+
+library
+   source(public/export.sml)
+is
+   ../../../../../com/ssh/extended-basis/unstable/basis.cm
+   detail/ml/smlnj/unsealed.cm
+   public/export.sml

Added: mltonlib/trunk/org/mlton/vesak/parsec/unstable/lib.mlb
===================================================================
--- mltonlib/trunk/org/mlton/vesak/parsec/unstable/lib.mlb	2008-01-18 19:34:01 UTC (rev 6344)
+++ mltonlib/trunk/org/mlton/vesak/parsec/unstable/lib.mlb	2008-01-18 23:28:35 UTC (rev 6345)
@@ -0,0 +1,25 @@
+(* Copyright (C) 2008 Vesa Karvonen
+ *
+ * This code is released under the MLton license, a BSD-style license.
+ * See the LICENSE file or http://mlton.org/License for details.
+ *)
+
+local
+   $(MLTON_LIB)/com/ssh/extended-basis/unstable/basis.mlb
+in
+   ann
+      "forceUsed"
+      "sequenceNonUnit warn"
+      "warnUnused true"
+   in
+      local
+         public/sequence.sig
+         detail/string-sequence.sml
+
+         public/parsec.sig
+         detail/mk-parsec.fun
+      in
+         public/export.sml
+      end
+   end
+end


Property changes on: mltonlib/trunk/org/mlton/vesak/parsec/unstable/lib.mlb
___________________________________________________________________
Name: svn:eol-style
   + native

Added: mltonlib/trunk/org/mlton/vesak/parsec/unstable/lib.use
===================================================================
--- mltonlib/trunk/org/mlton/vesak/parsec/unstable/lib.use	2008-01-18 19:34:01 UTC (rev 6344)
+++ mltonlib/trunk/org/mlton/vesak/parsec/unstable/lib.use	2008-01-18 23:28:35 UTC (rev 6345)
@@ -0,0 +1,12 @@
+(* Copyright (C) 2008 Vesa Karvonen
+ *
+ * This code is released under the MLton license, a BSD-style license.
+ * See the LICENSE file or http://mlton.org/License for details.
+ *)
+
+lib ["${MLTON_LIB}/com/ssh/extended-basis/unstable/basis.use",
+     "public/sequence.sig",
+     "detail/string-sequence.sml",
+     "public/parsec.sig",
+     "detail/mk-parsec.fun",
+     "public/export.sml"] ;


Property changes on: mltonlib/trunk/org/mlton/vesak/parsec/unstable/lib.use
___________________________________________________________________
Name: svn:eol-style
   + native

Added: mltonlib/trunk/org/mlton/vesak/parsec/unstable/public/export.sml
===================================================================
--- mltonlib/trunk/org/mlton/vesak/parsec/unstable/public/export.sml	2008-01-18 19:34:01 UTC (rev 6344)
+++ mltonlib/trunk/org/mlton/vesak/parsec/unstable/public/export.sml	2008-01-18 23:28:35 UTC (rev 6345)
@@ -0,0 +1,20 @@
+(* Copyright (C) 2008 Vesa Karvonen
+ *
+ * This code is released under the MLton license, a BSD-style license.
+ * See the LICENSE file or http://mlton.org/License for details.
+ *)
+
+(** == Exported Signatures == *)
+
+signature PARSEC = PARSEC
+signature SEQUENCE = SEQUENCE
+signature STRING_SEQUENCE = STRING_SEQUENCE
+
+(** == Exported Structures == *)
+
+structure StringSequence : STRING_SEQUENCE = StringSequence
+
+(** == Exported Functors == *)
+
+signature MK_PARSEC_DOM = MK_PARSEC_DOM
+functor MkParsec (Arg : MK_PARSEC_DOM) : PARSEC = MkParsec (Arg)


Property changes on: mltonlib/trunk/org/mlton/vesak/parsec/unstable/public/export.sml
___________________________________________________________________
Name: svn:eol-style
   + native

Copied: mltonlib/trunk/org/mlton/vesak/parsec/unstable/public/parsec.sig (from rev 6344, mltonlib/trunk/com/ssh/generic/unstable/detail/value/read.sml)
===================================================================
--- mltonlib/trunk/com/ssh/generic/unstable/detail/value/read.sml	2008-01-18 19:34:01 UTC (rev 6344)
+++ mltonlib/trunk/org/mlton/vesak/parsec/unstable/public/parsec.sig	2008-01-18 23:28:35 UTC (rev 6345)
@@ -0,0 +1,39 @@
+(* Copyright (C) 2008 Vesa Karvonen
+ *
+ * This code is released under the MLton license, a BSD-style license.
+ * See the LICENSE file or http://mlton.org/License for details.
+ *)
+
+signature MK_PARSEC_DOM = sig
+   structure Sequence : SEQUENCE
+   structure State : T
+end
+
+signature PARSEC = sig
+   include MK_PARSEC_DOM
+
+   include ETAEXP'
+   include MONADP where type 'a monad = 'a etaexp
+
+   type 'a t = 'a etaexp
+
+   val parse : 'a t -> Sequence.t * State.t
+               -> (Sequence.Pos.t, 'a * (Sequence.t * State.t)) Sum.t
+
+   val getState : State.t t
+   val setState : State.t -> Unit.t t
+
+   val fromScan : ((Sequence.Elem.t, Sequence.t) Reader.t
+                   -> ('a, Sequence.t) Reader.t) -> 'a t
+   val fromReader : ('a, Sequence.t) Reader.t -> 'a t
+
+   val guess : 'a t UnOp.t
+
+   val elem : Sequence.Elem.t t
+   val drop : Sequence.Elem.t UnPr.t -> Unit.t t
+   val sat : Sequence.Elem.t UnPr.t -> Sequence.Elem.t t
+   val take : Sequence.Elem.t UnPr.t -> Sequence.Elem.t List.t t
+
+   val peek : 'a t UnOp.t
+   val ^* : 'a t -> 'a List.t t
+end

Copied: mltonlib/trunk/org/mlton/vesak/parsec/unstable/public/sequence.sig (from rev 6324, mltonlib/trunk/com/ssh/generic/unstable/detail/util/sequence.sml)
===================================================================
--- mltonlib/trunk/com/ssh/generic/unstable/detail/util/sequence.sml	2008-01-13 20:38:59 UTC (rev 6324)
+++ mltonlib/trunk/org/mlton/vesak/parsec/unstable/public/sequence.sig	2008-01-18 23:28:35 UTC (rev 6345)
@@ -0,0 +1,21 @@
+(* Copyright (C) 2008 Vesa Karvonen
+ *
+ * This code is released under the MLton license, a BSD-style license.
+ * See the LICENSE file or http://mlton.org/License for details.
+ *)
+
+signature SEQUENCE = sig
+   type t
+   structure Elem : T
+   structure Pos : T
+   val pos : t -> Pos.t
+   val get : (Elem.t, t) Reader.t
+end
+
+signature STRING_SEQUENCE = sig
+   include SEQUENCE
+      where type Pos.t = Int.t
+      where type Elem.t = Char.t
+   val full : String.t -> t
+   val string : t -> String.t
+end




More information about the MLton-commit mailing list