Skip to content

AndrewRademacher/ptscheme

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

93 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ptscheme v0.1

Build Status

Overview

My take on a Scheme dialect LISP implementation realized in 'C' with enough functionality to complete the excercises in the Purple Wizard book, "Structure and Interpretation of Computer Programs"

Current Status

The basic interpreter now functions; however, a standard library has not yet been implemented. Also, there are numerous clean-up tasks and enhancements I would like to complete before calling it a "1.0" version.

Getting things running

The following instructions have been tested on OS X v10.10.5. I'm sure they assume that certain dev tools are already installed, but I haven't yet tested from a clean OS to confirm the full set of requirements. Basically, if you have enough to complie C code with clang (Apple's gcc-style compliler), can run 'make', and have git installed you're on your way.

Clone:

$ git clone https://github.com/ptdecker/ptscheme.git
$ cd ptscheme

Build:

$ make

Test (not full coverage):

$ make clean
$ make
$ make test

Run:

$ ./ptscheme

Implementation notes and credits

Partial compiance with the R5RS standard is attempted, but I have included variations (such as C-style character literals).

This implementation of Scheme draws heavily from the following sources:

The following changes have been made from Michaux:

  • Broke apart into logical (hopefully) modules instead of one big source file
  • Inclusion of an error type so that malformed input doesn't kill the REPL
  • Handled the singleton boolean object type differently to parallel other objects
  • Implemented characters using C-style character literals
  • Included support for all C-style escape sequences except for octal and hex
  • Echoed the way the singleton boolean was handled for singleton empty
  • Handled 'quote', 'define', 'set', 'ok', 'if', and lambda symbols as singletons too
  • Implemented hash table-based symbol table [O(1)] as opposed to reusing pairs approach [O(n)]
  • Avoided goto-based tail recurrsion call approach
  • Included an 'exit' primitive

About

A basic implementation of a Scheme dialog of LISP in 'C' for SCIP excercise work (only in OS X shell for now)

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C 98.0%
  • Makefile 2.0%