Created
March 4, 2016 01:22
-
-
Save eatonphil/6f903c17ad1dd28787aa to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| structure File = Ponyo.Os.File | |
| structure String = Ponyo.String | |
| structure Format = Ponyo.Format | |
| val f = PolyML.NameSpace.displayTypeExpression | |
| val g = PolyML.globalNameSpace | |
| fun parseModule (path: string) = | |
| let | |
| val moduleSource = String.join (File.readFrom (path), "") | |
| val moduleStream = TextIO.openString (moduleSource) | |
| fun parseResult (module as (a, b)) : unit = | |
| let in | |
| map (fn (a) => case a of | |
| PolyML.PTfirstChild t => (parseResult (t ()); ()) | |
| | PolyML.PTnextSibling t => (parseResult (t ()); ()) | |
| (*| PolyML.PTprint p => (print "-";PolyML.prettyPrint (print, 1) (p 5); ())*) | |
| | PolyML.PTtype t => (print "=";PolyML.prettyPrint (print, 5) (f (t, 5, g)); ()) | |
| | a => (())) b; | |
| () | |
| end | |
| fun tryResult (parseTree, _) = | |
| let | |
| in | |
| case parseTree of | |
| NONE => () | |
| | SOME m => parseResult (m); | |
| fn () => () | |
| end | |
| val _ = PolyML.compiler (fn () => TextIO.input1 moduleStream, [ | |
| PolyML.Compiler.CPCompilerResultFun tryResult | |
| ]); | |
| in | |
| () | |
| end | |
| fun main () = | |
| parseModule ("ponyo/Container/Tree/BinarySearchTree.sml") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment