]> gitweb.factorcode.org Git - factor.git/blob - extra/smalltalk/listener/listener.factor
smalltalk: adding a small library, fix various bugs
[factor.git] / extra / smalltalk / listener / listener.factor
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 ;
6 IN: smalltalk.listener
7
8 : eval-smalltalk ( string -- )
9     [
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 ;
13
14 : smalltalk-listener ( -- )
15     "Smalltalk>" { { background COLOR: light-blue } } format bl flush readln
16     [ '[ _ eval-smalltalk ] try smalltalk-listener ] when* ;
17
18 MAIN: smalltalk-listener