factor/basis/eval/eval.factor

24 lines
595 B
Factor
Raw Normal View History

2009-01-27 05:11:43 -05:00
! Copyright (C) 2008, 2009 Slava Pestov.
2008-07-28 23:03:13 -04:00
! See http://factorcode.org/license.txt for BSD license.
USING: splitting parser compiler.units kernel namespaces
2009-01-27 05:11:43 -05:00
debugger io.streams.string fry ;
2008-07-28 23:03:13 -04:00
IN: eval
2009-03-16 21:11:36 -04:00
: parse-string ( str -- quot )
2009-01-27 05:11:43 -05:00
[ string-lines parse-lines ] with-compilation-unit ;
: (eval) ( str -- )
parse-string call ;
2008-07-28 23:03:13 -04:00
: eval ( str -- )
2009-01-27 05:11:43 -05:00
[ (eval) ] with-file-vocabs ;
2008-07-28 23:03:13 -04:00
2009-01-27 05:11:43 -05:00
: (eval>string) ( str -- output )
2008-07-28 23:03:13 -04:00
[
2009-01-27 05:11:43 -05:00
"quiet" on
2008-07-28 23:03:13 -04:00
parser-notes off
2009-01-27 05:11:43 -05:00
'[ _ (eval) ] try
2008-07-28 23:03:13 -04:00
] with-string-writer ;
2009-01-27 05:11:43 -05:00
: eval>string ( str -- output )
[ (eval>string) ] with-file-vocabs ;