A Scheme programming language interpreter implemented in C++17.
This project is an implementation of an interpreter for the Scheme dialect of Lisp.
It supports basic operations, functions, lambda expressions, and control structures.
- Basic operations: addition (+), subtraction (-), multiplication (*), division (/)
- Data types: numbers, symbols, lists, booleans
- Functions: lambda expressions and user-defined functions
- Control structures: if, and, or
- Scopes: local and global variable support
- Interactive mode: REPL (Read-Eval-Print Loop)
- Script execution: run Scheme programs from files
- CMake 3.10 or higher
- C++17-compatible compiler (GCC, Clang, MSVC)
# Clone the repository
git clone https://github.com/Lawrence1947/Scheme.git
cd Scheme
# Create build directory
mkdir build
cd build
# Configure and build
cmake ..
make
# Run
./Scheme./SchemeAfter launching, you’ll see the >>> prompt where you can enter Scheme expressions:
>>> (+ 2 3)
5
>>> (define x 10)
>>> (* x 5)
50
>>> (lambda (x) (+ x x))
(lambda-function)./Scheme script.scmThe file should contain valid Scheme expressions, one per line.
(+ 1 2 3 4 5)
(* 2 3 4)
(- 10 3)
(/ 15 3)(define x 42)
(define y (+ x 8))(define double (lambda (x) (+ x x)))
(double 5)(if (> 5 3) #t #f)
(and (> 5 3) (< 2 4))The interpreter supports multiple types of errors:
- SyntaxError – syntax-related issues
- RuntimeError – runtime execution errors
- NameError – undefined variable or function references
- Only integer numbers are supported
- Limited data type coverage
- Basic standard library implementation
- Floating-point number support
- Strings and symbols
- Vectors and arrays
- Macros
- Extended standard library
- Performance optimization
- Implement loops (for/while)