cleaned up documentation

This commit is contained in:
Pedro 2016-02-27 16:58:51 +01:00
parent ef7c3cf349
commit c8e8abf0b3
6 changed files with 28 additions and 62 deletions

View File

@ -9,20 +9,25 @@ In March 2015 we've also written a short paper outlining discussing some develop
### Usage ### Usage
To use the SQL parser in your own projects you simply have to follow these few steps. The only requirement for is GCC 4.8+. Older versions of GCC probably also work, but are untested. **Requirements:**
* gcc 4.8+
To use the SQL parser in your own projects you simply have to follow these few steps. The only requirement for is gcc 4.8+. Older versions of gcc might also work, but are untested.
1. Download the [latest release here](https://github.com/hyrise/sql-parser/releases) 1. Download the [latest release here](https://github.com/hyrise/sql-parser/releases)
2. Compile the library `make` to create `libsqlparser.so` 2. Compile the library `make` to create `libsqlparser.so`
3. *(Optional)* Run `make install` to copy the library to `/usr/local/lib/`
3. Run the tests `make test` to make sure everything worked 3. Run the tests `make test` to make sure everything worked
4. Take a look at the [example project here](https://github.com/hyrise/sql-parser/tree/dynamic-library/example) 4. Take a look at the [example project here](https://github.com/hyrise/sql-parser/tree/master/example)
5. Include the `SQLParser.h` from `src/` and link the library in your project 5. Include the `SQLParser.h` from `src/` and link the library in your project
### Development ### Development
**Prerequisites:** **Requirements for development:**
* [bison](https://www.gnu.org/software/bison/) (tested with v3.0.2) * gcc 4.8 (or newer)
* [flex](http://flex.sourceforge.net/) (tested with v2.5.5) * [bison](https://www.gnu.org/software/bison/) (tested with v3.0.2)
* [flex](http://flex.sourceforge.net/) (tested with v2.5.5)
First step to extending this parser is cloning the repository `git clone git@github.com:hyrise/sql-parser.git` and making sure everything works by running the following steps: First step to extending this parser is cloning the repository `git clone git@github.com:hyrise/sql-parser.git` and making sure everything works by running the following steps:
@ -45,12 +50,10 @@ make test # build parser, library and runs the tests
We strongly encourage you to contribute to this project! If you want to contribute to this project there are several options. If you've noticed a bug or would like an improvement let us know by creating a [new issue](https://github.com/hyrise/sql-parser/issues). If you want to develop a new feature yourself or just improve the quality of the system, feel free to fork the reposistory and implement your changes. Open a pull request as soon as your done and we will look over it. If we think it's good then your pull request will be merged into this repository. We strongly encourage you to contribute to this project! If you want to contribute to this project there are several options. If you've noticed a bug or would like an improvement let us know by creating a [new issue](https://github.com/hyrise/sql-parser/issues). If you want to develop a new feature yourself or just improve the quality of the system, feel free to fork the reposistory and implement your changes. Open a pull request as soon as your done and we will look over it. If we think it's good then your pull request will be merged into this repository.
### Documenation ### Resources
* [Working Syntax Examples](docs/syntax.md) * [Working Syntax Examples](docs/syntax.md)
* [Known Issues](docs/issues.md) * [Developer Documentation](docs/dev-docs.md)
* [Developer Documentation](docs/documentation.md)
* [Integration in Hyrise](docs/integration.md)
### License ### License

View File

@ -1,29 +1,31 @@
Developer Documentation Developer Documentation
======================= =======================
This page contains information about how to extend this parser with new functionalities. ## Developing New Functionality
This section contains information about how to extend this parser with new functionalities.
### Implementing a new Statement
## Implementing Statement Class Create a new file and class in `src/sql/` or extend any of the existing Statements. Every statement needs to have the base class SQLStatement and needs to call its super constructor with its type. If your defining a new statement type, you need to define a new StatementType in `SQLStatement.h`.
Create a new file and class in src/lib/statements/ or extend any of the existing Statements. Every statement needs to have the base class SQLStatement and needs to call its super constructor with its type. If your defining a new statement type, you need to define a new StatementType in SQLStatement.h.
It is important that you create an appropriate constructor for your statement that zero-initializes all its pointer variables and that your create an appropriate destructor. It is important that you create an appropriate constructor for your statement that zero-initializes all its pointer variables and that your create an appropriate destructor.
Lastly you need to include your new file in src/lib/sqllib.h Finally you will need to include your new file in `src/sql/statements.h`.
### Extending the Grammar
## Extending the Grammar
Related files: Related files:
* src/parser/bison_parser.y ````
* src/parser/flex_lexer.l src/parser/bison_parser.y
* src/parser/keywordlist_generator.py src/parser/flex_lexer.l
* src/parser/sql_keywords.txt src/parser/keywordlist_generator.py
src/parser/sql_keywords.txt
```
To extend the grammar the file you will mostly have to deal with is the bison grammar definition in src/parser/bison_parser.y. To extend the grammar the file you will mostly have to deal with is the bison grammar definition in `src/parser/bison_parser.y`.
If your extending an existing statement, skip to the non-terminal definition for that statement. I.e. for an InsertStatement the non-terminal insert_statement. If your extending an existing statement, skip to the non-terminal definition for that statement. I.e. for an InsertStatement the non-terminal insert_statement.
@ -33,7 +35,6 @@ If your defining a new statement, you will need to define your type in the \%uni
## Implementing Tests ## Implementing Tests
Related files: All test related files are in `test/`. Take a look to see how tests are implemented.
* src/sql_tests.cpp

View File

@ -1,20 +0,0 @@
@PROJECT_NAME = "SQL Parser for Hyrise (C++)"
@OUTPUT_DIRECTORY = docs/__doxygen__/
@GENERATE_LATEX = NO
@GENERATE_HTML = YES
@INCLUDE_FILE_PATTERNS = *.y *.l
@FILE_PATTERNS = *.y *.l *.h *.cpp *.md
@INPUT = README.md \
docs/ \
src/parser/SQLParser.h \
src/parser/SQLParser.cpp \
src/parser/bison_parser.y \
src/parser/flex_lexer.l \
src/lib/ \
@RECURSIVE = YES

View File

@ -1,8 +0,0 @@
Integration in Hyrise
=====================
On this page we describe how to integrate changes to the parser into Hyrise.
## Update the Parser code in Hyrise
Run `./deploy_to_hyrise.sh path/to/hyrise` to update the SQL parser code within Hyrise.

View File

@ -1,10 +0,0 @@
Known Issues
============
Here we will keep track of issues with the parser and the integration in Hyrise.
## Missing Functionality
* Union clauses
* Create anything other than tables
* Alter/Rename statements