Scheme from Scratch - Bootstrap v0.8 - Quote
Today we change our focus to the evaluate layer and the REPL really starts to come alive as a real interpreter of the Scheme language.
So far the REPL has been a pretty printer. The empty list, pairs, lists, symbols have been auto-quoting and echo back to you. By adding the
quote form we can end that pretty printing and have a proper REPL session:
$ ./scheme Welcome to Bootstrap Scheme. Use ctrl-c to exit. > (quote a) a > 'a a > (quote (0 1 2)) (0 1 2) > '(0 1 2) (0 1 2) > '() () > () > '#t #t > #t #t > '123 123 > 123 123 > '#\c #\c > #\c #\c > '"asdf" "asdf" > "asdf" "asdf"
You can see above that booleans, numbers, characters and strings are auto-quoting. If you try to enter just the empty list, a pair, list, or symbol the REPL will error as the evaluate layer doesn't know what to do with them yet.
When you look in the implementation. You will see that the single quote syntax is converted to a
quote form directly in the read layer of the interpreter.
There is a v0.8 branch on github for this version.
Have something to write? Comment on this article.