Phase I: (Due: 4 October, 2009 - Sunday)
Electronic submission under p1
Using JFlex and JCup tools,
build the lexical analyser and parser for the DRC Query language. Wrap the
parser within an interactive program that behaves as the screen capture
shown at the end.
The program should also build a DRC expression tree (first a binary tree) and then it should transform the binary tree into a general tree in which any seqeunce of "and" and "or" operators are combined within the same node. Make sure that you have the "displayTree" code turned on - so that we can see the pre-order listing of the nodes.
[raj@tinman phase1]$ java DRC db
DRC> { u,v | (exists t,w,x,y,z)(
employee('John','B','Smith',t,u,v,w,x,y,z) ) }
::::Node:
Node Type: query
Select Variables : (
U,
V,
)
::::Node:
Node Type: exists
Variables are : (
T,
W,
X,
Y,
Z,
)
::::Node:
Node is : predicate
Predicate name is : EMPLOYEE
Arguments are : (
John,str
B,str
Smith,str
T,var
U,var
V,var
W,var
X,var
Y,var
Z,var
)
DRC> {a,b | p(x,y) and (exists u,v)p(a,b)}
Syntax Error
DRC> exit;
[raj@tinman phase1]$