[antlr-interest] Looking for quick help on compiling Antlr

Brent Yates brent.yates at gmail.com
Wed Jun 11 11:40:48 PDT 2008


George,

I have no embedded actions other than a few counters to resolve
ambiguities.  I use the C code to produce an AST which I then process using
C++ classes.  The C runtime is *very *quick to lex and parse into an AST.  I
convert the ANTLR generated AST into a C++ AST class and extract information
from it using class methods.  It works very well.

The advantage of this flow is that I can use gUnit to validate my grammar
and AST.  I HIGHLY recommend using gUnit (or equivalent) as it will find
errors that otherwise would go unnoticed until you are in the middle of some
critical demo/project.  gUnit will also help you produce efficient AST
structures as you will 'see' the tree produced from each rule as part of
setting up gUnit.  As you make changes to your grammar or the AST rewrite
rules gUnit will validate that you still produce the expected tree structure
- which is critical since your C++ AST class data extraction methods expect
a certain fixed structure and must be sync'ed to the actual AST produced.

Regards,

Brent Yates

On Wed, Jun 11, 2008 at 12:24 PM, George J. Shannon <
George.Shannon at raphaelanalytics.com> wrote:

>  Thanks Brent, that worked great!
>
>
>
> Are you using pure C or C++?  I'm using C++ classes embedded in my grammar
> due to the nature of the information I want to extract.  I haven't gotten
> this to work yet so I'm just seeing if you have tried and what worked, what
> did not, etc.
>
>
>
> Thanks again,
>
>
>
> George
>
>
>
> George Shannon
>
> President, Raphael Analytics, Inc.
>
> 16 Spur Drive
>
> Fenton, MO 63026
>
> (314) 550-5589 (cell)
>
> George.Shannon at raphaelanalytics.com
>
> www.raphaelanalytics.com
>
>
>
> The information transmitted is intended only for the person or entity to
> which it is addressed and may contain confidential and/or privileged
> material.  Any review, retransmission, dissemination or other use of, or
> taking of any action in reliance upon, this information by persons or
> entities other than the intended recipient is prohibited.   If you received
> this in error, please contact the sender and delete the material from any
> computer.
>   ------------------------------
>
> *From:* Brent Yates [mailto:brent.yates at gmail.com]
> *Sent:* Wednesday, June 11, 2008 10:31 AM
> *To:* George J. Shannon
> *Cc:* antlr-interest at antlr.org
> *Subject:* Re: [antlr-interest] Looking for quick help on compiling Antlr
>
>
>
> George,
>
> I am using the Antlr3.1b1 release with the C runtime (Windows XP) and it
> works just fine so the problem is probably in your classpath / launch
> procedure.  I use a batch file to compile my grammars.  Here is an example
> that works for me:
>
> @echo off
> set
> CLASSPATH=E:\UtilityDev\VerilogParser\AntlrWorks\antlr-3.1b1\lib\antlr-2.7.7.jar;E:\UtilityDev\VerilogParser\AntlrWorks\antlr-3.1b1\lib\antlr-3.1b1.jar;E:\UtilityDev\VerilogParser\AntlrWorks\antlr-3.1b1\lib\antlr-runtime-3.1b1.jar;E:\UtilityDev\VerilogParser\AntlrWorks\antlr-3.1b1\lib\gunit-1.0.2.jar;E:\UtilityDev\VerilogParser\AntlrWorks\antlr-3.1b1\lib\stringtemplate-3.1.jar
> set cmd=java -Xmx750M org.antlr.Tool SystemVerilog.g
> echo %cmd%
> rem %cmd%
> %cmd% 2>error.txt
>
>
> My classpath environment variable is set in the batch file to point to each
> of the necessary JAR files.
>
> Hope this helps!
>
> Regards,
>
> Brent Yates
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20080611/5cd43407/attachment.html 


More information about the antlr-interest mailing list