Using JFlex and JCup tools, build the lexical analyzer 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> select cno
SQL> from orders
SQL> where exists (select ono
SQL> from cdetails
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);
No Syntax Error
SQL> @q2;
select a, b, c, s, wozy
where r.a = s.a;
Error in line 1, column 3: Syntax error
Error in line 1, column 3: Couldn't repair and continue parse
No Syntax Error
SQL> exit;