antlr for grammar conversion

24 views
Skip to first unread message

nirmala

unread,
Apr 23, 2018, 7:32:15 AM4/23/18
to antlr-discussion

Greetings, 

I am trying to use ANTLR to convert from one SQL grammar to another. Can someone help me with these questions
1. Is using ANTLR the right approach - there are non-trivial differences between source and destination grammar, so if i try to parse the intermediate conversion using a source grammar errors are abound
     eg: source grammar recognizes this 
            CREATE TABLE test (a INTEGER) NOLOGGING;
         
           however i need to convert it to below in destination grammar
           CREATE UNLOGGED TABLE test (a INTEGER);

2. Some times i need listener and visitor both, is it possible
    eg: SELECT S.SUPPLIER_ID, S.SUPPLIER_NAME, O.ORDER_DATE
          FROM SUPPLIERS S, ORDERS O
          WHERE S.SUPPLIER_ID = O.SUPPLIER_ID ( + )  
          AND S.SUPPLLER_ID > 1000;

    Here i need to get the table names in FROM clause, their aliases, tables in WHERE clause and so on. If i try to use compileParseTreePattern, i am unable to do. Is there any other way.

Thanks in advance
Nirmala
Reply all
Reply to author
Forward
0 new messages