[antlr-interest] Free Text mixed with rules

victor panizza victor.panizza at gmail.com
Tue Jun 17 17:17:29 PDT 2008


Hello All,

I have the follow issue:

I'm trying to develop a Parse Grammar and a Tree Parse for read PL/SQL
scripts and translate it to DB2 SQL PL. Now, there're many diferences
beetwen thems and this diferences are defined by the rules and some
literals, but there're many things in common like the IF LOGICAL_OPERATION
THEN END IF;

My Idea is create a Node in the tree (using a token like FREE_TEXT) where I
can put each segment of free text like the above and later walk the tree and
get this free text in the same order on they were recongnized. For example:

IF (LAST_DAY(PDATE)!=PDATE) THEN
  PDATEAUX := ADD_MONTHS(PDATE, PMONTHS);
  RETURN ADD_MONTHS(PDATE, PMONTHS);
END IF;

In text tree representation:

(ROOT
          (FREE_TEXT "IF (LAST_DAY(PDATE)!=PDATE) THEN")
          (ASSING "PDATEAUX := PDATE;")
          (FREE_TEXT "RETURN ADD_MONTHS(PDATE, PMONTHS);")
           (FREE_TEXT "END IF;);")
)


Any idea, thanks in advance!!!!

-- 
Saludos,
Victor Panizza
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20080617/ed8e128a/attachment.html 


More information about the antlr-interest mailing list