Author: [pmarin] <
> Please add content only in the Comments, Bugs or News section. !!!!!! '''Jump to the news section''' !!!!!! ---- <> ---- **Introduction ** Muddy Scheme is an implementation of the Scheme language in Tcl. This interpreter tries to follow the awesome http://peter.michaux.ca/articles/scheme-from-scratch-introduction%|%"Scheme from Scratch"%|% articles written by Peter Michaux. **Features** * Procedures ** define ** lambda ** begin ** Lexically scoped variables ** Proper tail calls * Types ** integers ** characters ** pairs ** strings ** booleans * Primitives ** Type of Predicates *** null? *** boolean? *** symbol? *** number? *** integer? *** zero? *** char? *** string? *** pair? *** procedure? ** Type conversions *** char->integer *** integer->char *** number->string *** string->number *** symbol->string *** string->symbol ** Working with integers *** + *** - *** * *** quotient *** remainder *** = *** < *** > ** Working with pair and list *** cons *** car *** cdr *** set-car! *** set-cdr! ** Others *** exit *** quit (return to tclsh if you sourced muddy.tcl) **Requirements** Muddy Scheme needs Tcl8.6 and tcllib (struct::stack) **Install** The Github page is: http://github.com/pmarin/Muddy-Scheme <
> You can get the code with: $ git clone git://github.com/pmarin/Muddy-Scheme.git **Example of use** $ muddy.tcl Welcome to Muddy Scheme, Copyright (c) 2010 Franciso José Marín Pérez Use ctrl-c to exit. > #t #t > -123 123 > #\c #\c > "asdf" "asdf" > (quote ()) () > (quote (0 . 1)) (0 . 1) > (quote (0 1 2 3)) (0 1 2 3) > (quote asdf) asdf > (define a 1) ok > a 1 > (set! a 2) ok > a 2 > (if #t 1 2) 1 > (+ 1 2 3) 6 > + # >^c $ **Bugs** (2010-1-19) - A bug in the reader when Muddy is reading from a pipe (echo "#t" | muddy.tcl), probably becouse I am not testing the end of file properly. **News** (2010-1-18) Muddy is compliant with bootstrap-scheme v0.14. I need to fix bugs in the reader. <
> [Accumulator Generator]: ====== >(define (foo n) (lambda (i) (set! n (+ n i)) n)) >(define acc (foo 3)) ok > (acc 1) 4 > (acc 1) 5 > (acc 10) 15 > (acc 0) 15 ====== (2010-1-17) Muddy is compliant with bootstrap-scheme v0.12 <
> (2010-1-16) Currently the code is compliant with bootstrap-scheme v0.11 **License** MIT License <
> I give permission to wiki users to copy & paste the code in this wiki. **Comments** [pmarin]. Enjoy!!!