[antlr-interest] Seeking advice - 2 questions using ANTLR

Mark Volkmann r.mark.volkmann at gmail.com
Thu Jan 17 13:02:15 PST 2008


On Jan 17, 2008 2:04 PM, Frank Font <mrfont at room4me.com> wrote:
> Hello,
>
> I purchased the book, read through it, but I have a thick skull.
> Perhaps I can get some advice here on two questions about converting
> formula expressions that look like "basic" syntax...
>
> IF REP_DTE > '2001-01-01' AND ATOTAL>100 THEN
>     H-CAPRESTATE
> ELSE
>     IF REP_DTE < '2001-01-01' THEN
>         ACCTG_CNG + ACCTG_ERR_CRCT
>     END IF
> END IF
>
> Into a flat format that looks like Excel formula syntax...
>
> IF( AND(REP_DTE > '2001-01-01',ATOTAL>100), H-CAPRESTATE, IF(REP_DTE <
> '2001-01-01', ACCTG_CNG + ACCTG_ERR_CRCT)
>
> I tried writing a few grammar files, but all have had various runtime
> issues.
>
> Here are my questions...
>
> 1.  Is ANTLR the right tool for this job?  (I don't have much time.)

ANTLR can definitely do this. However, you shouldn't expect the work
to go quickly if this is your first ANTLR grammar. You'll be learning
lots of things along the way.

> 2.  If it is the right tool, is there already a grammar that will get me
> most of the way there?

I'm not aware of a particular existing grammar that is close to what
you want. Maybe someone else knows of one.

> Thanks in advance for any advice.
>
> Regards,
> Frank Font

-- 
R. Mark Volkmann
Object Computing, Inc.


More information about the antlr-interest mailing list