1 ! Copyright (C) 2009 Slava Pestov.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: kernel prettyprint io io.styles colors.constants compiler.units
4 fry debugger sequences locals.rewrite.closures smalltalk.ast
5 smalltalk.parser smalltalk.compiler smalltalk.printer ;
8 : eval-smalltalk ( string -- )
10 parse-smalltalk-statement compile-statement rewrite-closures first
11 ] with-compilation-unit call( -- result )
12 dup nil? [ drop ] [ "Result: " write smalltalk>string print ] if ;
14 : smalltalk-listener ( -- )
15 "Smalltalk>" { { background COLOR: light-blue } } format bl flush readln
16 [ '[ _ eval-smalltalk ] try smalltalk-listener ] when* ;
18 MAIN: smalltalk-listener