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

Frank Font mrfont at room4me.com
Thu Jan 17 12:04:16 PST 2008


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.)
2.  If it is the right tool, is there already a grammar that will get me 
most of the way there?

Thanks in advance for any advice.

Regards,
Frank Font



More information about the antlr-interest mailing list