Skip to content

Changes for https://github.com/antlr/antlr4/issues/2693#2936

Closed
kaby76 wants to merge 1 commit into
antlr:masterfrom
kaby76:master
Closed

Changes for https://github.com/antlr/antlr4/issues/2693#2936
kaby76 wants to merge 1 commit into
antlr:masterfrom
kaby76:master

Conversation

@kaby76

@kaby76 kaby76 commented Oct 11, 2020

Copy link
Copy Markdown
Contributor

This is a fix for #2693. The change basically rolls over code from the Java runtime to the C# runtime that was never done. With the change, profiling now works. I posted this change a year ago, but because it was ignored until a few days ago, I closed that PR and re-did the PR with the changes here. I don't know what is going on with the Appveyor build of PHP, but the Git check-in is warning me about uncommited changes in ../runtime/PHP, which is a git submodule. I'm not changing anything in PHP, and this PR doesn't include changes to runtime/PHP. The build instructions say nothing about pulling the PHP submodule. The copyright dates are changed to 2019 (from my year-old PR), but every file should be updated Jan 1 with the new year via a script.

@ericvergnaud

Copy link
Copy Markdown
Contributor

Hi
thanks for this.
I don't have a problem with this, but how do we know it works (better than the current version)?
Would you be able to provide a test?

@kaby76

kaby76 commented Oct 12, 2020

Copy link
Copy Markdown
Contributor Author

Hi
thanks for this.
I don't have a problem with this, but how do we know it works (better than the current version)?
Would you be able to provide a test?

Eric,

I can't write a unit test for this because there is not a single unit test in the C# runtime that I can find, not a single .cs file with an attributed method for testing, not a single *.csproj that references any of the major testing packages (MSTest, NUnit, XUnit, ...). In other words,
it's not set up for unit testing of the C# runtime.

Normally, in Appveyor, one adds a line to appveyor.yml something like what I do for Antlrvsix here, then write C# tests, which should have been ported from the unit test suite for the Java runtime in the first place--if there is one.

Where are the unit tests, written in C# for the C# runtime? Please give me a single file with C# code with a unit test for the C# runtime. Give me a line number with an attributed unit test method in C#.

But, there are a number of things with this build I don't understand:

--Ken

@ericvergnaud

ericvergnaud commented Oct 12, 2020 via email

Copy link
Copy Markdown
Contributor

@kaby76

kaby76 commented Oct 12, 2020

Copy link
Copy Markdown
Contributor Author

OK, I see after typing in the build commands manually ("mvn install")"

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running org.antlr.v4.test.runtime.csharp.TestCompositeLexers
.java.io.IOException: Cannot run program ""C:\Program Files (x86)\MSBuild\12.0\Bin\MSBuild.exe"" (in directory 
"C:\Users\kenne\AppData\Local\Temp\BaseCSharpTest-main-1602504463472"): CreateProcess error=2, The system 
cannot find the file specified
    at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1128)
    at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1071)
    at org.antlr.v4.test.runtime.csharp.BaseCSharpTest.buildProject(BaseCSharpTest.java:389)

MSBuild version 12??! I'm not even sure I want to download and install Msbuild12 toolchain which came out with VS2013! And "mvn clean" doesn't remove these test directories?? I've got hundreds of these directories on my machine.

I now see the C# code in the AppData/Local/Temp/BaseCSharpTest* directories. Those aren't exactly "unit tests" of a particular method in the runtime, are they? These would be called "integration tests".

How do you propose I write a unit test for the constructor of AmbiguityInfo that I changed?

I also now see the closest test in the tool-testsuite, e.g., here and other places. That tests the Java runtime, but it's place under the tool tests, so profiling is never tested on any of the runtimes other than Java. How do you propose I write an integration test for C#? There's no String Template conversion here to generate C# code.

@kaby76

kaby76 commented Oct 12, 2020

Copy link
Copy Markdown
Contributor Author

Honestly, I don't know where to go with this. And the bigger problem is that the C# runtime should have been synchronized with the Java runtime 6 years ago. That's what the changes are--just resynching the sources, partially at that. In fact, the Java runtime is being modified without propagating the changes to the other runtimes, e.g., C#. Someone will then need to do a character-by-character diff and verify the runtimes are synchronized, really error-prone and unsafe, and changes are still being accepted for one runtime and not propagated to the other runtimes. This is bad.

@ericvergnaud

ericvergnaud commented Oct 12, 2020 via email

Copy link
Copy Markdown
Contributor

@ericvergnaud

ericvergnaud commented Oct 13, 2020 via email

Copy link
Copy Markdown
Contributor

@kaby76

kaby76 commented Oct 14, 2020

Copy link
Copy Markdown
Contributor Author

This is going to take a week or two to finish. I have to fish out the prereq's for doing a build on Windows (though it is tested with Appveyor on Windows) and cram this into BaseCSharpTest.java or nearby.

@ericvergnaud

ericvergnaud commented Oct 14, 2020 via email

Copy link
Copy Markdown
Contributor

@ericvergnaud

Copy link
Copy Markdown
Contributor

@kaby76 any progress?

@kaby76

kaby76 commented Dec 6, 2020

Copy link
Copy Markdown
Contributor Author

@kaby76 any progress?

Not yet. I've been busy with Antlrvsix/Trash (fast serialization of Antlr data structures, grammar diffing algorithms), Dart. I'll work on this soon, now post Antlr 4.9. --Ken

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants