On 05/22/16 10:48, 'Mike Lischke' via antlr-discussion wrote:
>>> Well, the snapshot is pure Java code (to generate the parser files), no wonder you don't find the Ref<> template there. Instead include antlr4-runtime.h, which is the umbrella header for the runtime and gives you everything you need. See the demo, it uses exactly that. Does the demo compile for you?
>>
>> No, the snapshot contains compile-time code (headers) as well. But,
>> nothing that defines Ref.
>
> Can you tell me under which path you see header files? I just looked in the jar and see only class files and some support files (dot mostly). No headers at all.
Sorry, I was looking at the git cloned directory structure.
antlr4/runtime/Cpp/runtime is where I see header files. There are
headers in this directory, and further sub-dirs: atn, dfa, misc,
support, and tree. None of which defines Ref.
>>>> Where does the
>>>> C++ definition for this class live? I'm pretty sure that this is my
>>>> problem, but I've given up grepping my system for it. [I did find a
>>>> defintion online in someone else's git, but I thought that if ANTLR4 is
>>>> using it, should ANTLR4 provide its definition?
>>>
>>> It's in runtime/src/antlr4-common.h. This header is included with the umbrella header. Just use that one and you should be done.
>>
>> There is no runtime/src directory in the snapshot....
I meant to say that my git-clone has no runtime/src directory that I can
find. At least not in antlr4/runtime/Cpp
>
> Of course not! The snapshot is just the ANTLR tool. It should not have anything else but the ANTLR java code + some documentation. I was referring to the C++ runtime, which is not in the jar (the various runtimes have never been part of the ANTLR jar AFAIR).
>
>>
>> I'll go back and look in the cloned-git directory....
>
> Yes, that's what you need to do. Clone the repo, place the jar into the demo folder and run the generate.sh script to generate the parser/lexer/visitor/listener files. Then compile everything using cmake. You can install cmake just like make from your yum or whatever respository Fedora has (I'm not very familiar with Linux tbh.). Then execute the steps as given for cmake. Should be very simple. If that doesn't compile then we may have a problem in the cmake file. But I've been told it would nicely compile the code and create the demo binary.
The generate script sets up a CLASSPATH, and that's about it. It looks
like it configures a build environment for running the tool in. It then
runs the tool over T.lexer.g4 and T.parser.g4, but it does not actually
compile any of the generated c++ files.
>>>> I am using your tool in a very virgin environment. I run the tool from
>>>> the command line, and I am now trying to build a small Makefile to do
>>>> the work for me. So far, none of the compilations compile to
>>>> completion.
>>>
>>> Can't you use cmake instead? There is a cmake file in the runtime/ folder.
>>
>> I'd prefer to use eclipse, but, .... I've never used cmake before. It
>> appears to be a system generator as opposed to a system builder.
>> It probably needs some configuration that I've never done before.
>
> Hmm, I haven't used Eclipse for C++ development at all, but I guess it's not so much different than other IDEs. Create a new console app, add the main.cpp file to it, maybe even the full C++ runtime if you don't want to use a library and that should be it.
I went back to the github with my web browser, and I see what you are
pointing me to, but it is not present in the cloned files on my
computers.... Did I not clone the project correctly?
I used the following to create my local directory:
$ git clone
https://github.com/DanMcLaughlin/antlr4
The top level of this contains only:
antlr4-maven-plugin build CHANGES.txt contributors.txt doc
LICENSE.txt pom.xml README.md runtime runtime-testsuite tool
tool-testsuite
my runtime/Cpp/runtime does *NOT* contain a src directory
Should I remove my clone from my computer and clone it again, hoping to
get a better copy?