ANTLRWorks TestRig stuck when compiling - code-generation

I started using ANTLR recently and found out about the ANTLRWorks IDE. Although the editor works fine, it seems, however, that when I am running the test rig it gets stuck on compiling grammar files (or rather does nothing with compiled grammar?), regardless of what input I am giving it. Here is the output I am getting:
ANTLR Codegen
Arguments: [-o, C:\Users\\AppData\Local\Temp\TestRigTask-1395567588803, -lib, C:\Users\\Desktop, -no-listener, -no-visitor, C:\Users\\Desktop\Test.g4]
ANTLR Testrig
Compiling grammar files...
Here is the input I am giving it to test the issue:
Grammar
grammar Test;
CUP : 'cup';
MUG : 'mug';
TEA : 'tea';
COFFE: 'coffe';
drinker : 'drinking a' holder 'of' liquid;
holder : MUG | CUP;
liquid : TEA | COFFE;
Test file
drinking a mug of coffe
Am I doing something wrong / missing something important?

Check that you are running ANTLRWorks2 with a JDK rather than just a JRE. ANTLRWorks requires the Java compiler, javac, in order to compile the grammar to run the test rig and javac is only included with a JDK and not with the JRE.
ANTLRWorks should be able to find the JDK if installed, but if that is not working you can specify the --jdkhome <path> argument when launching ANTLRWorks.

Related

PHPUnit is Working With Command Line, but not with Eclipse

Whenever I run a test file from eclipse it works and display result as:
. 1/1 (100%)
Time: 371 ms, Memory: 8.00MB
OK (1 test, 1 assertion)
But If I run the same test from the Eclipse Oxygen, I get the error:
PHP Fatal error: Declaration of PHPUnitLogger::addFailure(Test $test, AssertionFailedError $e, $time): void must be compatible with PHPUnit\Framework\TestListener::addFailure(PHPUnit\Framework\Test $test, PHPUnit\Framework\AssertionFailedError $e, float $time): void in /tmp/phpunit_printer/PHPUnitLogger.php(415) : eval()'d code on line 1
I downloaded phpunit-7.1.phar, and installed it globally by making it executable and moving it to /usr/local/bin and for Eclipse, I have downloaed in the Download directory and without making it executable I added it into my Eclipse Project as an External Phar but it is not working and giving the above error.
Can someone help me fixing the issue?
By the way, I am a NetBeanse User, but NetBeans is not supporting PHP7.1 that's why moving to Eclipse.
UPDATE
Here is my test file:
<?php
namespace tests\Unit\;
use PHPUnit\Framework\TestCase;
class MyTest extends TestCase
{
public function testSimple() {
$this->assertEquals(1, 1);
}
}
I had exactly the same problem with PHPUnit 7.5.14 and didn't find a solution.
Since I wanted to test my application running with PHP 7.1, I decided to try PHPUnit 6 and it worked at once. So PHPUnit 6.5.14 did the trick for me.
It seems Eclipse is not compatible with PHPUnit 7. My Eclipse Version is 2018-12 (4.10.0) with PDT 6.2. After switching to PHPUnit 6 other problems (that I managed to find workarounds for) were gone too. For example the generated class code overrides TestCase::__construct without calling the parent constructor. It seems to be a problem with PHPUnit 7, not so with 6.
I didn't find a compatibility chart of Eclipse PDT to support my thesis.

Unknown Eclipse Errors using gfortran, Cygwin

Using Windows 7 64 bit. I've followed these instructions for installing Eclipse for Parallel Application Developers and Cygwin, the latter because I want gfortran to compile Fortran code. At 18:20 in the linked tutorial he compiles in Eclipse with no errors, but I get the following 2 errors (Project is called "example"):
Description Resource Path Location Type
make: *** [example] Error 1 example C/C++ Problem
recipe for target 'example' failed makefile /example/Debug line 29 C/C++ Problem
My code (main.f90, under project "example") is simply
program main
print*, "hello world"
end program main
I've also tried compiling through the terminal, but get the following:
>>gfortran main.f90
gfortran: fatal error: -fuse-linker-plugin, but cyglto_plugin.dll not found
compilation terminated
Any help is appreciated!
The tutorial, you linked, is 2 years old...
As far as I see from the content of the packages available from http://www.cygwin.com/packages/, you have to install gcc-fortran instead of gcc4-fortran, because the latter one is labeled as obsolete.
The library cyglto_plugin.dll, which is used for Link-Time-Optimization, can be found in the package gcc-core and should be installed as a dependency. You could try to disable this library by using -fno-use-linker-plugin, but this will disable some optimization.

Issues with g++ and Eclipse on Linux - unresolved symbols

I am running Ubuntu 64bit version, and downloaded the latest 64bit Eclipse.
Installed g++ along with build-essential. Tested g++ to make sure it works from terminal, and it works fine.
alex#ubuntu:~/Desktop$ g++ test.cpp -o test
alex#ubuntu:~/Desktop$ ./test
Hello World!alex#ubuntu:~/Desktop$
However, trying to build simple C++ Hello Word project(one of the default projects that comes with Eclipse), I am getting error.
Description Resource Path Location Type
Program "g++" not found in PATH Preferences, C++/Build/Settings/Discovery, [CDT GCC Builtin Compiler Settings] options C/C++ Scanner Discovery Problem
I have added Environment variable named g++ with value /usr/bin/g++ and the above error went away, however, now I am getting unresolved errors, though project compiles and in the Console shows !!!Hello World!!!
Description Resource Path Location Type
Symbol 'endl' could not be resolved test_hello.cpp /test_hello/src line 13 Semantic Error
Symbol 'cout' could not be resolved test_hello.cpp /test_hello/src line 13 Semantic Error
Symbol 'std' could not be resolved test_hello.cpp /test_hello/src line 10 Semantic Error
Have I correctly entered Environmental variable ?? How can I get fix the "unresolved" error ?? Thanks !
When compiling there are two important things to consider:
1.) Is my path up-to-date with executables?
2.) Is my library path correct?
It appears you satisfy 1.) but not 2.)
The unresolved symbol error means that Eclipse cannot find your library via LD_LIBRARY_PATH or some other medium. It's attempting to locate the standard compiled C++ library.
How did you install g++?
Kindly do this and post the results:
Project > Properties > C/C++ Build > Environment
If everything there appears nominal, you can try
/sbin/ldconfig
which should hopefully re-parse your system library paths and might update your environment.

Static type checking error for groovy collection.addAll

This message is also posted on grails mailing list.
In addition to my earlier question I downloaded the grails source from github.
Building via documented gradlew install works (almost) perfect. Than I imported the whole project into Eclipse. And with a bit fighting groovy plugins and "project - workspace-groovy-compiler-issues" I only have a few issues left, all boiling down to java Collection modification in groovy classes. For instance in PluginBuildSettings.groovy:
List<Resource> artefactResourcesList = []
...
artefactResources.addAll compileScopePluginInfo.artefactResources
which gives an error:
Groovy:[Static type checking] - Cannot call java.util.List#addAll(java.util.Collection ) with arguments [java.util.Set ]
I really don't see what the issue may be.
I tried changing the artefactResources declaration in PluginScopeInfo from:
Set<Resource> artefactResources = []
to:
Set<Object> artefactResources = []
which takes away error above, but introduces some other problems let alone the unittests. I'm not hindered with extensive groovy knowledge but it looks all perfect valid to me.
I'm using ggts:
Groovy/Grails Tool Suite
Version: 3.1.0.RELEASE
Build Id: 201210061306
groovy-compiler: 2.0.4.xx -20120921
On mac os x 8.2
java 6.0._37
groovy compiler: 2.0 (workspace and project).
With my favorite search engine I found a reference to grails bug 5516, which is solved but it looks resurected
Type checker fails verification of generic types with addAll
Fixed in 2.0 rc 3,

Unresolved __builtin_ia32_stmxcsr

I have inherited code, trying to compile with gcc on Linux.
what library am I looking for that has __builtin_ia32_stmxcsr ?
apologies -- i was too fast to submit; running gcc inside of Nvidia Eclipse. actual error message is "Functuion . . . could not be resolved" so i jumped the conclusion i needed to reference some lib. As the offending lines hav a :#if defined(SSE) I take it to mean that the -msse2 switch is present although i cannot seem to find a copyh of the compile command line. [just learning this Eclipse tool -- very new!]
You don't need to link with anything - the "builtin" in the name is a clue that it's a gcc built-in (intrinsic) compiler function.
However you do need to be compiling for an x86 target with SSE enabled for this to be recognised, e.g. gcc -msse2 ....
Note that you can use the _mm_getcsr intrinsic from <xmmintrin.h> instead of __builtin_ia32_stmxcsr - this would be a little more portable.
This is a bug in eclipses indexer with gcc's __builtin* functions. The bug report is at https://bugs.eclipse.org/bugs/show_bug.cgi?id=352537
The problem is that even the glibc/gcc libraries themselves use these __builtin* functions, so eclipse complains about a faulty xmmintrin.h etc., which is of course nonsense.
There is a workaround given in the bug report, you can add the function prototypes as user defined macros for the indexer, but of course this becomes tedious if there are a few more and some type checking abilities are lost.