Phase I: (Due: 25 October, 2004 - Monday)
Electronic submission under Assignment 4
Using JFlex and JCup tools,
build the lexical analyser and parser for the SQL-subset language. Wrap the
parser within an interactive program that behaves as follows:
$ java OurSQL
SQL>select pno,pname
SQL>from parts;
No syntax error
SQL>select distinct cname
SQL>from customers
SQL>where cno in (select cno
SQL> from orders
SQL> where ono in (select ono
SQL> from odetails
SQL> where pno in (select pno
SQL> from parts
SQL> where color = 'Red')));
No syntax error
SQL>select cno
SQL>from orders
SQL>where exists (select ono
SQL> from odetails
SQL> where odetails.ono = orders.ono and
SQL> odetails.pno = 10506) and
SQL> exists (select ono
SQL> from odetails
SQL> where odetails.ono = orders.ono and
SQL> odetails.pno = 10507) and;
Syntax Error
SQL> @q1;
select cno
from orders
where exists (select ono
from odetails
where odetails.ono = orders.ono and
odetails.pno = 10506) and
exists (select ono
from odetails
where odetails.ono = orders.ono and
odetails.pno = 10507);
No Syntax Error
SQL> @q2;
select a, b c
from r, s
where r.a=s.a;
Error in line 1, column 13 : Syntax error
Error in line 1, column 13 : Couldn't repair and continue parse
SQL> select a, b from r, s where r.a = 'aaa' and s.a = r.b;
No Syntax Error
SQL> exit;
$