Commits

james woodyatt committed 2895936

Checkpoint. Improving the Cf_llscan module, and noting more problems.

Comments (0)

Files changed (3)

     | Cf_seq.Z -> Some ((), s)
     | Cf_seq.P _ -> None
 
+let eq i0 s =
+    match Lazy.force s with
+    | Cf_seq.P (i, tl) when i = i0 -> Some (i0, tl)
+    | _ -> None
+
 let any s =
     match Lazy.force s with
     | Cf_seq.P (hd, tl) -> Some (hd, tl)
     let start p s = lazy (loop p s) in
     start
 
+module Op = struct
+    let ( >>= ) = bind
+    let ( ?. ) = eq
+    let ( ?/ ) = opt
+    let ( ?+ ) = seq1
+    let ( ?* ) = seq
+    let ( ?^ ) = alt
+    let ( ?^~ ) = altz
+end
+
 (*--- $File$ ---*)
 val nil: ('s, 'r) t
 val ret: 'r -> ('s, 'r) t
 val bind: ('s, 'a) t -> ('a -> ('s, 'b) t) -> ('s, 'b) t
+
 val fin: ('s, unit) t
 val any: ('s, 's) t
+val eq: 's -> ('s, 's) t
 val sat: ('s -> bool) -> ('s, 's) t
 val tok: ('s -> 'r option) -> ('s, 'r) t
 val opt: ('s, 'r) t -> ('s, 'r option) t
 
 val unfold: ('s, 'r) t -> 's Cf_seq.t -> 'r Cf_seq.t
 
+module Op: sig
+    val ( >>= ): ('s, 'a) t -> ('a -> ('s, 'b) t) -> ('s, 'b) t
+    val ( ?. ): 's -> ('s, 's) t
+    val ( ?/ ): ('s, 'r) t -> ('s, 'r option) t
+    val ( ?+ ): ('s, 'r) t -> ('s, 'r * 'r list) t
+    val ( ?* ): ('s, 'r) t -> ('s, 'r list) t
+    val ( ?^ ): ('s, 'r) t list -> ('s, 'r) t
+    val ( ?^~ ): ('s, 'r) t Cf_seq.t -> ('s, 'r) t
+end
+
 (*--- $File$ ---*)
 Open issues in development:
 
-+ (Cf_dyn): Exploring this as a refactoring of the Cf_flow module, with all new
-    functions and maybe some different operators.
-
 + (Cf_llscan): Exploring this as a refactoring of the Cf_parser module and its
     cognates.  Needs documentation.  Also need new modules for lexing, parsing
     and regular grammars.
 
++ (Cf_xdfa): Replacing Cf_dfa with a version that uses Cf_llscan instead of
+    Cf_parser.
+
++ (Cf_regx): Trying to lose the Obj.magic in the implmentation of DFA is not
+    as easy as it looks.  The Cf_regex module wants to instantiate a DFA, but
+    we have added a type parameter in Cf_xdfa that makes a straightforward
+    update of Cf_regex to use Cf_xdfa and Cf_llscan is not easy.  Also, think
+    about Unicode and regular expression parsing.
+
++ (Cf_ucs): Exploring this as a refactoring of Cf_unicode, which relies on the
+    not very useful Cf_flow module (see Cf_dyn below).  This version uses the
+    new Cf_llscan module instead, and is intended for being useful with lexing
+    and parsing of Unicode texts.
+
++ (Cf_dyn): Exploring this as a refactoring of the Cf_flow module, with all new
+    functions and maybe some different operators.
+
 + (Cf_seq): The tentative weave functions are probably a bad idea.  It probably
     makes more sense to unfold/weave the new Cf_llscan.t instead.