mike-lischke / antlr4-c3

A grammar agnostic code completion engine for ANTLR4 based parsers
MIT License
396 stars 62 forks source link

Add C++ port build checks #132

Closed vityaman closed 1 month ago

vityaman commented 1 month ago

Proposed feature

I propose to initialize a CMake project in the ports/cpp directory, add some testing framework as well as ANTLRv4 dependency. Then port Java tests with Expr.g4 there to begin with. Also add clang-format with clang-tidy for some quality checks. And finally run it via GitHub Workflow on every pull requests in that directory.

I can do it fully by myself till the end of August, but need an approval to get started, to be sure that someone needs it.

Motivation

I tried a C++ port of this library and really liked it, thanks to you and other contributors for your nice work.

But there are some small drawbacks in C++ port currently. It's not really important what they are, but I'll give you two just as an example. The first is that the library itself is not thread safe because of using static variables here. The second is that there is some redundant check here, because std::map<K, V>::operator[] will insert a default-constructible V when called on an absent key.

I would like to fix it, but now there are no tests for this target and even simplest workflow that checks build status, and because of it contributing is hard and error-prone.

mike-lischke commented 1 month ago

I worked with C++ many years but then moved on to TypeScript, so I didn't spend time on a C++ port of my TS code. Someone else contributed it, but as you see with no tests or any GH integration. So a full port would certainly be welcome. However, I can't say how popular the C++ port actually is, since it only lives in this repo with no distribution channel which would allow to see interest by watching download numbers (like I can do with the TS code and NPM).

But if you need a better port and you feel like doing it then please go ahead! I'm ready to accept a PR.

vityaman commented 1 month ago

Plan for future actions

vityaman commented 1 month ago

Before closing this issue I would like to do some refactoring a little, because there seem to be minor flaws (unnecessary copying, for example, since the code was translated from TypeScript).