Created
May 24, 2011 09:04
-
-
Save Geal/988387 to your computer and use it in GitHub Desktop.
A simple command line REPL (run it with a headless image)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
OSProcess thisOSProcess stdOut | |
nextPutAll: 'Welcome to the simple Smalltalk REPL'; | |
nextPut: Character lf; nextPut: $>; flush. | |
[ |input| | |
[ input := OSProcess readFromStdIn. | |
input size > 0 ifTrue: [ | |
OSProcess thisOSProcess stdOut | |
nextPutAll: ((Compiler evaluate: input) asString; | |
nextPut: Character lf; nextPut: $>; flush | |
] | |
] repeat. | |
]forkAt: (Processor userBackgroundPriority) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment