Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Course Project: Project 1: Language Identification and Validation Your task for Project 1 is to create a language that will allow a user to manage,

Course Project:

Project 1: Language Identification and Validation

Your task for Project 1 is to create a language that will allow a user to manage, store, and query user data for a corporation. You will be creating a system similar to SQL. This project will focus on creating the basic language parsing mechanism to recognize valid (and invalid) phrases in the language. Below you will find a complete sampling of the valid statements in the language. Note that some of the statements can be nested together. You should only print the following:

You must implement functionality for both the execute command as well as the exit command.

If it is a valid statement is should print VALID select Statement (where select is whatever the type is)

If it is not a valid statement it should print INVALID select Syntax (where select is whatever the type is)

If it doesnt have a type (complete garbage) then print INVALID SYNTAX

CLARIFICATIONS:

TABLE_NAME must be alphabetic only (no reserved words and no special symbols)

COLUMN_NAME must be alphabetic only (no reserved words and no special symbols)

Commands can be multi-lined as well as multiple statements on a single line

(Underline denotes optional items)

Functionality:

create table TABLE_NAME (

COLUMN_NAME TYPE,

COLUMN_NAME TYPE,

COLUMN_NAME TYPE,

....

);

Note: TYPE is the type of the data stored in the field of the table. The valid types are: integer, float, boolean, char, char(n) where n is an integer (fixed length string).

drop table TABLE_NAME;

alter table TABLE_NAME add COLUMN_NAME TYPE;

alter table TABLE_NAME drop COLUMN_NAME;

alter table TABLE_NAME alter COLUMN_NAME TYPE;

select distinct COLUMN_NAME_LIST from TABLE_EXPRESSION where BOOLEAN_EXPRESSION;

NOTE: COLUMN_NAME_LIST can be the following:

COLUMN_NAME, COLUMN_NAME, ...

* denotes ALL columns. EX. select * from Student;

NOTE: TABLE_EXPRESSION can be the following:

TABLE_NAME

A nested SELECT_STATEMENT in parenthesis.

TABLE_EXPRESSION natural join TABLE_EXPRESSION

NOTE: BOOLEAN_EXPRESSION can contain the following:

COLUMN_NAME COMPARATOR IDENTIFIER

IDENTIFIER is a VALUE

COMPARATOR is one of the following: =, <, >, >=, <=.

BOOLEAN_EXPRESSION LOGIC_OPERATOR BOOLEAN_EXPRESSIONLOGIC_OPERATOR is either AND or OR.

AND has higher precedence (i.e. it gets evaluated first)

not BOOLEAN_EXPRESSION

insert into TABLE_NAME (COLUMN_NAME_LIST) values (VALUES_LIST);

NOTE: COLUMN_NAME_LIST length must match VALUES_LIST length, but Type doesnt need to be checked for this project.

update TABLE_NAME set COLUMN_NAME = VALUE where BOOLEAN_EXPRESSION;

delete from TABLE_NAME where BOOLEAN_EXPRESSION;

execute from FILE_NAME;

exit;

Project 2: Implementation of Statements (Non-Persistent)

Implement the following Statements the tables only need to exist during execution.

create table TABLE_NAME (

COLUMN_NAME TYPE,

COLUMN_NAME TYPE,

COLUMN_NAME TYPE,

....

);

TABLE_NAME is the name of the table being created. Make sure that a table with that name doesnt already exist.

COLUMN_NAME is the name of the column being created. Make sure that there are no two columns in a single table of the same name.

TYPE is the type of the data stored in the field of the table. The valid types are: integer, float, boolean, char, char(n) where n is an integer (fixed length string).

drop table TABLE_NAME;

Deletes the table and data for the table that matches the TABLE_NAME.

alter table TABLE_NAME add COLUMN_NAME TYPE;

NOTE: If the table already has data the added column will be set to NULL

alter table TABLE_NAME drop COLUMN_NAME;

Removes the Column from the table and its data (if any exist).

alter table TABLE_NAME alter COLUMN_NAME TYPE;

Changes the type of the specified column. CANNOT be performed on a table with data.

insert into TABLE_NAME (COLUMN_NAME_LIST) values (VALUES_LIST);

NOTE: COLUMN_NAME_LIST length must match VALUES_LIST length

update TABLE_NAME set COLUMN_NAME = VALUE where BOOLEAN_EXPRESSION;

Where clause is optional. If where clause isnt added each record is updated.

delete from TABLE_NAME where BOOLEAN_EXPRESSION;

where BOOLEAN_EXPRESSION is optional. Deletes any record in the table that causes the BOOLEAN_EXPRESSION to be true. If the where clause isnt added delete each record.

select distinct COLUMN_NAME, COLUMN_NAME, from TABLE_EXPRESSION;

select COLUMN_NAME_LIST from TABLE_EXPRESSION;

NOTE: COLUMN_NAME_LIST can be the following:

COLUMN_NAME, COLUMN_NAME,

* denotes ALL columns. EX. select * from Student;

NOTE: TABLE_EXPRESSION can be the following:

TABLE_NAME

A nested SELECT_STATEMENT in parenthesis.

TABLE_EXPRESSION natural join TABLE_EXPRESSION

Project 3: Implementation of Statements (Persistent)

Improve the system by incorporating XML files for the table schema as well as Random Access Files to store the data during both execution and permanently.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Spatial Databases A Tour

Authors: Shashi Shekhar, Sanjay Chawla

1st Edition

0130174807, 978-0130174802

More Books

Students also viewed these Databases questions

Question

4 What is the recruitment phase?

Answered: 1 week ago