Developer forums (C::B DEVELOPMENT STRICTLY!) > CodeCompletion redesign

New parser model for Code completion

<< < (14/16) > >>

grv575:
Any progress?  Getting the cpp parser to compile is a nightmare on mingw and even getting the antlr lib to compile on mingw is a mess.  Using the autoconf stuff doesn't seem to work ("no rule to build Makefile.in", among other errors) and well, I've pretty much given up on antlr2.7.6 lib / antlrcpp / antlr cpp parser combinations.  Maybe the codestore stuff is better in terms of working compiling instructions, etc.  Didn't bother to download vcl yet to try it out, but is the project even active (looked like stuff from 2 years ago iirc)?  Not much luck getting a simple working demonstration of this stuff on windows using mingw gcc.  Anyone mind posting detailed instructions on setup stuff if they've had sucess with getting something working?

TDragon:
I've been working with ANTLR 2.7.5 (I haven't gotten around to building 2.7.6 yet) and CPP_grammarV3.1 from the ANTLR website, with some good success. Out-of-the-box, it'll correctly parse a GCC-preprocessed file if it doesn't use any GCC extensions or built-in types (i.e. didn't include any standard headers); most of my time has been spent getting to know CPP_parser.g to figure out where and how I should add them. After adding support for most gcc __attribute__ specifiers and adding __builtin_va_list to the basic types, I came VERY close to successfully parsing Quadratic.cpp which includes two standard headers. Of the few remaining errors, most are related to the lack of support for "using" declarations when doing AST resolution lookup, so right now I've moved back to building a custom AST container which I'll drop in before I correct them.

After reading all the installation and usage instructions, only one step wasn't completely obvious, which was that I had to rebuild libantlr.a rather than using the pre-packaged version. Basically,
- Make sure you have MinGW and MSys installed (MSys is only needed to build the antlr library; it's fully MinGW32 compatible after this)
- Download and unzip antlr-x.y.z.tar.gz
- Open MSys, go to the antlr directory, run "./configure --disable-examples" (I added "--prefix=/path/to/antlr-dir" because I wasn't sure where the default was)
- Run "make install"
- If you want to be able to run antlr from the Windows command prompt, also download antlr-x.y.z.exe
- Download and unzip CPP_parserV3.1.zip
- If you want extended trace functionality, copy LLkParser.hpp to the antlr include/antlr directory; otherwise, comment out all references to antlrTrace() in CPP_parser.g
- Run antlr on CPP_parser.g to generate CPPParser.(cpp,hpp), CPPLexer.(cpp,hpp), and STDCTokenTypes.(hpp,txt)
- Compile CPPParser.cpp, CPPLexer.cpp, Dictionary.cpp, LLkParser.cpp (if you want extended trace), and Support.cpp into whatever project you want to use the parser in
- For the test project included with the parser, also compile Main.cpp and MyCode.cpp with MYCODE #defined

That was all from memory, but any problems you run into should be trivial. If you compile the test project, you can run the resulting executable on any preprocessed code (use gcc -E) to get a list of defined functions and optionally a list of declarations.

Hope that helps,
Twilight Dragon

takeshimiya:
The project is actively mantained (last release was from 2 months ago or so).

I've used the MSVC6 projects of ANTLRC++ that comes with CodeStore, imported them and only had to change a class instantation which was a bug in MinGW. Compiled with 0,0 warnings/errors in C::B.

grv575:

--- Quote from: Takeshi Miya on December 23, 2005, 07:52:52 pm ---The project is actively mantained (last release was from 2 months ago or so).

I've used the MSVC6 projects of ANTLRC++ that comes with CodeStore, imported them and only had to change a class instantation which was a bug in MinGW. Compiled with 0,0 warnings/errors in C::B.

--- End quote ---

What's the link to the codestore download you're using?

takeshimiya:
No link, I fetched from CVS.  :)

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version