This is a project folder for my attempt to implement some of the phases of the cs222 project in Common Lisp.
- [X] Phase 1 - Record Management and Buffering
- [X] Phase 2 - Indexing
- [ ] Phase 3 - Relational Operators
- [ ] Phase 4 - Query Optimization
See description of phases at CS222 Project Page.
sbcl
including flexi-streams
, fucc
, and cl-ppcre
.
autoconf
.
To install the prerequisites, first
sudo apt-get install sbcl
sudo apt-get install autoconf
Start up sbcl
as root
.
sudo sbcl
and enter the following code to get flexi-streams
, fucc
, and cl-ppcre
:
(require 'asdf-install)
;; you will most likely want to do a system install
;; ignore any GPG signature warnings
(asdf-install:install 'flexi-streams) ;; in-memory binary streams
(asdf-install:install 'cl-ppcre) ;; pearl regular expressions
(asdf-install:install 'fucc) ;; macro for parsing
Additionally, I highly recommended SLIME for Emacs, although it is not necessary for compiling the code.
sudo apt-get install slime
autoconf && ./configure && make
This will create the binary simpledb
.
Use the provided data/first.txt
and data/last.txt
files to create
an example database file, then start the SQL parser.
./simpledb convert data/first.txt int,string
./simpledb convert data/last.txt string,int
Now you can start the SQL parser using the following data/schema.txt
:
first ( id int, name string ); last ( name string, id int );
./simpledb parser data/schema.txt
From here, you can perform SQL queries on the database, such as the following.
> SELECT first.name, last.name FROM first,last WHERE first.id = last.id; "Michael","Zeller" >
The following grammar is currently implemented:
SELECT fields FROM tables [WHERE where-clause] DELETE FROM table WHERE where-clause