On Wed, 2008-11-26 at 14:46 -0600, ian eyberg wrote:

> Hi, I'm using antlr 3.1.1 and evaluating
> it against boost::spirit and I'm having
> a pretty hard time coming up with even
> simple examples that work.


Please read through the C examples (see downloads for the examples tgz
download) and the examples in general, before trying to construct your
own examples. You should also consult the C API docs. You can also
search the past messages from the support page. All these links are
available from the antlr.org home page.

You might wish to start with the 5 minute intro and similar articles on
the wiki though as your questions are fundamental to ANTLR grammars of
all targets. 

$xxx.text
$xxx.text->chars

Return values of rules are usually contained in structures (returned,
not returned as pointers). Look at the generated source code and use an
IDE (Visual Studio is great but Netbeans 6.5 is not bad for *NIX), which
will help you with the structures.

Jim



> I have a grammar like so:
> --------------------
> grammar Blah
> options{ language = C; }
> r
> returns [char *s]
> :w1=ID ' ' w2=ID{ $s = "blah"; };
> ID: 'a'..'z'+;
> ------------------------
> 
> this will return me a "blah" but I'm having
> trouble figuring out howto return the value of
> w1 or w2;
> 
> I thought it was w1->getText() but that doesn't
> seem to work.
> 
> preferably I'd just like to pass in a struct
> and tack on w1 and w2 to it
> 
> I'm using the lexer/parser that this grammar
> generates in a c++ program.
> 
> can anyone point me to some resources on this?
> I've already looked through the examples tarball
> from the site and didn't find anything that related
> to these specific questions


Look for the C examples.

Jim

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"il-antlr-interest" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en
-~----------~----~----~----~------~----~------~--~---

List: http://www.antlr.org:8080/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org:8080/mailman/options/antlr-interest/your-email-address

Reply via email to