-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Terrible Golang performance #3718
Comments
Copying an insightful comment from Stackoverflow:
|
Does anyone know how to use the ggprof utility? The instructions referenced are some of the worse I've ever seen in 40 years. It took me hours to read past the incomplete instructions, syntactically invalid code given, and improper use of standard software engineering terminology, to construct a working parser driver program that sets up a server and turns on "profiling". And even then, "top10" shows diddly squat:
I still cannot determine if ggprof is a profiling tool or a tracing tool or both. I still cannot understand why the program actually needs to be modified at all in order to perform profiling aka "sampling" at fixed intervals and recording a stack trace. |
I changed test to use a larger example boolean expression, and redid the run--which gives wildly different results every time--and only this one run outputted more useful results:
It's not clear how one changes the sampling interval. |
I think the problem is that the there is excessive pressure on the heap and stack. This is because the definitions for many of the Antlr data structures are actually incorrect. Most fields of structs are structs themselves, whereas they should be pointers. Go is very much like C++, and one must explicitly use pointers, e.g., this is a struct, not a pointer to a struct. Contrast that with the Cpp target, where it is explicitly a pointer. The erroneous confusion of struct vs pointer to struct manifests in another problem that I mentioned here. Yes, this is just conjecture on my part. I'll try at some point to modify the code to redo the data structures to see if that fixes the performance, but it's low priority for me. |
I was just going to say that wildly different times could indicate an issue with garbage collection. I also noticed that the go target who is kind of walkie when I tried it once. @jcking is taking a look at the target at the moment I think. |
I should note, for strings of |
zoiks!!! @jcking here's a good used case for testing and upgraded Go target. |
Same issue here. |
Yeah, somebody needs to take a serious look at rebuilding the Go target. I might take a walk at it but it's lower on my priority list. sorry! |
Did anyone look in to this more? If not, then I may do this myself. Go should be about the fastest target, assuming that it has implemented the various algorithms in the runtime as well as any other target. |
It's likely caused by a bug in the Go Antlr runtime. Turning on debug for the runtime (and cleaning out the Go runtime where we get a core dump because atn_config printing is passed a nil pointer), we see that the edges in the dfas are not correct. See https://github.com/kaby76/issue-3718 for a complete side-by-side exact run comparison, driver code that was generated by my trgen program--handles all targets except "Swift". CSharp here:
Go here:
Most of the debug output has a 1 to 1 correspondence between the Go and CSharp runtimes (although, it would really really help to be consistent in debug output formatted strings to make life easier). The major diff occurs where a DFA is added in CSharp but not in Go. Note, the Go runtime does print out new DFA creation, but after a few, this is the first where it's not recorded. There are 11 DFA states created in the CSharp target, 9 DFA states created in the Go target. (And, anticipating the argument "But Java code is the gold standard!", I also did it for that target. There are 11 new DFA states added, just as with CSharp, and the with this important add also in the Java debug output.) Unless this bug is fixed, it's unlikely to know for sure whether this is the "performance issue". I have been programming for ~50 years. There is lttle sense in tracking down a "performance issue" when the basic behavior of the software is not working. |
The problem is here and it goes to how DFAState objects are kept in a hash table. Let's compare the CSharp and Go target code side by side:
Hashing is never perfect. In this case, there is a collision between two dfa states, one that exists in a table, and another which should be entered into the table. After computing the hash value of the DFAState to enter, you have to perform an equality check to verify that the state you want to enter is already in the table, i.e., has an identical hash but are equality different. Note here in C#, "states" is a map from DFAState to DFAState. The C# runtime actually performs an equality comparison and notices the hash is identical with something that is already in the table, but the value of the new DFAState is equality compare different than the one that is already in the table. So, a new state is created. But, in Go, it is a map from int to DFAState. Collisions in hash values are never checked because it's a mapping of hash value to DFAState not DFAState to DFAState. So, a new state is not created. @parrt This is a serious problem. |
Thanks, @kaby76 for tracking this down! yeah, I was under impression Go target was kinda screwed up. Does anybody know Go well enough to fix this hash issue? |
@kaby76 nice investigation, thanks. I think we must include tests on hashing into runtime testsuite. |
The Go runtime does hashing poorly and in the case where kaby76 points out it assumes hashes are unique, which is just wrong. I believe the Go runtime uses a 32-bit hash even on 64-bit platforms. The top 32 bits are simply ignored and chopped off. In general, most of the Go runtime needs to be re-written. I had partially done it, but I do not have the free time and will likely not have it for quite some time. Additionally the hierarchy of the structs needs to have another look taken at it. There is lots of embedding by pointer. It may make more sense to dereference so that there is only a single allocation. However I am not familiar enough with Golang GC to know if that helps. |
I am pretty sure I do :). Now, do I have the time? Hmmm - I did the C runtime for v3 because nobody else had the time... It sounds like the consensus is that the Go runtime may need either a rewrite or some serious work. What would those with an interest in the Go runtime vote for? A new runtime, or a revamp. I can look at the hashing anyway - though this looks more like an oversight in how go and hashing works (that's a guess - I have not looked at the problem that @kaby76 describes, but that description looks sound to me). |
OK - so, reminding myself how Java and C# work since I switched to go, C# Dictionary and Java Map<> allow the key to be objects. Just looking at Java any object that supplies consistent/conformant hashCode() and equals() can be a key. As stated above, we can see that because both calls have to be true, there won't be a clash in the map if hashCode() is equal for two objects but equals() is not. So, the DFAState object itself can be used as the map key. In the go runtime, the use of only the hashCode() Does anyone object to using an external dependency to replace Go builtin maps with something more sane for this case? The dev branch seems to have already been converted to modules, so this isn't really a big deal in my book. |
One question here is whether the Go runtime is supposed to allow invocations from multiple go routines at the same time? In its current form, without too much inspection, it would seem that it isn't, even if it was supposed to be a design goal. |
The Dictionary<> implementation for C# is here. I think it's actually being used more like a HashSet because the state number is not used in the hash computation, but that's how it's coded in Java. I made a crude, freshman-oriented implementation of a hash table for *DFAState using hash buckets, replaced the definition for "states", and tried it out. It could all be wrong, but took me a couple of hours of fumbling around with Go--which I cannot stand because ':=' assignments don't tell me what the type of a variable is, and the forced "one true brace style" style. The hack fixes the problem in collisions, invalid configs/DFAStates--and the performance issue. The runtimes are on par with the other runtimes. The hack is here. P.S.: someone updated the serialization/deserialization of some tables, and didn't update the tests--"go test" does not work. |
Right Ter. I have a fix. However, it is literally designed to fix this
before I look to a revamp. I’m not convinced it needs a complete restart
yet. This doesn’t fix hashing or anything else. Just to prove that this is
a fix. After that, I will start to analyze the code.
I would be surprised if GC was an issue these days. With a large grammar
and a set of large programs, how many DFAstates are we talking around.
1000s? 100,000s, 1,000,000?
Jim
…On Thu, Aug 11, 2022 at 09:13 Terence Parr ***@***.***> wrote:
Hi @jimidle <https://github.com/jimidle> !! Yep, fork then cut new branch
for a PR from dev branch (not master). Maybe we start by using @kaby76
<https://github.com/kaby76> awesome fix.
Yep, multiple threads should be able to use the DFAState stuff but likely
it ain't right. Very tricky.
—
Reply to this email directly, view it on GitHub
<#3718 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAJ7TMDXHZWW35NQQCBAHOLVYRHSFANCNFSM5WGGAXKQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Up to you which fix to take mate. I will make the PR anyway so you guys can take a look - I don't mind which path is taken. My fix is very simple and just uses a look aside slice in the hash bucket. It is a very safe change and does not involve new data structures., outside go builtins. Hash collisions are fairly rare - a tiny look aside table won't add much overhead - probably not measurable. Anyway, I will test against the original grammar mentioned above. The fix is in the same place as @kaby76 but the changes are probably smaller as I did not write a replacement table system etc - internally, go maps are a HashTable anyway, but the current code tries to do the hashing itself. I just made a few tweak changes such that the actual values are compared on any hash collision and any search. The comparison mirrors the Java implementation. My change is only for that specific map - the whole code set probably needs a full inspection - but at the moment I don't think it is so terrible that it needs a rewrite - a lot of it is sound. I would like to volunteer to take on a bit of a revamp of the runtime, unless anyone already working on this runtime wants to take that on before me and has the time? I don't want to step on anyone's toes of course. I was looking at the last time I was involved with ANTLR - yikes - how did that many years go by? |
@kaby76 - So, in your collection implementation, are you not using the Equals() in atn_config_set.go? The reason I ask is that, my hack just adds a bucket in to the states map, and then instead of only using the hash, it looks to see if they are equal by value. I discovered that the go implementation of Equals in atn_config_set.go is quite different from the java version in that it does not actually compare the // configs is the added elements.
configs []ATNConfig And the Equals() does this: func (b *BaseATNConfigSet) Equals(other interface{}) bool {
if b == other {
return true
} else if _, ok := other.(*BaseATNConfigSet); !ok {
return false
}
other2 := other.(*BaseATNConfigSet)
return b.configs != nil &&
// TODO: b.configs.equals(other2.configs) && // TODO: Is b necessary?
... So the set of configs are not actually compared. Whereas in Java, there is a custom comparator class for the declaration: /** Track the elements as they are added to the set; supports get(i) */
public final ArrayList<ATNConfig> configs = new ArrayList<ATNConfig>(7); ...
@Override
public boolean equals(ATNConfig a, ATNConfig b) {
if ( a==b ) return true;
if ( a==null || b==null ) return false;
return a.state.stateNumber==b.state.stateNumber
&& a.alt==b.alt
&& a.semanticContext.equals(b.semanticContext);
}
... And the ...
boolean same = configs!=null &&
configs.equals(other.configs) && // includes stack context
this.fullCtx == other.fullCtx &&
this.uniqueAlt == other.uniqueAlt &&
this.conflictingAlts == other.conflictingAlts &&
this.hasSemanticContext == other.hasSemanticContext &&
this.dipsIntoOuterContext == other.dipsIntoOuterContext;
... So, my simple solution to equality, will not work unless I also fix the So, if your hack fix gets around this in some way, then I am disinclined to pursue my hack fix further - if the go runtime is to mirror the way the Java runtime works, I think that there are quite a few of these TODOs that will need addressing - and it is going to take more than either of us hacking at this issue to make it work correctly. I will pursue this more though as it will be useful to understand what the current runtime is up to! |
@jimidle I think I just call the DFAState equals comparison, which is defined in DFAState. That code calls the ATNConfigSet Equals() method, which is similar to that in the C# code. But, to check, a side-by-side debug session between Java and Go should be done (at the DFAState compare methods in both targets). The code "works", but you know how assumptions can go. Note, I looked everywhere to see if map in golang could be defined as |
@kaby76 - both my local hack and your hack seem to fix the collisions, but neither seem to fix the performance problems. The provided sample repo at the start of this issue takes 71.9 seconds to run with your hack and 69.4 seconds with mine. Basically the same. What numbers did you get on the repo above with your hack? I definitely know that I am running your version - perhaps I am missing something here? The performance problem on the face of it is because closureCheckingStopState and it's call tree create 285,782,265 objects. and closureWork creates 211,925,408 objects. NOw, I suggest that it should not be creating that many and something else is very wrong here. But I just wanted to check to see whether your hack fixes the performance problems locally for you? |
You cannot override the equals method for map - the key must implement in the built in comparable interface - it is low level. You either do what you did, which is make a hashtable that works for this case, or change the storage. All I did was change the map to be [int][]*DFAState and then expand the slice upon a collision where value comparison via equals shows that it is hash collision. Similarly on search, just chase the slice - because there won't be millions of clashes. I am a big fan of go - I can see why some people are not though ;) If you can confirm that your hack runtime also does not fix the performance issue, then I will find out why those routines are allocating so many objects. The answer might mean just starting again - maybe reusing some of the logic that seems sound. I don't quite trust the comparators (equals() etc), but I have them working. |
I am going to build the Java version of everything and debug step through side by side - that should tell us where the go runtime is going wrong. There are more bugs here than just that map ignoring hash collisions. This will take some time. |
Please fix it if you know how without degrading performance. I changed it some time ago to get rid of excess cloning of go runtime files in every test, see #3365 I didn't find a better solution. |
No worries @KvanTTT - I see what you did and I see why. With newer go compilers, we have better options. It is a bit convoluted in there because of the maven test runner etc. But I will neaten it up and take advantage of modules etc etc I removed the GOROOT stuff and now rely on a replace in the go.mod for a test. Also, there is no longer a need to change the generated code. |
A simple indexing error in the Lexer ATN simulator because of my change to use new collection code is now fixed. All tests pass. There do not seem to be any performance tests per se, but the test grammar in this thread now runs in milliseconds on my system: /usr/local/opt/go/libexec/bin/go build -o /private/var/folders/h7/r6kmfvb50_9cncx1bpqlhbqc0000gn/T/GoLand/___go_build_main_go /Users/jim/tmp/perf-repro/main.go #gosetup
/private/var/folders/h7/r6kmfvb50_9cncx1bpqlhbqc0000gn/T/GoLand/___go_build_main_go
Success: compile
Success: run
Took 2 milliseconds to compile, 615 nanoseconds to run. I believe that I can get this time down a little and also reduce memory allocations. Because Github only lets you have one PR outstanding at a time, I have to wait until this one is accepted before pushing any more changes for those improvements. It could also be the case that there is no point pursuing improvements in this code base, and maybe time is better spent on a revamp. @parrt - I think that the PR is now ready mate. |
The next thing that could perhaps give a major improvement in allocations is the go implementation of array2DHashSet, which seems to be a naïve implementation of the Java version, it causes about 17,900 allocations, which is the vast majority of the allocations to run the grammar at the top of this thread. I am also not sure if it is using the correct hash and comparator (this is buried in the generic implementation in Java). @parrt Without me trawling all the way through the code, does the Java implementation of this use the hashCode() and equals() of the object type it is storing? Or is it overridden somewhere? The go version is using a hash() and compare() that do not match the hashCode() and equals() of ATNConfig in Java. Never mind Ter - I see it has its own hashCode and comparator, which checks to see if the object is an ATNConfig. I can fix the go version to use the same hash and comparator. See if that cuts down the allocations. |
The go version of array2DHashSet is preallocating buckets and bucket capacity, even though it won't need them - it is treating the buckets as arrays instead of slices but then the algorithm is expecting a bucket to be initialized. Because there are lots of these allocated, every new allocation for this causes tons of empty buckets to be allocated. It needs a rethink to do lazy allocation - I will need to study how the Java version is doing this. I assume it isn't allocating all those buckets if it does not need them. |
The functionality provided by that collection is already provided by my new generic container, which does not make any allocations unless they are needed, so I will carefully go through the code and replace its use with the generic store. |
It should use standard code hashCode() and equals():
|
o Implement collections with generics to solve hash collisions o Fix type casting in LL start parser simulation optimization o General minor tidy ups Acknowledgements to @kaby76 for help with tracing errors Signed-off-by: Jim.Idle <jimi@gatherstars.com>
Signed-off-by: Jim.Idle <jimi@gatherstars.com>
Signed-off-by: Jim.Idle <jimi@gatherstars.com>
With older versions of go, there was no good way to tell the compiler to use your local development copy of a particular package instead of the one installed in GOPATH/src/... However, we are now using modules, which allows us to tell the compiler that instead of a module downloaded to GOPATH/pkg, to use a local copy on disk. Hence this change removes the need to copy the whole of the go installation to a tempoorary location, then put the antlr go runtime in to the go installation as if it was part of the compiler. Hence the execution time for the go tests is now faster than before. This works because when the generated code is placed in the temporary location, we create a go.mod file for it, tell the module to replace the online module for the go runtime with the local copy on disk, then ro a go mod tidy to add the dependencies from the code (which avoids network access, so it is instant), which adds the ANTLR dependency itself (which is then replaced at compile time). All go runtime tests now pass. Signed-off-by: Jim.Idle <jimi@gatherstars.com>
@movelazar a PR fixing got merged into dev branch. can you test? |
Excellent - I will now fix the 2darray thing to bring down the allocations, then I think I will check to see if there are any other bugs that I could fix quickly. Then let's move to a redo. @parrt - Do you delete the incoming branch after merging it to dev? I use git flow on my end, so I will pull from the repo, then delete my feature branch. |
You can delete if you'd like...it's just in your fork so doesnt' affect main repo. :) |
It looks like your merge into dev is all green for github CI :) https://github.com/antlr/antlr4/actions/runs/2862709143 |
Excellent. Ter - I am going to now take a little time to reorganize all this hashing and collections and so on. Because it was a bit of a mess before, it has ended up being more of a mess. So, I will keep my newhash branch alive and send another PR that does this:
This is all related to this performance issue, so I think we can keep this issue open and I will use the same branch to track the changes. I should be able to finish this today my time and then we can be assured that all the hashing and collection stuff is hunk dory. |
Great! |
Sorry for the delay in submitting the latest PR. Unfortunately COVID got in the way! However, the latest PR replaces most of the collection related code with new generic based collections that behave There are still improvements that I can see will help both performance and memory, but I think this PR is enough of a change at one go. From here, PRs should be smaller. I am now thinking that there might not be any reason to start again on the go runtime. It is work to improve what we have, but most of the logic is intact and if there are structural changes required, we can implement them in the existing code base. I will gradually improve documentation and doc comments, some code can be redone with newer Go language support etc. I am willing to be talked out of this viewpoint, but right now, I don't think a complete redo is necessary. i will spend more time on this though and see if I change my mind. Also - I think we can close this issue now @parrt |
Hi Jim! Sorry to hear about the Covid!! Good news on the performance improvements and glad we can keep the same runtime. Does your PR keep the same interface? I want to make sure I don't break a bunch of projects inside Google. Closing this via #3829 |
No change to the external interface Ter. This is all just internal
collections.
…On Sun, Aug 21, 2022 at 00:15 Terence Parr ***@***.***> wrote:
Closed #3718 <#3718> as completed.
—
Reply to this email directly, view it on GitHub
<#3718 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAJ7TMBNHAHMBB3TGHFMFU3V2EAA3ANCNFSM5WGGAXKQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
o Implement collections with generics to solve hash collisions o Fix type casting in LL start parser simulation optimization o General minor tidy ups Acknowledgements to @kaby76 for help with tracing errors Signed-off-by: Jim.Idle <jimi@gatherstars.com> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr>
Signed-off-by: Jim.Idle <jimi@gatherstars.com> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr>
Signed-off-by: Jim.Idle <jimi@gatherstars.com> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr>
With older versions of go, there was no good way to tell the compiler to use your local development copy of a particular package instead of the one installed in GOPATH/src/... However, we are now using modules, which allows us to tell the compiler that instead of a module downloaded to GOPATH/pkg, to use a local copy on disk. Hence this change removes the need to copy the whole of the go installation to a tempoorary location, then put the antlr go runtime in to the go installation as if it was part of the compiler. Hence the execution time for the go tests is now faster than before. This works because when the generated code is placed in the temporary location, we create a go.mod file for it, tell the module to replace the online module for the go runtime with the local copy on disk, then ro a go mod tidy to add the dependencies from the code (which avoids network access, so it is instant), which adds the ANTLR dependency itself (which is then replaced at compile time). All go runtime tests now pass. Signed-off-by: Jim.Idle <jimi@gatherstars.com> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr>
Signed-off-by: Jim.Idle <jimi@gatherstars.com> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr>
* Fix CMake syntax for variable expansion When using variables to compare (like in if clause) the variable shouldn't be quoted. More details can be found at the link below: https://cmake.org/cmake/help/latest/command/if.html#variable-expansion Signed-off-by: HS <hs@apotell.com> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * initial commit Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * renamed for clarity Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * renamed for clarity Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * able to locate antlr4 runtime using ts-node, missing types Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * progressing Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * able to 'run' a test. It fails but it compiles and resolves! Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * reflect refactored runtime Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * able to run RecursiveLexerRuleRefWithWildcardPlus_1 test locally Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * passes LexerExec tests in IntelliJ Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * make ATN private Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * ignore same tests as JavaScript Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * compiles Parser and Lexer bu local run fails Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * ParserExec.TokenOffset test successful in IntelliJ ! Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * Progressing, passing 131 of 348 tests Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * pass 327 tests out of 348 Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * more successful tests Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * 333 successful tests out of 348 Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * all tests pass except 7 caused by #3868 Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * update getting-started doc Signed-off-by: nicksxs <nicksxs@hotmail.com> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * add blank github action file for hosted CI Signed-off-by: Terence Parr <parrt@antlr.org> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * update getting started document to say java 11 Signed-off-by: Terence Parr <parrt@antlr.org> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * Revert "update getting started document to say java 11" This reverts commit 1df58f7. Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * add C# book code links Signed-off-by: Terence Parr <parrt@antlr.org> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * Add Jim/Ken to readme Signed-off-by: Terence Parr <parrt@antlr.org> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * Update Swift Package to support static library Add static library distribution in SPM Signed-off-by: Hell_Ghost <dev.hellghost@gmail.com> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * Update Package.swift Signed-off-by: Hell_Ghost dev.hellghost@gmail.com Signed-off-by: Hell_Ghost <dev.hellghost@gmail.com> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * Add caching support for maven & dependencies. Also, include caching for cpp builds using actions/ccache. Builds are more reliable (avoids the archive.apache server which intermittently reports timeouts) and also significantly improves the overall builds times (down from 46 mins to 28 mins). The slowest part of the build now is the Windows+cpp builds because there is no reliable cache implementation yet. MacOS+cpp (65% cache hit) is also relatively slow compared to Ubuntu+cpp (99% cache hit). Signed-off-by: HS <hs@apotell.com> Signed-off-by: Terence Parr <parrt@antlr.org> # Conflicts: # .github/workflows/hosted.yml Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * use snap to install go 1.19 Signed-off-by: Terence Parr <parrt@antlr.org> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * grr...install snap Signed-off-by: Terence Parr <parrt@antlr.org> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * ugh. start snap Signed-off-by: Terence Parr <parrt@antlr.org> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * ugh. start snap Signed-off-by: Terence Parr <parrt@antlr.org> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * ugh. cant get snap to install go Signed-off-by: Terence Parr <parrt@antlr.org> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * try downloading golang with curl Signed-off-by: Terence Parr <parrt@antlr.org> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * Issue #3823: Temporarily disable a few tests on CI The tests are currently failing. The underlying issues have been fixed on dev and so the builds will be turned back with the next release. Signed-off-by: HS <hs@apotell.com> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * update actions status badge Signed-off-by: Terence Parr <parrt@antlr.org> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * update getting started document to say java 11 Signed-off-by: Terence Parr <parrt@antlr.org> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * Revert "update getting started document to say java 11" This reverts commit 3591ee0. Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * update getting-started doc Signed-off-by: nicksxs <nicksxs@hotmail.com> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * make getValue visible to external profiler tools. Signed-off-by: Terence Parr <parrt@antlr.org> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * Fix #3508: Document the $parser attribute and its use in target-agnostic grammars. Signed-off-by: Ross Patterson <ross.patterson@gmail.com> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * Add accessor to IntervalSet for intervals Signed-off-by: James Taylor <jamestaylor@apache.org> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * Remove libuuid dependency from C++ runtime libuuid and its headers are not referenced anywhere, so remove it. Signed-off-by: Bryan Tan <bryantan@technius.net> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * Add `@SuppressWarnings("CheckReturnValue")` to prevent error_prone lib errors. Signed-off-by: Terence Parr <parrt@antlr.org> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * fix: Fixes for #3718 o Implement collections with generics to solve hash collisions o Fix type casting in LL start parser simulation optimization o General minor tidy ups Acknowledgements to @kaby76 for help with tracing errors Signed-off-by: Jim.Idle <jimi@gatherstars.com> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * fix: #3718 Revert accidental keyboard error in Java target Signed-off-by: Jim.Idle <jimi@gatherstars.com> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * fix: #3718 Correct DFAState index in Lexer ATN Simulator Signed-off-by: Jim.Idle <jimi@gatherstars.com> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * fix: #3718 Fix go runtime test runners With older versions of go, there was no good way to tell the compiler to use your local development copy of a particular package instead of the one installed in GOPATH/src/... However, we are now using modules, which allows us to tell the compiler that instead of a module downloaded to GOPATH/pkg, to use a local copy on disk. Hence this change removes the need to copy the whole of the go installation to a tempoorary location, then put the antlr go runtime in to the go installation as if it was part of the compiler. Hence the execution time for the go tests is now faster than before. This works because when the generated code is placed in the temporary location, we create a go.mod file for it, tell the module to replace the online module for the go runtime with the local copy on disk, then ro a go mod tidy to add the dependencies from the code (which avoids network access, so it is instant), which adds the ANTLR dependency itself (which is then replaced at compile time). All go runtime tests now pass. Signed-off-by: Jim.Idle <jimi@gatherstars.com> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * Rm remote github actions; hosted seems to work Signed-off-by: Terence Parr <parrt@antlr.org> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * install golang with curl; go was missing from dev Signed-off-by: Terence Parr <parrt@antlr.org> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * fix: Rework of all Hash() and Equals() methods - implement generic collections - Implement new collections using generics that implement the functionality required by the Java runtime in a more idiomatic Go way. - Fix Hash() and Equals() for all objects in the runtime - Fix getConflictingAlts so that it behaves the same way as Java, using a new generic collection - Replaces the use of the array2DHashSet, which was causing unneeded memory allocations. Replaced with generic collection that allocates minimally (though, I think I can improve on that with a little analysis). Jim Idle - jimi@idle.ws Signed-off-by: Jim.Idle <jimi@gatherstars.com> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * fix: #3718 Correct DFAState index in Lexer ATN Simulator Signed-off-by: Jim.Idle <jimi@gatherstars.com> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * feat: Reduce initial memory allocations for collections - Many small collections are created at runtime, the default allocation for maps, even though small, still requires memory. Specifying a very small initial allocation prevents unnecesary allocations and has no measurable effect on performance. A small incremental change. Signed-off-by: Jim.Idle <jimi@gatherstars.com> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * fix: #3758 Allow for string being a keyword and fix go template to use escapedName - The go template was ignoring the use of escapedName in many places and was not consistenet with the Java version. - Added 'string' to the list of reserved words for the Go target Signed-off-by: Jim.Idle <jimi@gatherstars.com> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * fix: #3758 Add go.sum to the repo Signed-off-by: Jim.Idle <jimi@gatherstars.com> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * fix: #3758 Ensure that standard runtime extensions are included in go.mod Signed-off-by: Jim.Idle <jimi@gatherstars.com> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * fix: #2826 Go template is incorrect for dynamic scopes closes #2826 obviates PR #3101 Signed-off-by: Jim.Idle <jimi@gatherstars.com> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * fix: #2016 - Generate correct iGo code for lists in a grammar, such as `label+=arg+` Signed-off-by: Jim.Idle <jimi@gatherstars.com> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * feat: Bump poms to use 4.11 Snapshot Signed-off-by: Jim.Idle <jimi@gatherstars.com> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * turn off Golang test at circleci for now Signed-off-by: Terence Parr <parrt@antlr.org> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * Replace smart-quote with single-quote in code examples Signed-off-by: Tim McCormack <cortex@brainonfire.net> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * Augment error message during testing to include full cause of problem. Signed-off-by: Terence Parr <parrt@antlr.org> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * Augment error message during testing to include full cause of problem. (round 2 to avoid null ptr) Signed-off-by: Terence Parr <parrt@antlr.org> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * Cpp: Link to threads library As detailed in #3708, it is necessary to link against the (p)threads library in order to be able to use std::call_once without producing linker errors. Since this function is frequently used in ANTLR's cpp version, this commit ensures that the respective library is always linked against in order to avoid this error, even if downstream users are not explicitly linking against an appropriate threads library. Fixes #3708 Signed-off-by: Robert Adam <dev@robert-adam.de> Co-authored-by: Bryan Tan <Technius@users.noreply.github.com> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * add test for #2016 and fix java. Signed-off-by: Terence Parr <parrt@antlr.org> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * ensure all targets have the appropriate argument list for the template causing the problem. Signed-off-by: Terence Parr <parrt@antlr.org> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * Fix other targets Signed-off-by: Terence Parr <parrt@antlr.org> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * fix format Signed-off-by: Terence Parr <parrt@antlr.org> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * add check that $args is a list Signed-off-by: Terence Parr <parrt@antlr.org> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * change made by @lingyv-li to fix bug in DART exposed by this test. Signed-off-by: Terence Parr <parrt@antlr.org> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * fix AssertIsList in multiple targets. Go doesn't pass test and has no AssertIsList so I'm dropping that test from the Go test suite. How did a comment to the C++ runnerFor my future reference as to how to build things from the command line. Signed-off-by: Terence Parr <parrt@antlr.org> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * C++ gets an exception with this test so I'm turning it off. See #3845 Signed-off-by: Terence Parr <parrt@antlr.org> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * feat: #3840 Move Go to version v4.11.0 Signed-off-by: Jim.Idle <jimi@gatherstars.com> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * feat: #3840 Create the v4 version of the Go runtime Signed-off-by: Jim.Idle <jimi@gatherstars.com> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * feat: Create the v4 runtime layout for the Go runtime, ready for release tagging Note that the vast majority of the changes here are just copying the runtime file in to the /v4 subdirectory so that we can support legacy projects that use GOPATH only, as well as users that can use go modules. At a later release, we will delete the default path, and move the v4 subdirectory back to the top level. But, we cannot do that on this release. Signed-off-by: Jim.Idle <jimi@gatherstars.com> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * Reenable go tests on CircleCI Signed-off-by: Ivan Kochurkin <kvanttt@gmail.com> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * Fold constants in generated code for all runtimes Go: getInlineTestSetWordSize 32 -> 64 Dart: get rid of BigInt Swift: optimize TestSetInline Python: fixes #3698 JavaScript: fixes #3699 Signed-off-by: Ivan Kochurkin <kvanttt@gmail.com> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * Use int literals instead of refs for Python and JavaScript Update getMultiTokenAlternativeDescriptor test fixes #3703 Signed-off-by: Ivan Kochurkin <kvanttt@gmail.com> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * update release doc for Go version numbers Signed-off-by: Terence Parr <parrt@antlr.org> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * fix: #2016 Fix Go template list reference, go runtime and got test template for list labels Signed-off-by: Jim.Idle <jimi@gatherstars.com> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * feat: Add a deprecation message to the existing v1 module Signed-off-by: Jim.Idle <jimi@gatherstars.com> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * Split tool and runtime tests for GitHub workflow Build only necessary modules for tests Signed-off-by: Ivan Kochurkin <kvanttt@gmail.com> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * Remove not used methods from FileUtils (runtime tests) Signed-off-by: Ivan Kochurkin <kvanttt@gmail.com> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * Update dependencies of antlr4-maven-plugin Signed-off-by: Ivan Kochurkin <kvanttt@gmail.com> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * Update jUnit: 5.8.2 -> 5.9.0 Signed-off-by: Ivan Kochurkin <kvanttt@gmail.com> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * Fixes #3733; update ST4 so it uses proper ANTLR 3 Signed-off-by: Terence Parr <parrt@antlr.org> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * tweak doc Signed-off-by: Terence Parr <parrt@antlr.org> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * Set to 4.11.0 not 4.11 in poms Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * [maven-release-plugin] prepare release 4.11.0 Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * [maven-release-plugin] prepare for next development iteration Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * Damn. java target said 4.10.2 not 4.11.0 Signed-off-by: Terence Parr <parrt@antlr.org> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * roll back to 4.11.0; made mistake Signed-off-by: Terence Parr <parrt@antlr.org> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * roll back to 4.11.0; made mistake Signed-off-by: Terence Parr <parrt@antlr.org> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * [maven-release-plugin] prepare release antlr4-master-4.11.0 Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * [maven-release-plugin] prepare for next development iteration Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * use build and twine to publish source and wheel Signed-off-by: Qijia Liu <liumeo@pku.edu.cn> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * tweak doc Signed-off-by: Terence Parr <parrt@antlr.org> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * tweak c++ build script to make Mac binaries with cmake/make Signed-off-by: Terence Parr <parrt@antlr.org> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * tweak release doc Signed-off-by: Terence Parr <parrt@antlr.org> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * tweak code / doc related to bad previous release Signed-off-by: Terence Parr <parrt@antlr.org> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * [maven-release-plugin] prepare release 4.11.1 Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * [maven-release-plugin] prepare for next development iteration Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * clean up deploy c++ source script Signed-off-by: Terence Parr <parrt@antlr.org> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * cleanup code generation Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * don't initialize default param values twice Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * add missing field Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * update codegen template for 4.11.1 Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * support new param: Parser Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * fix template for 4.11 Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * default export Listener and Visitor Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * also default export parser and lexer Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * all tests pass except 7 caused by #3868 Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * fix issues Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * make it easy to break Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * fix #3868 Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * ALL TESTS PASS!!!! Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * cross fingers with CI Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * try fixing broken go tests Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * Try fix typescript CI Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * disable cpp for now Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * fix broken config Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * try fix macos gh build Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * improve speed by caching node_modules Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * no longer using ts-node Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * fix all tsc warnings Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * try fix MacOS CI Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * CI errors seem random, reactivate ubuntu Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * Disable node_modules caching, which seems to randomly fail in CI Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * don't delete symlink contents on windows (java bug with is SymbolicLink ?) Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * fix broken windows CI Signed-off-by: ERIC-WINDOWS\ericv <eric.vergnaud@wanadoo.fr> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * verify windows ci Signed-off-by: ERIC-WINDOWS\ericv <eric.vergnaud@wanadoo.fr> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * Revert "verify windows ci" This reverts commit 770d821. Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * reinstate full CI Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * manually merged * manually merge * fix merge * fix broken template * add template for invoking context list * fix typo * fix test templates * Add code of conduct but with a different name since I do not like that name Signed-off-by: Terence Parr <parrt@antlr.org> * Update C# release instructions * Tweak code of conduct Signed-off-by: Terence Parr <parrt@antlr.org> * Bring back the Package.swift in the project's root Signed-off-by: Nikolay Edigaryev <edigaryev@gmail.com> * swift-target.md: fix SPM installation instructions Signed-off-by: Nikolay Edigaryev <edigaryev@gmail.com> * the scope (parser or lexer) in @parser::header was dropped, so keep track of it and only include @Header in Listener and Visitor code Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * drop workaround in favor of #3878 * drop cache usage since it fails in CI * #3878 was missing some scenarios * fix issue when deleting test folder * fix warnings * drop duplicate behavior * drop alien 'abstractRecognizer' property * drop alien property 'channels' * fix various codegen issues * change import * restore js extensions, see microsoft/TypeScript#50501 * use consistent inheritance * more API * more API stuff * fix typo * fix typescript exports * use ts-node to run typescript tests * webpack runtime before linking * fix exec paths on windows Signed-off-by: ERIC-WINDOWS\ericv <eric.vergnaud@wanadoo.fr> * fix failing tests * fix a few import issues * merge typescript-target with latest dev * runs Java and JavaScript tests after merging typescript-target * merge test template * skip unsupported test * fix template prototype * fix missing merge * bump typescript beta version after rebase * update docs * rollback unwanted changes Signed-off-by: HS <hs@apotell.com> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> Signed-off-by: nicksxs <nicksxs@hotmail.com> Signed-off-by: Terence Parr <parrt@antlr.org> Signed-off-by: Hell_Ghost <dev.hellghost@gmail.com> Signed-off-by: Hell_Ghost dev.hellghost@gmail.com Signed-off-by: Ross Patterson <ross.patterson@gmail.com> Signed-off-by: James Taylor <jamestaylor@apache.org> Signed-off-by: Bryan Tan <bryantan@technius.net> Signed-off-by: Jim.Idle <jimi@gatherstars.com> Signed-off-by: Tim McCormack <cortex@brainonfire.net> Signed-off-by: Ivan Kochurkin <kvanttt@gmail.com> Signed-off-by: Qijia Liu <liumeo@pku.edu.cn> Signed-off-by: ERIC-WINDOWS\ericv <eric.vergnaud@wanadoo.fr> Signed-off-by: Nikolay Edigaryev <edigaryev@gmail.com> Co-authored-by: HS <hs@apotell.com> Co-authored-by: nicksxs <nicksxs@hotmail.com> Co-authored-by: Terence Parr <parrt@antlr.org> Co-authored-by: Hell_Ghost <dev.hellghost@gmail.com> Co-authored-by: Ross Patterson <ross.patterson@gmail.com> Co-authored-by: James Taylor <jamestaylor@apache.org> Co-authored-by: Bryan Tan <bryantan@technius.net> Co-authored-by: Jim.Idle <jimi@gatherstars.com> Co-authored-by: Tim McCormack <cortex@brainonfire.net> Co-authored-by: Robert Adam <dev@robert-adam.de> Co-authored-by: Bryan Tan <Technius@users.noreply.github.com> Co-authored-by: Ivan Kochurkin <kvanttt@gmail.com> Co-authored-by: Qijia Liu <liumeo@pku.edu.cn> Co-authored-by: Nikolay Edigaryev <edigaryev@gmail.com>
* Fix CMake syntax for variable expansion When using variables to compare (like in if clause) the variable shouldn't be quoted. More details can be found at the link below: https://cmake.org/cmake/help/latest/command/if.html#variable-expansion Signed-off-by: HS <hs@apotell.com> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * initial commit Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * renamed for clarity Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * renamed for clarity Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * able to locate antlr4 runtime using ts-node, missing types Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * progressing Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * able to 'run' a test. It fails but it compiles and resolves! Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * reflect refactored runtime Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * able to run RecursiveLexerRuleRefWithWildcardPlus_1 test locally Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * passes LexerExec tests in IntelliJ Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * make ATN private Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * ignore same tests as JavaScript Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * compiles Parser and Lexer bu local run fails Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * ParserExec.TokenOffset test successful in IntelliJ ! Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * Progressing, passing 131 of 348 tests Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * pass 327 tests out of 348 Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * more successful tests Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * 333 successful tests out of 348 Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * all tests pass except 7 caused by #3868 Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * update getting-started doc Signed-off-by: nicksxs <nicksxs@hotmail.com> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * add blank github action file for hosted CI Signed-off-by: Terence Parr <parrt@antlr.org> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * update getting started document to say java 11 Signed-off-by: Terence Parr <parrt@antlr.org> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * Revert "update getting started document to say java 11" This reverts commit 1df58f77820b5feb747d34cc6aff26276db8b6dd. Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * add C# book code links Signed-off-by: Terence Parr <parrt@antlr.org> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * Add Jim/Ken to readme Signed-off-by: Terence Parr <parrt@antlr.org> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * Update Swift Package to support static library Add static library distribution in SPM Signed-off-by: Hell_Ghost <dev.hellghost@gmail.com> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * Update Package.swift Signed-off-by: Hell_Ghost dev.hellghost@gmail.com Signed-off-by: Hell_Ghost <dev.hellghost@gmail.com> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * Add caching support for maven & dependencies. Also, include caching for cpp builds using actions/ccache. Builds are more reliable (avoids the archive.apache server which intermittently reports timeouts) and also significantly improves the overall builds times (down from 46 mins to 28 mins). The slowest part of the build now is the Windows+cpp builds because there is no reliable cache implementation yet. MacOS+cpp (65% cache hit) is also relatively slow compared to Ubuntu+cpp (99% cache hit). Signed-off-by: HS <hs@apotell.com> Signed-off-by: Terence Parr <parrt@antlr.org> # Conflicts: # .github/workflows/hosted.yml Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * use snap to install go 1.19 Signed-off-by: Terence Parr <parrt@antlr.org> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * grr...install snap Signed-off-by: Terence Parr <parrt@antlr.org> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * ugh. start snap Signed-off-by: Terence Parr <parrt@antlr.org> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * ugh. start snap Signed-off-by: Terence Parr <parrt@antlr.org> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * ugh. cant get snap to install go Signed-off-by: Terence Parr <parrt@antlr.org> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * try downloading golang with curl Signed-off-by: Terence Parr <parrt@antlr.org> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * Issue #3823: Temporarily disable a few tests on CI The tests are currently failing. The underlying issues have been fixed on dev and so the builds will be turned back with the next release. Signed-off-by: HS <hs@apotell.com> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * update actions status badge Signed-off-by: Terence Parr <parrt@antlr.org> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * update getting started document to say java 11 Signed-off-by: Terence Parr <parrt@antlr.org> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * Revert "update getting started document to say java 11" This reverts commit 3591ee0b51c6bb914f7ef0749182306fefe9cc18. Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * update getting-started doc Signed-off-by: nicksxs <nicksxs@hotmail.com> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * make getValue visible to external profiler tools. Signed-off-by: Terence Parr <parrt@antlr.org> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * Fix #3508: Document the $parser attribute and its use in target-agnostic grammars. Signed-off-by: Ross Patterson <ross.patterson@gmail.com> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * Add accessor to IntervalSet for intervals Signed-off-by: James Taylor <jamestaylor@apache.org> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * Remove libuuid dependency from C++ runtime libuuid and its headers are not referenced anywhere, so remove it. Signed-off-by: Bryan Tan <bryantan@technius.net> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * Add `@SuppressWarnings("CheckReturnValue")` to prevent error_prone lib errors. Signed-off-by: Terence Parr <parrt@antlr.org> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * fix: Fixes for antlr/antlr4#3718 o Implement collections with generics to solve hash collisions o Fix type casting in LL start parser simulation optimization o General minor tidy ups Acknowledgements to @kaby76 for help with tracing errors Signed-off-by: Jim.Idle <jimi@gatherstars.com> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * fix: #3718 Revert accidental keyboard error in Java target Signed-off-by: Jim.Idle <jimi@gatherstars.com> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * fix: #3718 Correct DFAState index in Lexer ATN Simulator Signed-off-by: Jim.Idle <jimi@gatherstars.com> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * fix: #3718 Fix go runtime test runners With older versions of go, there was no good way to tell the compiler to use your local development copy of a particular package instead of the one installed in GOPATH/src/... However, we are now using modules, which allows us to tell the compiler that instead of a module downloaded to GOPATH/pkg, to use a local copy on disk. Hence this change removes the need to copy the whole of the go installation to a tempoorary location, then put the antlr go runtime in to the go installation as if it was part of the compiler. Hence the execution time for the go tests is now faster than before. This works because when the generated code is placed in the temporary location, we create a go.mod file for it, tell the module to replace the online module for the go runtime with the local copy on disk, then ro a go mod tidy to add the dependencies from the code (which avoids network access, so it is instant), which adds the ANTLR dependency itself (which is then replaced at compile time). All go runtime tests now pass. Signed-off-by: Jim.Idle <jimi@gatherstars.com> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * Rm remote github actions; hosted seems to work Signed-off-by: Terence Parr <parrt@antlr.org> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * install golang with curl; go was missing from dev Signed-off-by: Terence Parr <parrt@antlr.org> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * fix: Rework of all Hash() and Equals() methods - implement generic collections - Implement new collections using generics that implement the functionality required by the Java runtime in a more idiomatic Go way. - Fix Hash() and Equals() for all objects in the runtime - Fix getConflictingAlts so that it behaves the same way as Java, using a new generic collection - Replaces the use of the array2DHashSet, which was causing unneeded memory allocations. Replaced with generic collection that allocates minimally (though, I think I can improve on that with a little analysis). Jim Idle - jimi@idle.ws Signed-off-by: Jim.Idle <jimi@gatherstars.com> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * fix: #3718 Correct DFAState index in Lexer ATN Simulator Signed-off-by: Jim.Idle <jimi@gatherstars.com> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * feat: Reduce initial memory allocations for collections - Many small collections are created at runtime, the default allocation for maps, even though small, still requires memory. Specifying a very small initial allocation prevents unnecesary allocations and has no measurable effect on performance. A small incremental change. Signed-off-by: Jim.Idle <jimi@gatherstars.com> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * fix: #3758 Allow for string being a keyword and fix go template to use escapedName - The go template was ignoring the use of escapedName in many places and was not consistenet with the Java version. - Added 'string' to the list of reserved words for the Go target Signed-off-by: Jim.Idle <jimi@gatherstars.com> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * fix: #3758 Add go.sum to the repo Signed-off-by: Jim.Idle <jimi@gatherstars.com> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * fix: #3758 Ensure that standard runtime extensions are included in go.mod Signed-off-by: Jim.Idle <jimi@gatherstars.com> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * fix: #2826 Go template is incorrect for dynamic scopes closes #2826 obviates PR #3101 Signed-off-by: Jim.Idle <jimi@gatherstars.com> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * fix: #2016 - Generate correct iGo code for lists in a grammar, such as `label+=arg+` Signed-off-by: Jim.Idle <jimi@gatherstars.com> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * feat: Bump poms to use 4.11 Snapshot Signed-off-by: Jim.Idle <jimi@gatherstars.com> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * turn off Golang test at circleci for now Signed-off-by: Terence Parr <parrt@antlr.org> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * Replace smart-quote with single-quote in code examples Signed-off-by: Tim McCormack <cortex@brainonfire.net> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * Augment error message during testing to include full cause of problem. Signed-off-by: Terence Parr <parrt@antlr.org> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * Augment error message during testing to include full cause of problem. (round 2 to avoid null ptr) Signed-off-by: Terence Parr <parrt@antlr.org> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * Cpp: Link to threads library As detailed in #3708, it is necessary to link against the (p)threads library in order to be able to use std::call_once without producing linker errors. Since this function is frequently used in ANTLR's cpp version, this commit ensures that the respective library is always linked against in order to avoid this error, even if downstream users are not explicitly linking against an appropriate threads library. Fixes #3708 Signed-off-by: Robert Adam <dev@robert-adam.de> Co-authored-by: Bryan Tan <Technius@users.noreply.github.com> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * add test for #2016 and fix java. Signed-off-by: Terence Parr <parrt@antlr.org> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * ensure all targets have the appropriate argument list for the template causing the problem. Signed-off-by: Terence Parr <parrt@antlr.org> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * Fix other targets Signed-off-by: Terence Parr <parrt@antlr.org> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * fix format Signed-off-by: Terence Parr <parrt@antlr.org> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * add check that $args is a list Signed-off-by: Terence Parr <parrt@antlr.org> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * change made by @lingyv-li to fix bug in DART exposed by this test. Signed-off-by: Terence Parr <parrt@antlr.org> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * fix AssertIsList in multiple targets. Go doesn't pass test and has no AssertIsList so I'm dropping that test from the Go test suite. How did a comment to the C++ runnerFor my future reference as to how to build things from the command line. Signed-off-by: Terence Parr <parrt@antlr.org> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * C++ gets an exception with this test so I'm turning it off. See antlr/antlr4#3845 Signed-off-by: Terence Parr <parrt@antlr.org> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * feat: #3840 Move Go to version v4.11.0 Signed-off-by: Jim.Idle <jimi@gatherstars.com> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * feat: #3840 Create the v4 version of the Go runtime Signed-off-by: Jim.Idle <jimi@gatherstars.com> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * feat: Create the v4 runtime layout for the Go runtime, ready for release tagging Note that the vast majority of the changes here are just copying the runtime file in to the /v4 subdirectory so that we can support legacy projects that use GOPATH only, as well as users that can use go modules. At a later release, we will delete the default path, and move the v4 subdirectory back to the top level. But, we cannot do that on this release. Signed-off-by: Jim.Idle <jimi@gatherstars.com> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * Reenable go tests on CircleCI Signed-off-by: Ivan Kochurkin <kvanttt@gmail.com> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * Fold constants in generated code for all runtimes Go: getInlineTestSetWordSize 32 -> 64 Dart: get rid of BigInt Swift: optimize TestSetInline Python: fixes #3698 JavaScript: fixes #3699 Signed-off-by: Ivan Kochurkin <kvanttt@gmail.com> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * Use int literals instead of refs for Python and JavaScript Update getMultiTokenAlternativeDescriptor test fixes #3703 Signed-off-by: Ivan Kochurkin <kvanttt@gmail.com> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * update release doc for Go version numbers Signed-off-by: Terence Parr <parrt@antlr.org> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * fix: #2016 Fix Go template list reference, go runtime and got test template for list labels Signed-off-by: Jim.Idle <jimi@gatherstars.com> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * feat: Add a deprecation message to the existing v1 module Signed-off-by: Jim.Idle <jimi@gatherstars.com> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * Split tool and runtime tests for GitHub workflow Build only necessary modules for tests Signed-off-by: Ivan Kochurkin <kvanttt@gmail.com> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * Remove not used methods from FileUtils (runtime tests) Signed-off-by: Ivan Kochurkin <kvanttt@gmail.com> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * Update dependencies of antlr4-maven-plugin Signed-off-by: Ivan Kochurkin <kvanttt@gmail.com> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * Update jUnit: 5.8.2 -> 5.9.0 Signed-off-by: Ivan Kochurkin <kvanttt@gmail.com> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * Fixes #3733; update ST4 so it uses proper ANTLR 3 Signed-off-by: Terence Parr <parrt@antlr.org> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * tweak doc Signed-off-by: Terence Parr <parrt@antlr.org> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * Set to 4.11.0 not 4.11 in poms Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * [maven-release-plugin] prepare release 4.11.0 Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * [maven-release-plugin] prepare for next development iteration Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * Damn. java target said 4.10.2 not 4.11.0 Signed-off-by: Terence Parr <parrt@antlr.org> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * roll back to 4.11.0; made mistake Signed-off-by: Terence Parr <parrt@antlr.org> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * roll back to 4.11.0; made mistake Signed-off-by: Terence Parr <parrt@antlr.org> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * [maven-release-plugin] prepare release antlr4-master-4.11.0 Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * [maven-release-plugin] prepare for next development iteration Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * use build and twine to publish source and wheel Signed-off-by: Qijia Liu <liumeo@pku.edu.cn> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * tweak doc Signed-off-by: Terence Parr <parrt@antlr.org> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * tweak c++ build script to make Mac binaries with cmake/make Signed-off-by: Terence Parr <parrt@antlr.org> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * tweak release doc Signed-off-by: Terence Parr <parrt@antlr.org> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * tweak code / doc related to bad previous release Signed-off-by: Terence Parr <parrt@antlr.org> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * [maven-release-plugin] prepare release 4.11.1 Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * [maven-release-plugin] prepare for next development iteration Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * clean up deploy c++ source script Signed-off-by: Terence Parr <parrt@antlr.org> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * cleanup code generation Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * don't initialize default param values twice Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * add missing field Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * update codegen template for 4.11.1 Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * support new param: Parser Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * fix template for 4.11 Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * default export Listener and Visitor Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * also default export parser and lexer Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * all tests pass except 7 caused by #3868 Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * fix issues Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * make it easy to break Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * fix #3868 Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * ALL TESTS PASS!!!! Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * cross fingers with CI Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * try fixing broken go tests Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * Try fix typescript CI Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * disable cpp for now Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * fix broken config Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * try fix macos gh build Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * improve speed by caching node_modules Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * no longer using ts-node Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * fix all tsc warnings Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * try fix MacOS CI Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * CI errors seem random, reactivate ubuntu Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * Disable node_modules caching, which seems to randomly fail in CI Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * don't delete symlink contents on windows (java bug with is SymbolicLink ?) Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * fix broken windows CI Signed-off-by: ERIC-WINDOWS\ericv <eric.vergnaud@wanadoo.fr> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * verify windows ci Signed-off-by: ERIC-WINDOWS\ericv <eric.vergnaud@wanadoo.fr> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * Revert "verify windows ci" This reverts commit 770d8218ecbc1a94d60854d5b00cc3c761c3469c. Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * reinstate full CI Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * manually merged * manually merge * fix merge * fix broken template * add template for invoking context list * fix typo * fix test templates * Add code of conduct but with a different name since I do not like that name Signed-off-by: Terence Parr <parrt@antlr.org> * Update C# release instructions * Tweak code of conduct Signed-off-by: Terence Parr <parrt@antlr.org> * Bring back the Package.swift in the project's root Signed-off-by: Nikolay Edigaryev <edigaryev@gmail.com> * swift-target.md: fix SPM installation instructions Signed-off-by: Nikolay Edigaryev <edigaryev@gmail.com> * the scope (parser or lexer) in @parser::header was dropped, so keep track of it and only include @Header in Listener and Visitor code Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> * drop workaround in favor of #3878 * drop cache usage since it fails in CI * #3878 was missing some scenarios * fix issue when deleting test folder * fix warnings * drop duplicate behavior * drop alien 'abstractRecognizer' property * drop alien property 'channels' * fix various codegen issues * change import * restore js extensions, see microsoft/TypeScript#50501 * use consistent inheritance * more API * more API stuff * fix typo * fix typescript exports * use ts-node to run typescript tests * webpack runtime before linking * fix exec paths on windows Signed-off-by: ERIC-WINDOWS\ericv <eric.vergnaud@wanadoo.fr> * fix failing tests * fix a few import issues * merge typescript-target with latest dev * runs Java and JavaScript tests after merging typescript-target * merge test template * skip unsupported test * fix template prototype * fix missing merge * bump typescript beta version after rebase * update docs * rollback unwanted changes Signed-off-by: HS <hs@apotell.com> Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr> Signed-off-by: nicksxs <nicksxs@hotmail.com> Signed-off-by: Terence Parr <parrt@antlr.org> Signed-off-by: Hell_Ghost <dev.hellghost@gmail.com> Signed-off-by: Hell_Ghost dev.hellghost@gmail.com Signed-off-by: Ross Patterson <ross.patterson@gmail.com> Signed-off-by: James Taylor <jamestaylor@apache.org> Signed-off-by: Bryan Tan <bryantan@technius.net> Signed-off-by: Jim.Idle <jimi@gatherstars.com> Signed-off-by: Tim McCormack <cortex@brainonfire.net> Signed-off-by: Ivan Kochurkin <kvanttt@gmail.com> Signed-off-by: Qijia Liu <liumeo@pku.edu.cn> Signed-off-by: ERIC-WINDOWS\ericv <eric.vergnaud@wanadoo.fr> Signed-off-by: Nikolay Edigaryev <edigaryev@gmail.com> Co-authored-by: HS <hs@apotell.com> Co-authored-by: nicksxs <nicksxs@hotmail.com> Co-authored-by: Terence Parr <parrt@antlr.org> Co-authored-by: Hell_Ghost <dev.hellghost@gmail.com> Co-authored-by: Ross Patterson <ross.patterson@gmail.com> Co-authored-by: James Taylor <jamestaylor@apache.org> Co-authored-by: Bryan Tan <bryantan@technius.net> Co-authored-by: Jim.Idle <jimi@gatherstars.com> Co-authored-by: Tim McCormack <cortex@brainonfire.net> Co-authored-by: Robert Adam <dev@robert-adam.de> Co-authored-by: Bryan Tan <Technius@users.noreply.github.com> Co-authored-by: Ivan Kochurkin <kvanttt@gmail.com> Co-authored-by: Qijia Liu <liumeo@pku.edu.cn> Co-authored-by: Nikolay Edigaryev <edigaryev@gmail.com>
Stackoverflow: https://stackoverflow.com/questions/72266899/golang-performance-issues
Google group: https://groups.google.com/g/antlr-discussion/c/OdhAIsy2GfI
Example code: https://github.com/movelazar/perf-repro
A simple rule such as:
takes exponentially longer to parse the more
1 EQ 2 OR
clauses there are. This does not happen in python (by my testing) or CSharp, Dart, Java (by stackoverflow comment).On my machine, # of lines vs parse time:
Given that Python doesn't face this issue I can't imagine I'm doing something terrible in my grammar.
Issue goes away if I put parens on things but that's not a real solution.
On 4.10.1, first noticed with 4.9.1.
Any help is greatly appreciated. Surprised I can't find others with this issue.
The text was updated successfully, but these errors were encountered: