ANTLR (parser generator)

Status
Not open for further replies.

puffinus

Ars Praefectus
4,381
Subscriptor
I've been using flex/bison for a long time.

I'm now trying ANTLR (having an IDE is particularly nice).

It generates lexer and parser code (I'm creating to C++).

The C++ doc page says that I need to include <TParser.hpp>
http://www.antlr.org/wiki/pages/viewpag ... d=29130834

but I can't find the file anywhere in the generated code, in the "ANTLR 3.5 distribtion", or in the C runtime distributions.
Main download page
http://www.antlr3.org/download.html

Nor do I see it in the 3.4 package (though it does have a "TParser.h" in the Objective C runtime directory.

Any other users have a pointer?
 

puffinus

Ars Praefectus
4,381
Subscriptor
Jonathon":1fur14mk said:
The file it is referring to is the parser it should have generated for you (where T is the name of your grammar). So, if you generated a grammar named Foo, you should have a FooParser.hpp to include.

It just gave a lexer and parser cpp files with no header files.

The menu item I used to get them was Generate.
 

puffinus

Ars Praefectus
4,381
Subscriptor
puffinus":2hoz8urp said:
Jonathon":2hoz8urp said:
The file it is referring to is the parser it should have generated for you (where T is the name of your grammar). So, if you generated a grammar named Foo, you should have a FooParser.hpp to include.

It just gave a lexer and parser cpp files with no header files.

The menu item I used to get them was Generate.

A couple of points in case anyone else tries/tried this:

1) antlrworks-1.4.3 generates C code and headers. antlrworks-1.5 generates C code with no headers and generates pages of complaints about the grammar file (even using basic examples). Other people have apparently had this problem too.

2) The API was changed around 3.4, so antlr3AsciiFileStreamNew is obsolete; antlr3FileStreamNew is the new one.

If the C generated code works for me, I'll leave it at that for now.
 
Status
Not open for further replies.