Error using Syntactic predicates
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   ron_Bigman
Posted On:   Tuesday, April 8, 2008 12:10 PM

I am trying to analyze an sql where statement and I encountered a problem dealing with multiple parenthesses. To solve this problem I used syntactic predicates, but other, non related errors started occuring. After looking in the Java generated code I noticed that the function DFA.predict fails in the following expression (a*b=c) I fail to see the reason of the failure, according to my analysis, ANTLR should analyze it properly I would appriciate some help My grammer: grammar SQLTmp; options { output=AST; ASTLabelType=CommonTree; // type of $stat.tree ref etc... } compound_condition : simple_condition (AND simple_con   More>>

I am trying to analyze an sql where statement and I encountered a problem dealing with multiple parenthesses.
To solve this problem I used syntactic predicates, but other, non related errors started occuring.

After looking in the Java generated code I noticed that the function DFA.predict fails in the following expression
(a*b=c)

I fail to see the reason of the failure,
according to my analysis, ANTLR should analyze it properly
I would appriciate some help

My grammer:


grammar SQLTmp;
options {
output=AST;
ASTLabelType=CommonTree; // type of $stat.tree ref etc...
}

compound_condition
: simple_condition
(AND simple_condition)*
;
simple_condition
:
('(' compound_condition ')')=>('(' compound_condition ')')|
(expression '=' expression);

expression
: unaryExpression
( ( '*' | '/' ) unaryExpression )*
;
unaryExpression
: ('+'|'-')? simpleExpression ;
simpleExpression:
atomicExpression|
('(' expression ')')=>('(' expression ')');
atomicExpression
: constant|identifier;


identifier
: IDENTIFIER
;

constant
: NUMBER ;

//LEXER
AND : 'AND';

IDENTIFIER
// options { testLiterals = true;}
:('a'..'z'|'A'..'Z')
('a'..'z'|'A'..'Z'|'0'..'9'|'_'|'$'|'#')*
;

NUMBER
: DIGIT ( DIGIT )* ;

DIGIT : '0'..'9'
;

   <<Less
About | Sitemap | Contact