Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bundle precompiled antlr parser #459

Open
wants to merge 17 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ jobs:
key: cljdeps-${{ hashFiles('deps.edn') }}

- name: Execute tests
run: clojure -X:dev:test
run: clojure -T:build compile-java && clojure -X:dev:test
11 changes: 10 additions & 1 deletion build.clj
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,25 @@

(def lib 'com.walmartlabs/lacinia)
(def version (-> "VERSION.txt" slurp string/trim))
(def class-dir "target/classes")

(def jar-params {:project-name lib
:version version})
:version version
:class-dir class-dir})

(defn clean
[_params]
(build/delete {:path "target"}))

(defn compile-java [_]
(build/javac {:src-dirs ["java"]
:class-dir class-dir
:basis (build/create-basis)
:javac-opts ["--release" "11"]}))

(defn jar
[_params]
(compile-java nil)
(b/create-jar jar-params))

(defn deploy
Expand Down
13 changes: 13 additions & 0 deletions codegen.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/sh

set -x

pip install antlr4-tools

export ANTLR4_TOOLS_ANTLR_VERSION=4.13.1

PACKAGE_NAME=com.walmartlabs.lacinia
DIR=$(echo $PACKAGE_NAME | tr . /)

antlr4 resources/$DIR/Graphql.g4 -o java/$DIR -Xexact-output-dir -package $PACKAGE_NAME
antlr4 resources/$DIR/GraphqlSchema.g4 -o java/$DIR -Xexact-output-dir -package $PACKAGE_NAME
10 changes: 8 additions & 2 deletions deps.edn
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
{:deps {org.clojure/clojure {:mvn/version "1.11.1"}
clj-antlr/clj-antlr {:mvn/version "0.2.12"}
org.antlr/antlr4-runtime {:mvn/version "4.13.1"}
org.flatland/ordered {:mvn/version "1.15.10"}
org.clojure/data.json {:mvn/version "2.4.0"}}
:paths ["src" "resources"]
:paths ["src" "resources" "target/classes"]

:deps/prep-lib
{:ensure "target/classes"
:alias :build
:fn compile-java}

:aliases
{:dev
{:extra-deps {criterium/criterium {:mvn/version "0.4.6"}
Expand Down
104 changes: 104 additions & 0 deletions java/com/walmartlabs/lacinia/Graphql.interp
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
token literal names:
null
'query'
'mutation'
'subscription'
'('
')'
':'
'$'
'='
'{'
'}'
'...'
'on'
'fragment'
'['
']'
'@'
'!'
null
null
'null'
null
null
null
'-'
null
null
null
null
null
null
null

token symbolic names:
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
BooleanValue
NullValue
Null
NameId
IntValue
FloatValue
Sign
IntegerPart
NonZeroDigit
ExponentPart
Digit
StringValue
BlockStringValue
Ignored

rule names:
document
definition
operationDefinition
name
operationType
variableDefinitions
variableDefinition
variable
defaultValue
selectionSet
selection
field
alias
arguments
argument
fragmentSpread
inlineFragment
fragmentDefinition
fragmentName
typeCondition
value
enumValue
arrayValue
objectValue
objectField
directives
directive
type
typeName
listType
nonNullType


atn:
[4, 1, 31, 243, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, 7, 14, 2, 15, 7, 15, 2, 16, 7, 16, 2, 17, 7, 17, 2, 18, 7, 18, 2, 19, 7, 19, 2, 20, 7, 20, 2, 21, 7, 21, 2, 22, 7, 22, 2, 23, 7, 23, 2, 24, 7, 24, 2, 25, 7, 25, 2, 26, 7, 26, 2, 27, 7, 27, 2, 28, 7, 28, 2, 29, 7, 29, 2, 30, 7, 30, 1, 0, 4, 0, 64, 8, 0, 11, 0, 12, 0, 65, 1, 1, 1, 1, 3, 1, 70, 8, 1, 1, 2, 1, 2, 1, 2, 3, 2, 75, 8, 2, 1, 2, 3, 2, 78, 8, 2, 1, 2, 3, 2, 81, 8, 2, 1, 2, 1, 2, 3, 2, 85, 8, 2, 1, 3, 1, 3, 1, 4, 1, 4, 1, 5, 1, 5, 4, 5, 93, 8, 5, 11, 5, 12, 5, 94, 1, 5, 1, 5, 1, 6, 1, 6, 1, 6, 1, 6, 3, 6, 103, 8, 6, 1, 7, 1, 7, 1, 7, 1, 8, 1, 8, 1, 8, 1, 9, 1, 9, 4, 9, 113, 8, 9, 11, 9, 12, 9, 114, 1, 9, 1, 9, 1, 10, 1, 10, 1, 10, 3, 10, 122, 8, 10, 1, 11, 3, 11, 125, 8, 11, 1, 11, 1, 11, 3, 11, 129, 8, 11, 1, 11, 3, 11, 132, 8, 11, 1, 11, 3, 11, 135, 8, 11, 1, 12, 1, 12, 1, 12, 1, 13, 1, 13, 4, 13, 142, 8, 13, 11, 13, 12, 13, 143, 1, 13, 1, 13, 1, 14, 1, 14, 1, 14, 1, 14, 1, 15, 1, 15, 1, 15, 3, 15, 155, 8, 15, 1, 16, 1, 16, 1, 16, 1, 16, 3, 16, 161, 8, 16, 1, 16, 1, 16, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 3, 17, 170, 8, 17, 1, 17, 1, 17, 1, 18, 1, 18, 1, 19, 1, 19, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 3, 20, 188, 8, 20, 1, 21, 1, 21, 1, 22, 1, 22, 5, 22, 194, 8, 22, 10, 22, 12, 22, 197, 9, 22, 1, 22, 1, 22, 1, 23, 1, 23, 5, 23, 203, 8, 23, 10, 23, 12, 23, 206, 9, 23, 1, 23, 1, 23, 1, 24, 1, 24, 1, 24, 1, 24, 1, 25, 4, 25, 215, 8, 25, 11, 25, 12, 25, 216, 1, 26, 1, 26, 1, 26, 3, 26, 222, 8, 26, 1, 27, 1, 27, 1, 27, 3, 27, 227, 8, 27, 1, 28, 1, 28, 1, 29, 1, 29, 1, 29, 1, 29, 1, 30, 1, 30, 1, 30, 1, 30, 1, 30, 1, 30, 3, 30, 241, 8, 30, 1, 30, 0, 0, 31, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 0, 2, 2, 0, 1, 3, 21, 21, 1, 0, 1, 3, 246, 0, 63, 1, 0, 0, 0, 2, 69, 1, 0, 0, 0, 4, 84, 1, 0, 0, 0, 6, 86, 1, 0, 0, 0, 8, 88, 1, 0, 0, 0, 10, 90, 1, 0, 0, 0, 12, 98, 1, 0, 0, 0, 14, 104, 1, 0, 0, 0, 16, 107, 1, 0, 0, 0, 18, 110, 1, 0, 0, 0, 20, 121, 1, 0, 0, 0, 22, 124, 1, 0, 0, 0, 24, 136, 1, 0, 0, 0, 26, 139, 1, 0, 0, 0, 28, 147, 1, 0, 0, 0, 30, 151, 1, 0, 0, 0, 32, 156, 1, 0, 0, 0, 34, 164, 1, 0, 0, 0, 36, 173, 1, 0, 0, 0, 38, 175, 1, 0, 0, 0, 40, 187, 1, 0, 0, 0, 42, 189, 1, 0, 0, 0, 44, 191, 1, 0, 0, 0, 46, 200, 1, 0, 0, 0, 48, 209, 1, 0, 0, 0, 50, 214, 1, 0, 0, 0, 52, 218, 1, 0, 0, 0, 54, 226, 1, 0, 0, 0, 56, 228, 1, 0, 0, 0, 58, 230, 1, 0, 0, 0, 60, 240, 1, 0, 0, 0, 62, 64, 3, 2, 1, 0, 63, 62, 1, 0, 0, 0, 64, 65, 1, 0, 0, 0, 65, 63, 1, 0, 0, 0, 65, 66, 1, 0, 0, 0, 66, 1, 1, 0, 0, 0, 67, 70, 3, 4, 2, 0, 68, 70, 3, 34, 17, 0, 69, 67, 1, 0, 0, 0, 69, 68, 1, 0, 0, 0, 70, 3, 1, 0, 0, 0, 71, 85, 3, 18, 9, 0, 72, 74, 3, 8, 4, 0, 73, 75, 3, 6, 3, 0, 74, 73, 1, 0, 0, 0, 74, 75, 1, 0, 0, 0, 75, 77, 1, 0, 0, 0, 76, 78, 3, 10, 5, 0, 77, 76, 1, 0, 0, 0, 77, 78, 1, 0, 0, 0, 78, 80, 1, 0, 0, 0, 79, 81, 3, 50, 25, 0, 80, 79, 1, 0, 0, 0, 80, 81, 1, 0, 0, 0, 81, 82, 1, 0, 0, 0, 82, 83, 3, 18, 9, 0, 83, 85, 1, 0, 0, 0, 84, 71, 1, 0, 0, 0, 84, 72, 1, 0, 0, 0, 85, 5, 1, 0, 0, 0, 86, 87, 7, 0, 0, 0, 87, 7, 1, 0, 0, 0, 88, 89, 7, 1, 0, 0, 89, 9, 1, 0, 0, 0, 90, 92, 5, 4, 0, 0, 91, 93, 3, 12, 6, 0, 92, 91, 1, 0, 0, 0, 93, 94, 1, 0, 0, 0, 94, 92, 1, 0, 0, 0, 94, 95, 1, 0, 0, 0, 95, 96, 1, 0, 0, 0, 96, 97, 5, 5, 0, 0, 97, 11, 1, 0, 0, 0, 98, 99, 3, 14, 7, 0, 99, 100, 5, 6, 0, 0, 100, 102, 3, 54, 27, 0, 101, 103, 3, 16, 8, 0, 102, 101, 1, 0, 0, 0, 102, 103, 1, 0, 0, 0, 103, 13, 1, 0, 0, 0, 104, 105, 5, 7, 0, 0, 105, 106, 3, 6, 3, 0, 106, 15, 1, 0, 0, 0, 107, 108, 5, 8, 0, 0, 108, 109, 3, 40, 20, 0, 109, 17, 1, 0, 0, 0, 110, 112, 5, 9, 0, 0, 111, 113, 3, 20, 10, 0, 112, 111, 1, 0, 0, 0, 113, 114, 1, 0, 0, 0, 114, 112, 1, 0, 0, 0, 114, 115, 1, 0, 0, 0, 115, 116, 1, 0, 0, 0, 116, 117, 5, 10, 0, 0, 117, 19, 1, 0, 0, 0, 118, 122, 3, 22, 11, 0, 119, 122, 3, 30, 15, 0, 120, 122, 3, 32, 16, 0, 121, 118, 1, 0, 0, 0, 121, 119, 1, 0, 0, 0, 121, 120, 1, 0, 0, 0, 122, 21, 1, 0, 0, 0, 123, 125, 3, 24, 12, 0, 124, 123, 1, 0, 0, 0, 124, 125, 1, 0, 0, 0, 125, 126, 1, 0, 0, 0, 126, 128, 3, 6, 3, 0, 127, 129, 3, 26, 13, 0, 128, 127, 1, 0, 0, 0, 128, 129, 1, 0, 0, 0, 129, 131, 1, 0, 0, 0, 130, 132, 3, 50, 25, 0, 131, 130, 1, 0, 0, 0, 131, 132, 1, 0, 0, 0, 132, 134, 1, 0, 0, 0, 133, 135, 3, 18, 9, 0, 134, 133, 1, 0, 0, 0, 134, 135, 1, 0, 0, 0, 135, 23, 1, 0, 0, 0, 136, 137, 3, 6, 3, 0, 137, 138, 5, 6, 0, 0, 138, 25, 1, 0, 0, 0, 139, 141, 5, 4, 0, 0, 140, 142, 3, 28, 14, 0, 141, 140, 1, 0, 0, 0, 142, 143, 1, 0, 0, 0, 143, 141, 1, 0, 0, 0, 143, 144, 1, 0, 0, 0, 144, 145, 1, 0, 0, 0, 145, 146, 5, 5, 0, 0, 146, 27, 1, 0, 0, 0, 147, 148, 3, 6, 3, 0, 148, 149, 5, 6, 0, 0, 149, 150, 3, 40, 20, 0, 150, 29, 1, 0, 0, 0, 151, 152, 5, 11, 0, 0, 152, 154, 3, 36, 18, 0, 153, 155, 3, 50, 25, 0, 154, 153, 1, 0, 0, 0, 154, 155, 1, 0, 0, 0, 155, 31, 1, 0, 0, 0, 156, 157, 5, 11, 0, 0, 157, 158, 5, 12, 0, 0, 158, 160, 3, 38, 19, 0, 159, 161, 3, 50, 25, 0, 160, 159, 1, 0, 0, 0, 160, 161, 1, 0, 0, 0, 161, 162, 1, 0, 0, 0, 162, 163, 3, 18, 9, 0, 163, 33, 1, 0, 0, 0, 164, 165, 5, 13, 0, 0, 165, 166, 3, 36, 18, 0, 166, 167, 5, 12, 0, 0, 167, 169, 3, 38, 19, 0, 168, 170, 3, 50, 25, 0, 169, 168, 1, 0, 0, 0, 169, 170, 1, 0, 0, 0, 170, 171, 1, 0, 0, 0, 171, 172, 3, 18, 9, 0, 172, 35, 1, 0, 0, 0, 173, 174, 3, 6, 3, 0, 174, 37, 1, 0, 0, 0, 175, 176, 3, 56, 28, 0, 176, 39, 1, 0, 0, 0, 177, 188, 5, 22, 0, 0, 178, 188, 5, 23, 0, 0, 179, 188, 5, 29, 0, 0, 180, 188, 5, 30, 0, 0, 181, 188, 5, 18, 0, 0, 182, 188, 5, 19, 0, 0, 183, 188, 3, 42, 21, 0, 184, 188, 3, 44, 22, 0, 185, 188, 3, 46, 23, 0, 186, 188, 3, 14, 7, 0, 187, 177, 1, 0, 0, 0, 187, 178, 1, 0, 0, 0, 187, 179, 1, 0, 0, 0, 187, 180, 1, 0, 0, 0, 187, 181, 1, 0, 0, 0, 187, 182, 1, 0, 0, 0, 187, 183, 1, 0, 0, 0, 187, 184, 1, 0, 0, 0, 187, 185, 1, 0, 0, 0, 187, 186, 1, 0, 0, 0, 188, 41, 1, 0, 0, 0, 189, 190, 3, 6, 3, 0, 190, 43, 1, 0, 0, 0, 191, 195, 5, 14, 0, 0, 192, 194, 3, 40, 20, 0, 193, 192, 1, 0, 0, 0, 194, 197, 1, 0, 0, 0, 195, 193, 1, 0, 0, 0, 195, 196, 1, 0, 0, 0, 196, 198, 1, 0, 0, 0, 197, 195, 1, 0, 0, 0, 198, 199, 5, 15, 0, 0, 199, 45, 1, 0, 0, 0, 200, 204, 5, 9, 0, 0, 201, 203, 3, 48, 24, 0, 202, 201, 1, 0, 0, 0, 203, 206, 1, 0, 0, 0, 204, 202, 1, 0, 0, 0, 204, 205, 1, 0, 0, 0, 205, 207, 1, 0, 0, 0, 206, 204, 1, 0, 0, 0, 207, 208, 5, 10, 0, 0, 208, 47, 1, 0, 0, 0, 209, 210, 3, 6, 3, 0, 210, 211, 5, 6, 0, 0, 211, 212, 3, 40, 20, 0, 212, 49, 1, 0, 0, 0, 213, 215, 3, 52, 26, 0, 214, 213, 1, 0, 0, 0, 215, 216, 1, 0, 0, 0, 216, 214, 1, 0, 0, 0, 216, 217, 1, 0, 0, 0, 217, 51, 1, 0, 0, 0, 218, 219, 5, 16, 0, 0, 219, 221, 3, 6, 3, 0, 220, 222, 3, 26, 13, 0, 221, 220, 1, 0, 0, 0, 221, 222, 1, 0, 0, 0, 222, 53, 1, 0, 0, 0, 223, 227, 3, 56, 28, 0, 224, 227, 3, 58, 29, 0, 225, 227, 3, 60, 30, 0, 226, 223, 1, 0, 0, 0, 226, 224, 1, 0, 0, 0, 226, 225, 1, 0, 0, 0, 227, 55, 1, 0, 0, 0, 228, 229, 3, 6, 3, 0, 229, 57, 1, 0, 0, 0, 230, 231, 5, 14, 0, 0, 231, 232, 3, 54, 27, 0, 232, 233, 5, 15, 0, 0, 233, 59, 1, 0, 0, 0, 234, 235, 3, 56, 28, 0, 235, 236, 5, 17, 0, 0, 236, 241, 1, 0, 0, 0, 237, 238, 3, 58, 29, 0, 238, 239, 5, 17, 0, 0, 239, 241, 1, 0, 0, 0, 240, 234, 1, 0, 0, 0, 240, 237, 1, 0, 0, 0, 241, 61, 1, 0, 0, 0, 25, 65, 69, 74, 77, 80, 84, 94, 102, 114, 121, 124, 128, 131, 134, 143, 154, 160, 169, 187, 195, 204, 216, 221, 226, 240]
50 changes: 50 additions & 0 deletions java/com/walmartlabs/lacinia/Graphql.tokens
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
T__0=1
T__1=2
T__2=3
T__3=4
T__4=5
T__5=6
T__6=7
T__7=8
T__8=9
T__9=10
T__10=11
T__11=12
T__12=13
T__13=14
T__14=15
T__15=16
T__16=17
BooleanValue=18
NullValue=19
Null=20
NameId=21
IntValue=22
FloatValue=23
Sign=24
IntegerPart=25
NonZeroDigit=26
ExponentPart=27
Digit=28
StringValue=29
BlockStringValue=30
Ignored=31
'query'=1
'mutation'=2
'subscription'=3
'('=4
')'=5
':'=6
'$'=7
'='=8
'{'=9
'}'=10
'...'=11
'on'=12
'fragment'=13
'['=14
']'=15
'@'=16
'!'=17
'null'=20
'-'=24
Loading
Loading