Skip to content
Merged
Show file tree
Hide file tree
Changes from 28 commits
Commits
Show all changes
72 commits
Select commit Hold shift + click to select a range
0a2f8bc
Experiment on removing ANTLR4
May 22, 2025
5b43788
Remove ANTLR for sql as well
May 23, 2025
19f1e80
Add ANTLR generation to task and exempt lint check for generated code
May 26, 2025
19a6cc4
Fix lint
May 26, 2025
8c8a6f3
Fix lint
May 26, 2025
8ba8191
Fix Devin comments
May 26, 2025
fc1f64c
Fix lint
May 26, 2025
cb707a7
Merge branch 'main' into xwei/-remove-antlr
anlowee May 27, 2025
a7072be
Test
May 27, 2025
17e3800
Add github workflow
May 27, 2025
6eda0ee
Merge branch 'xwei/-remove-antlr' of github.com:anlowee/clp into xwei…
May 27, 2025
bd0abcd
Fix
May 27, 2025
d0daacf
Fix
May 27, 2025
ddb047c
Fix
May 27, 2025
b9f16ea
Fix lint
May 27, 2025
b2ec42f
Fix
May 27, 2025
9d121af
Fix
May 27, 2025
1210f2b
Minor refactor
May 28, 2025
108f61d
Fix lint
May 28, 2025
f4742f2
Fix coderabbit
May 28, 2025
b8b804e
Merge branch 'main' into xwei/-remove-antlr
anlowee May 28, 2025
7878b3b
Merge branch 'main' into xwei/-remove-antlr
anlowee May 28, 2025
f457bff
Merge branch 'main' into xwei/-remove-antlr
anlowee May 29, 2025
09faf7c
Fix
May 30, 2025
075ca5b
Merge branch 'xwei/-remove-antlr' of github.com:anlowee/clp into xwei…
May 30, 2025
8b3191c
Merge branch 'main' into xwei/-remove-antlr
anlowee May 30, 2025
abcb91d
Merge branch 'main' into xwei/-remove-antlr
anlowee May 30, 2025
e88d914
Merge branch 'main' into xwei/-remove-antlr
anlowee May 30, 2025
da1523b
Add antlr-runtime task to download and install the antlr-runtime libr…
kirkrodrigues May 31, 2025
4f15581
Merge branch 'main' into xwei/-remove-antlr
anlowee Jun 2, 2025
7cec3fd
Merge branch 'main' into xwei/-remove-antlr
anlowee Jun 2, 2025
399803f
Merge branch 'main' into xwei/-remove-antlr
anlowee Jun 3, 2025
b7a0519
Merge branch 'main' into xwei/-remove-antlr
anlowee Jun 3, 2025
7507fec
Limit task concurrency to the number of available cores.
kirkrodrigues Jun 3, 2025
4bb484e
Test hard-coding number of parallel tasks that can be run.
kirkrodrigues Jun 3, 2025
cfd48c0
Execute one task at a time.
kirkrodrigues Jun 4, 2025
4a8ad65
Limit the antlr-runtime build to 2 cores.
kirkrodrigues Jun 4, 2025
0c3e5e1
Revert "Limit the antlr-runtime build to 2 cores."
kirkrodrigues Jun 4, 2025
5fee637
Revert "Execute one task at a time."
kirkrodrigues Jun 4, 2025
10baa2d
Revert "Test hard-coding number of parallel tasks that can be run."
kirkrodrigues Jun 4, 2025
51bcf30
Revert "Limit task concurrency to the number of available cores."
kirkrodrigues Jun 4, 2025
6760985
Fix
Jun 4, 2025
457254e
Test
Jun 4, 2025
e30dc2b
Test over
Jun 4, 2025
7b27d63
Fix all comments
Jun 4, 2025
0270ef2
Fix lint
Jun 4, 2025
c8277a0
Fix
Jun 4, 2025
4b83336
Fix
Jun 4, 2025
2980015
Fix some coderabbit comments
Jun 4, 2025
3ef0261
Merge branch 'main' into xwei/-remove-antlr
anlowee Jun 5, 2025
7727eed
Limit task concurrency to number of cores.
kirkrodrigues Jun 5, 2025
b5b2909
Don't use a shell variable.
kirkrodrigues Jun 5, 2025
6da4782
Limit task concurrency to 1.
kirkrodrigues Jun 5, 2025
e9c6c36
Account for shell variable expansion.
kirkrodrigues Jun 5, 2025
9d9d91c
Specify JOBS for antlr-runtime task.
kirkrodrigues Jun 5, 2025
c493f54
Revert "Account for shell variable expansion."
kirkrodrigues Jun 5, 2025
9a30c0b
Revert "Limit task concurrency to 1."
kirkrodrigues Jun 5, 2025
3bcf6fe
Revert "Don't use a shell variable."
kirkrodrigues Jun 5, 2025
6b4f74e
Revert "Limit task concurrency to number of cores."
kirkrodrigues Jun 5, 2025
616bb69
Merge branch 'main' into xwei/-remove-antlr
anlowee Jun 5, 2025
529787e
Fix
Jun 5, 2025
0f5cda6
Merge branch 'main' into xwei/-remove-antlr
anlowee Jun 5, 2025
660e2c5
Merge branch 'xwei/-remove-antlr' of github.com:anlowee/clp into xwei…
Jun 5, 2025
b86cc0a
Fix
Jun 5, 2025
bcbd0fe
Change to generated in lint.yaml
Jun 5, 2025
54b73cc
Fix
Jun 5, 2025
76fd933
Fix
Jun 5, 2025
37dbe46
Fix
Jun 6, 2025
b07a57a
Fix
Jun 6, 2025
9c741d0
Fix
Jun 6, 2025
8a9449e
Fix
Jun 6, 2025
b35a0c9
Fix
Jun 6, 2025
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
42 changes: 42 additions & 0 deletions .github/workflows/clp-s-antlr-generation.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: "clp-s-antlr-generation"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about clp-s-generated-code-committed-check?


on:
pull_request:
push:
schedule:
# Run daily at 00:15 UTC (the 15 is to avoid periods of high load)
- cron: "15 0 * * *"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need to run this workflow periodically, right? The dependencies related to this workflow are fixed, so unless something unexpected happens, nothing should change if we run the workflow at a different time.

workflow_dispatch:
Comment thread
anlowee marked this conversation as resolved.
Resolved

concurrency:
group: "${{github.workflow}}-${{github.ref}}"
# Cancel in-progress jobs for efficiency
cancel-in-progress: true

jobs:
antlr-generation-check:
name: "antlr-generation-check"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about antlr-generated-code-committed-check?

strategy:
matrix:
os: ["macos-latest", "ubuntu-latest"]
runs-on: "${{matrix.os}}"
steps:
- uses: "actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683"
with:
submodules: "recursive"

Comment thread
anlowee marked this conversation as resolved.
Resolved
- uses: "actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38"
with:
python-version: "3.11"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need Python in this workflow?


- name: "Install task"
shell: "bash"
run: "npm install -g @go-task/cli"

Comment thread
anlowee marked this conversation as resolved.
Resolved
- if: "matrix.os == 'macos-latest'"
name: "Install coreutils (for md5sum)"
run: "brew install coreutils"
Comment thread
anlowee marked this conversation as resolved.
Resolved

- name: "Run clp-s-generate-antlr-check task"
shell: "bash"
run: "task clp-s-generate-antlr-check"
7 changes: 1 addition & 6 deletions components/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,7 @@ endif()

# Find and setup ANTLR Library
# We build and link to the static library
find_package(ANTLR REQUIRED)
if (ANTLR_FOUND)
message(STATUS "Found ANTLR ${ANTLR_VERSION}")
else()
message(FATAL_ERROR "Could not find libraries for ANTLR ${ANTLR4_TAG}")
endif()
include(ExternalAntlr4Cpp)

# Find and setup Boost Library
if(CLP_USE_STATIC_LIBS)
Expand Down
138 changes: 0 additions & 138 deletions components/core/cmake/Modules/FindANTLR.cmake

This file was deleted.

31 changes: 20 additions & 11 deletions components/core/src/clp_s/search/kql/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,24 +1,33 @@
ANTLR_TARGET(
KqlParser
Kql.g4
LEXER PARSER VISITOR
PACKAGE kql
set(ANTLR_GENERATED_KQL_CODE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/antlr_generated)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about ANTLR_GENERATED_SOURCE_DIR (to be consistent with how CMake names source directories)?


set(ANTLR_GENERATED_KQL_CODE

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about ANTLR_GENERATED_SOURCES (to be consistent with the variable naming in other CMake files)?

${ANTLR_GENERATED_KQL_CODE_DIR}/KqlBaseVisitor.cpp
${ANTLR_GENERATED_KQL_CODE_DIR}/KqlBaseVisitor.h
${ANTLR_GENERATED_KQL_CODE_DIR}/KqlLexer.cpp
${ANTLR_GENERATED_KQL_CODE_DIR}/KqlLexer.h
${ANTLR_GENERATED_KQL_CODE_DIR}/KqlParser.cpp
${ANTLR_GENERATED_KQL_CODE_DIR}/KqlParser.h
${ANTLR_GENERATED_KQL_CODE_DIR}/KqlVisitor.cpp
${ANTLR_GENERATED_KQL_CODE_DIR}/KqlVisitor.h
)

add_library(
kql
../antlr_common/ErrorListener.hpp
${ANTLR_KqlParser_CXX_OUTPUTS}
kql.cpp
kql.hpp
${CMAKE_CURRENT_SOURCE_DIR}/../antlr_common/ErrorListener.hpp
${ANTLR_GENERATED_KQL_CODE}
Comment thread
anlowee marked this conversation as resolved.
Resolved
${CMAKE_CURRENT_SOURCE_DIR}/kql.cpp
${CMAKE_CURRENT_SOURCE_DIR}/kql.hpp

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we absolutely need to use CMAKE_CURRENT_SOURCE_DIR here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's sugested by coderabbit if I remember correctly.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And what was its reasoning?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess no. Because previously when I tried building Velox it told me these generated files cannot be found, so I just added them though it turned out this didn't fix that issue. Yea I can remove them, shall I?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, let's remove it to stay consistent with other CMakeLists.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets alphabetize these.

)
target_compile_features(kql PRIVATE cxx_std_20)
target_include_directories(kql PRIVATE ${ANTLR_KqlParser_OUTPUT_DIR})
target_include_directories(kql
PRIVATE
${ANTLR_GENERATED_KQL_CODE_DIR}
Comment thread
anlowee marked this conversation as resolved.
Resolved
)
target_link_libraries(
kql
PRIVATE
antlr4_static
clp::string_utils
clp_s::search::ast
clp_s::search::ast
spdlog::spdlog
Comment on lines 30 to 34

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Link against the proper ANTLR runtime target
Similar to the SQL target, update the link line to reference the imported antlr4-runtime target (e.g., antlr4::antlr4-runtime) instead of antlr4_static after the find_package change.

🤖 Prompt for AI Agents
In components/core/src/clp_s/search/kql/CMakeLists.txt around lines 30 to 34,
the target is linked against the outdated `antlr4_static` library. Replace
`antlr4_static` with the correct imported target `antlr4::antlr4-runtime` to
match the updated `find_package` usage and ensure proper linkage with the ANTLR
runtime.

)
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

// Generated from clp_s/search/kql/Kql.g4 by ANTLR 4.13.1


#include "KqlBaseVisitor.h"


using namespace clp_s::search::kql;

Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@

// Generated from clp_s/search/kql/Kql.g4 by ANTLR 4.13.1

#pragma once


#include "antlr4-runtime.h"
#include "KqlVisitor.h"


namespace clp_s::search::kql {

/**
* This class provides an empty implementation of KqlVisitor, which can be
* extended to create a visitor which only needs to handle a subset of the available methods.
*/
class KqlBaseVisitor : public KqlVisitor {
public:

virtual std::any visitStart(KqlParser::StartContext *ctx) override {
return visitChildren(ctx);
}

virtual std::any visitExpr(KqlParser::ExprContext *ctx) override {
return visitChildren(ctx);
}

virtual std::any visitNestedQuery(KqlParser::NestedQueryContext *ctx) override {
return visitChildren(ctx);
}

virtual std::any visitNotQuery(KqlParser::NotQueryContext *ctx) override {
return visitChildren(ctx);
}

virtual std::any visitSubQuery(KqlParser::SubQueryContext *ctx) override {
return visitChildren(ctx);
}

virtual std::any visitOrAndQuery(KqlParser::OrAndQueryContext *ctx) override {
return visitChildren(ctx);
}

virtual std::any visitExpression(KqlParser::ExpressionContext *ctx) override {
return visitChildren(ctx);
}

virtual std::any visitColumn_range_expression(KqlParser::Column_range_expressionContext *ctx) override {
return visitChildren(ctx);
}

virtual std::any visitColumn_value_expression(KqlParser::Column_value_expressionContext *ctx) override {
return visitChildren(ctx);
}

virtual std::any visitColumn(KqlParser::ColumnContext *ctx) override {
return visitChildren(ctx);
}

virtual std::any visitValue_expression(KqlParser::Value_expressionContext *ctx) override {
return visitChildren(ctx);
}

virtual std::any visitList_of_values(KqlParser::List_of_valuesContext *ctx) override {
return visitChildren(ctx);
}


};

} // namespace clp_s::search::kql
Loading