home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Source Code / C / Applications / Moscow ML 1.42 / examples / calc / calc.sml next >
Encoding:
Text File  |  1997-08-18  |  428 b   |  18 lines  |  [TEXT/R*ch]

  1. local open BasicIO Nonstdio in
  2.  
  3. fun createLexerStream (is : instream) =
  4.   Lexing.createLexer (fn buff => fn n => Nonstdio.buff_input is buff 0 n)
  5. ;
  6.  
  7. val _ =
  8.   (while true do
  9.        let val lexbuf = createLexerStream std_in 
  10.        val () = print "Enter an integer expression: \n"
  11.        val result = Parser.Main Lexer.Token lexbuf
  12.        in
  13.        print (makestring result ^ "\n")
  14.        end)
  15.        handle _ => print "Bye-bye!\n";
  16.  
  17. end
  18.