Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/camertron/mysql-parser-rb

A MySQL query parser for Ruby.
https://github.com/camertron/mysql-parser-rb

Last synced: 18 days ago
JSON representation

A MySQL query parser for Ruby.

Awesome Lists containing this project

README

        

# mysql-parser-rb
A MySQL query parser for Ruby.

NOTE: this thing doesn't work yet.

# What?

This repo is an attempt to write Ruby bindings for parsers generated by [ANTLR](https://github.com/antlr/antlr4). I've started out by generating a parser for MySQL queries, but hopefully that's just the beginning. It would be rad to be able to generate parsers for arbitrary ANTLR grammars and make them available to Ruby, complete with visitors, listeners, etc.

# Local Dev

1. Initialize the ANTLR submodule:
```bash
git submodule init
```
2. Install dependencies:
```bash
bundle install
```
3. Generate a makefile:
```
ruby ext/mysql-parser/extconf.rb
```
4. Build
```bash
make
```
5. Run the test script
```bash
bundle exec ruby tester.rb
```

You should see a segfault. Everything appears to work except for at the very end when Ruby tries to exit. Trying to figure out why. It seems to only happen if a C++ object is referenced in Ruby. It doesn't even have to be retained to cause the segfault, only referenced.

# Authors

Cameron C. Dutro [https://github.com/camertron](https://github.com/camertron)