[antlr-interest] ISO SQL 2003 Grammar

Douglas Godfrey douglasgodfrey at gmail.com
Sun Oct 9 08:56:04 PDT 2011


To be able to build this grammar you must use Java 1.6 64bit with
a java heap size of 8GB. This requires a 64bit CPU & OS and more than
8GB or system memory. This is documented in the comments at the top
of the parser grammar.  I have also posted numerous notes on how to
transform this grammar so it will build with less memory. If you have
the time available, you are welcome to give it a try. Search the past
postings on Antlr-Interest for SQL2003.


>From the SQL2003Parser.g file:
// !!WARNING!! This grammar requires 64bit Java 1.6 and heap size for
AntlrWorks [1GB] and Antlr [8GB] or greater.
// 
// !!WARNING!! Your PC or Mac will require 10GB RAM or greater!
//
// You need to specify the heap size separately for both AntlrWorks and
for Antlr [when it is run by AntlrWorks]
// specify -Xmx8G in AntlrWorks::Preferences::General::ANTLR_options
// specify -Xmx1G on the Java command line for invoking AntlrWorks
//
// java16 -d64 -jar antlr_33_complete.jar -Xmx8G -Xwatchconversion
sql2003Parser.g
//
// on Mac OS X right-click the ANTLRWorks.app package, select Show Package
Contents and edit the info.plist file
//   add a new child to the Java property
//     Key   = VMOptions
//     Value = [string] -Xms256m -Xmx1G
//     Key   = VMArchs
//     Value = [array] [string] x86_64
//
//   or in XML format
//    <key>Java</key>
//    <dict>
//        <key>ClassPath</key>
//        <string>$JAVAROOT/antlrworks.jar</string>
//        <key>JVMVersion</key>
//        <string>1.6</string>
//        <key>MainClass</key>
//        <string>org.antlr.works.IDE</string>
//        <key>VMOptions</key>
//        <string>-Xmx1G</string>
//        <key>JVMArchs</key>
//        <array>
//          <string>x86_64</string>
//        </array> 
//    </dict>
//
// This SQL 2003 grammar has near-infinite look-ahead in some of the rules
relating to SQL expressions.
// The grammar will not generate no matter how much memory you have until
the infinite look-ahead is resolved.
// The likely culpret is the cluster of rules involving predicate,
value_expression, value_expression_primary,
// and nonparenthesized_value_expression_primary.
//
// If you manage to resolve the infinite lookahead, please repost the
updated grammar on the Antlr.org site




On 10/9/11 6:03 AM, "Ivan Bludov" <ivan.bludov at gmail.com> wrote:

>Hi all.
>I'm playing with SQL2003 grammar posted on your site
>(http://www.antlr.org/grammar/1304304798093/SQL2003_Grammar.zip). So as
>mentioned previously sqlParser has some antlr building problems. I
>figured out that this problems depends on antrl version. So with the
>antlr-3.4 code-generation fails with stack-overflow exception, it seems
>to fall into infinite loop. So with the antlr-3.3 version the
>code-generation is successful, but the generated parser has "duplicate
>case" errors of switch statement. So could you make some advice to fix
>the problem? Although this problem may correspond to some internal antlr
>bug.  
>
>I also tested this grammar with antlr-3.2 and the lexer and the parser
>have some other building problems both.
>
>Ivan Bludov
>
>
>List: http://www.antlr.org/mailman/listinfo/antlr-interest
>Unsubscribe: 
>http://www.antlr.org/mailman/options/antlr-interest/your-email-address




More information about the antlr-interest mailing list