Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] Diff of /sml/trunk/src/ml-lex/lexgen.sml
ViewVC logotype

Diff of /sml/trunk/src/ml-lex/lexgen.sml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 419, Fri Sep 3 23:51:27 1999 UTC revision 651, Thu Jun 1 18:34:03 2000 UTC
# Line 912  Line 912 
912    
913           fun GetEndLeaf t =           fun GetEndLeaf t =
914             let fun f ((tl,el)::r) = if (tl=t) then el else f r             let fun f ((tl,el)::r) = if (tl=t) then el else f r
915                     | f _ = raise Match
916             in f tcpairs             in f tcpairs
917             end             end
918           fun GetTrConLeaves s =           fun GetTrConLeaves s =
# Line 987  Line 988 
988    
989              val _ = say "val s = map f (rev (tl (rev s))) \n"              val _ = say "val s = map f (rev (tl (rev s))) \n"
990              val _ = say "exception LexHackingError \n"              val _ = say "exception LexHackingError \n"
991              val _ = say "fun look ((j,x)::r, i) = if i = j then x else look(r, i) \n"              val _ = say "fun look ((j,x)::r, i: int) = if i = j then x else look(r, i) \n"
992              val _ = say "  | look ([], i) = raise LexHackingError\n"              val _ = say "  | look ([], i) = raise LexHackingError\n"
993    
994          val _ = say "fun g {fin=x, trans=i} = {fin=x, trans=look(s,i)} \n"          val _ = say "fun g {fin=x, trans=i} = {fin=x, trans=look(s,i)} \n"
995           in res           in res
996          end          end
997    
998            fun makeTable args = let
999                fun makeOne (a, b) = let
1000                    fun item (N i) = ("N", i)
1001                      | item (T i) = ("T", i)
1002                      | item (D i) = ("D", i)
1003                    fun makeItem x = let
1004                        val (t, n) = item x
1005                    in
1006                        app say ["(", t, " ", Int.toString n, ")"]
1007                    end
1008                    fun makeItems [] = ()
1009                      | makeItems [x] = makeItem x
1010                      | makeItems (hd :: tl) =
1011                        (makeItem hd; say ","; makeItems tl)
1012                in
1013                    say "{fin = [";
1014                    makeItems b;
1015                    app say ["], trans = ", a, "}"]
1016                end
1017                fun mt ([], []) = ()
1018                  | mt ([a], [b]) = makeOne (a, b)
1019                  | mt (a :: a', b :: b') =
1020                    (makeOne (a, b); say ",\n"; mt (a', b'))
1021                  | mt _ = raise Match
1022            in
1023                mt args
1024            end
1025    
1026    (*
1027          fun makeTable(nil,nil) = ()          fun makeTable(nil,nil) = ()
1028            | makeTable(a::a',b::b') =            | makeTable(a::a',b::b') =
1029               let fun makeItems nil = ()               let fun makeItems nil = ()
# Line 1014  Line 1044 
1044                    then ()                    then ()
1045                    else (say ",\n"; makeTable(a',b')))                    else (say ",\n"; makeTable(a',b')))
1046                end                end
1047    *)
1048    
1049          fun msg x = TextIO.output(TextIO.stdOut, x)          fun msg x = TextIO.output(TextIO.stdOut, x)
1050    

Legend:
Removed from v.419  
changed lines
  Added in v.651

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0