]> gitweb.factorcode.org Git - factor.git/blob - basis/eval/eval.factor
Eliminate duplicate syntax for stack effects "(" no longer drops and is identical...
[factor.git] / basis / eval / eval.factor
1 ! Copyright (C) 2008, 2009 Slava Pestov.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: splitting parser parser.notes compiler.units kernel
4 namespaces debugger io.streams.string fry combinators
5 effects.parser continuations ;
6 IN: eval
7
8 : parse-string ( str -- quot )
9     [ string-lines parse-lines ] with-compilation-unit ;
10
11 : (eval) ( str effect -- )
12     [ parse-string ] dip call-effect ; inline
13
14 : eval ( str effect -- )
15     [ (eval) ] with-file-vocabs ; inline
16
17 SYNTAX: eval( \ eval parse-call( ;
18
19 : (eval>string) ( str -- output )
20     [
21         parser-quiet? on
22         '[ _ ( -- ) (eval) ] [ print-error ] recover
23     ] with-string-writer ;
24
25 : eval>string ( str -- output )
26     [ (eval>string) ] with-file-vocabs ;