Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6131161
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T16:56:31+00:00 2026-05-23T16:56:31+00:00

I am constructing a MySQL grammar validator with ANTLR. I started with the sql_yacc.yy

  • 0

I am constructing a MySQL grammar validator with ANTLR. I started with the sql_yacc.yy from the MySQL source code, but I have some difficulties converting the following grammar. I tried many times, but it doesn’t work. Can anyone help me?

expr
  : expr or expr 
  | expr XOR expr
  | expr and expr
  | NOT_SYM expr 
  | bool_pri IS TRUE_SYM 
  | bool_pri IS not TRUE_SYM 
  | bool_pri IS FALSE_SYM
  | bool_pri IS not FALSE_SYM 
  | bool_pri IS UNKNOWN_SYM
  | bool_pri IS not UNKNOWN_SYM 
  | bool_pri
  ;

bool_pri
  : bool_pri IS NULL_SYM 
  | bool_pri IS not NULL_SYM 
  | bool_pri EQUAL_SYM predicate 
  | bool_pri comp_op predicate
  | bool_pri comp_op all_or_any '(' subselect ')' 
  | predicate
  ;

predicate
  : bit_expr IN_SYM '(' subselect ')'
  | bit_expr not IN_SYM '(' subselect ')'
  | bit_expr IN_SYM '(' expr ')'
  | bit_expr IN_SYM '(' expr ',' expr_list ')'
  | bit_expr not IN_SYM '(' expr ')'
  | bit_expr not IN_SYM '(' expr ',' expr_list ')'
  | bit_expr BETWEEN_SYM bit_expr AND_SYM predicate
  | bit_expr not BETWEEN_SYM bit_expr AND_SYM predicate
  | bit_expr SOUNDS_SYM LIKE bit_expr
  | bit_expr LIKE simple_expr opt_escape
  | bit_expr not LIKE simple_expr opt_escape
  | bit_expr REGEXP bit_expr
  | bit_expr not REGEXP bit_expr
  | bit_expr
  ;

bit_expr
  : bit_expr '|' bit_expr 
  | bit_expr '&' bit_expr
  | bit_expr SHIFT_LEFT bit_expr 
  | bit_expr SHIFT_RIGHT bit_expr 
  | bit_expr '+' bit_expr
  | bit_expr '-' bit_expr 
  | bit_expr '+' INTERVAL_SYM expr interval 
  | bit_expr '-' INTERVAL_SYM expr interval
  | bit_expr '*' bit_expr
  | bit_expr '/' bit_expr 
  | bit_expr '%' bit_expr 
  | bit_expr DIV_SYM bit_expr 
  | bit_expr MOD_SYM bit_expr 
  | bit_expr '^' bit_expr
  | simple_expr
  ;
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T16:56:32+00:00Added an answer on May 23, 2026 at 4:56 pm

    ANTLR cannot cope with left-recursion, so there’s no trivial way to convert sql_yacc.yy into the ANTLR equivalent. You might want to have a look at the following resources from the ANTLR Wiki:

    • Left-Recursion Removal
    • SQL grammar for MySQL dialect (ANTLR v3)

    Note that the MySQL grammar is incomplete, but might give you a starting point.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am constructing a large HTML document from fragments supplied by users that have
I have a problem constructing a mysql query: I have this table tSubscribers were
can some one provided some suggestions of constructing MySQL querys that are both fast
Given: Constructing an ADO Connection object from one thread and giving it to another
I'm constructing a simple form in ERB but the HTML produced by the text_field
I'm constructing an ecommerce application in Symfony, and I have a page which lists
I am constructing a webcomic site, but the chapter order has changed significantly. I
This is my situation: I am constructing an ad-like application in Django and Mysql.
When retrieving a hierarchical structure from MySQL (table with one ID column and one
I'm constructing a program which uses mprotect() to restrict a block of memory from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.