hamlet/parse-main.ss
#lang scheme

(require (file "Parse-struct.ss")
         (file "PPProgram-struct.ss")
         (file "InitialInfixEnv-struct.ss")
         (planet chongkai/sml/ml-package)
         (only-in (planet chongkai/sml/ml-primitives)
                  NONE SOME))

#|
    val parse : InfEnv * source * string option -> InfEnv * Program

    val ppProgram : TextIO.outstream * int * Program -> unit
|#

(provide hamlet-parse)

(define (hamlet-parse s)
  (match-let (((vector InfEnv Program)
               ((let ()
                  (open-package Parse-struct)
                  parse)
                (vector-immutable (let ()
                                    (open-package InitialInfixEnv-struct)
                                    J0)
                                  (string-append s ";")
                                  NONE))))
    (let ((p (open-output-string)))
      ((let ()
         (open-package PPProgram-struct)
         ppProgram)
       (vector-immutable p 0 Program))
      (get-output-string p))))