-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added SQL parser generation support/Refactored parser dir/fixed workf…
…lows problems
- Loading branch information
Showing
28 changed files
with
100,447 additions
and
243 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,3 +8,4 @@ ignore: | |
- trace | ||
- testutil | ||
- examples | ||
- parser |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
IMAGE_NAME=yql-antlr-parser:latest | ||
ANTLR_VERSION=4.13.2 | ||
CURRENT_DIR := $(shell pwd) | ||
|
||
.PHONY: all | ||
all: yql sql | ||
|
||
.PHONY: yql | ||
yql: build-image | ||
docker run --rm -v "$(CURRENT_DIR)/yql":/workspace/yql $(IMAGE_NAME) \ | ||
java -jar /antlr-${ANTLR_VERSION}-complete.jar -Dlanguage=Go -package yql -o yql YQLv1Antlr4.g4 | ||
|
||
.PHONY: sql | ||
sql: build-image | ||
docker run --rm -v "$(CURRENT_DIR)/sql":/workspace/sql $(IMAGE_NAME) \ | ||
java -jar /antlr-${ANTLR_VERSION}-complete.jar -Dlanguage=Go -package sql -o sql SQLv1Antlr4.g4 | ||
|
||
|
||
.PHONY: build-image | ||
build-image: | ||
docker build -t $(IMAGE_NAME) . | ||
|
||
|
||
.PHONY: clean_yql | ||
clean_yql: | ||
rm -rf yql/*.go | ||
rm -rf yql/*.interp | ||
rm -rf yql/*.tokens | ||
|
||
.PHONY: clean_sql | ||
clean_sql: | ||
rm -rf sql/*.go | ||
rm -rf sql/*.interp | ||
rm -rf sql/*.tokens | ||
|
||
.PHONY: clean | ||
clean: clean_yql clean_sql | ||
|
||
|
||
.PHONY: regenerate_yql | ||
regenerate_yql: clean_yql yql | ||
|
||
.PHONY: regenerate_sql | ||
regenerate_sql: clean_sql sql | ||
|
||
.PHONY: regenerate | ||
regenerate: regenerate_yql regenerate_sql |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
# YQL ANTLR Parser Generator | ||
|
||
This project provides code generation of YQL and SQL parsers using ANTLR4. | ||
|
||
--- | ||
|
||
## Makefile Targets | ||
|
||
### General Targets | ||
|
||
- **`all`** | ||
Generates both YQL and SQL parsers. | ||
```bash | ||
make all | ||
``` | ||
|
||
- **`build-image`** | ||
Builds the Docker image required for parser generation. | ||
```bash | ||
make build-image | ||
``` | ||
|
||
- **`clean`** | ||
Cleans all generated files for both YQL and SQL. | ||
```bash | ||
make clean | ||
``` | ||
|
||
- **`regenerate`** | ||
Cleans and regenerates all parser files (YQL and SQL). | ||
```bash | ||
make regenerate | ||
``` | ||
### YQL Parser Targets | ||
|
||
- **`yql`** | ||
Generates the YQL parser files. | ||
```bash | ||
make yql | ||
``` | ||
|
||
- **`clean_yql`** | ||
Removes all generated YQL parser files (`*.go`, `*.interp`, `*.tokens`). | ||
```bash | ||
make clean_yql | ||
``` | ||
|
||
- **`regenerate_yql`** | ||
Cleans and regenerates the YQL parser files. | ||
```bash | ||
make regenerate_yql | ||
``` | ||
|
||
### SQL Parser Targets | ||
|
||
- **`sql`** | ||
Generates the SQL parser files. | ||
```bash | ||
make sql | ||
``` | ||
|
||
- **`clean_sql`** | ||
Removes all generated SQL parser files (`*.go`, `*.interp`, `*.tokens`). | ||
```bash | ||
make clean_sql | ||
``` | ||
|
||
- **`regenerate_sql`** | ||
Cleans and regenerates the SQL parser files. | ||
```bash | ||
make regenerate_sql | ||
``` | ||
|
||
--- | ||
|
||
## Project Structure | ||
|
||
- **`yql/`**: Directory for YQL parser files. | ||
- **`sql/`**: Directory for SQL parser files. | ||
- **`Dockerfile`**: Dockerfile for the parser generation environment. | ||
- **`Makefile`**: Contains all automation commands. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
module ydb-go-sdk/parser | ||
|
||
go 1.23.4 | ||
|
||
require ( | ||
github.com/antlr4-go/antlr/v4 v4.13.1 | ||
golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842 // indirect | ||
) |
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.