This project implements a lightweight SQL-like interpreter for querying CSV files using Flex (Lexical Analysis) and Bison (Syntax Analysis). It demonstrates compiler construction principles applied to real-world data filtering without requiring a full database system.
- SQL-like query syntax
SELECT column1, column2 FROM filename.csv WHERE column condition value;
- Supports:
- Multiple column selection
- WHERE clause with numeric and string conditions
- Lightweight and fast (no DBMS needed)
- Works with any CSV file
- Flex – Lexical Analyzer
- Bison – Parser Generator
- C Language
- GCC
- Linux
mini-sql-interpreter/
├── lexer.l # Token definitions (Flex)
├── parser.y # Grammar rules (Bison)
├── csv_utils.c # CSV processing logic
├── csv_utils.h # Function declarations
├── main.c # Entry point
├── Makefile # Build script
├── people.csv # Sample data
└── README.md # Documentation
sudo apt-get install flex bison
git clone https://github.com/Slightsmile/Mini-Sql-Interpreter.git
cd mini-sql-interpreter
make
./mini_sql
SELECT name, age FROM people.csv WHERE age > 30;
SELECT name, city FROM people.csv WHERE city = "Dhaka";
- Invalid query → Error: syntax error
- Missing file → Cannot open CSV file
This project is open source and available under the MIT License. Feel free to use and modify it for personal use.
Developed as a part of the Compiler Desgin Lab Project at Daffodil International University.