CS 441-Midterm Exam
Fall 1999
Requirements of the Language
The programming language must be able to accept inputs and produces outputs accordingly
The programming language must be able to support real-time system
The programming language must be able to handle data storage perfectly
The programming language must be able to support artificial intelligence
The programming language must be able to read input devices
The programming language must be able to support portability
Implement Issues of Project
Basically, this new programming language will be an event-driven programming language. The user in the mind field can hold a remote control or use a laptop computer as a controller to an underground drill. On the controller, there will be many choices of commands like move forward, move backward, turning, scan the area, bomb a target location and so on. These commands will be shown on the screen of a laptop computer or will be each individual button on a remote control.
Global Positioning System is used to track the underground drill so that the user will know where the current location of the underground drill. Furthermore, the user will know which path to use when the user wants the underground drill to return to the surface. This way, the user will not lose the underground drill by not knowing where the current location of the underground drill.
Some Artificial Intelligence is needed when implementing this issue because there might be some many critical conditions occur during mining. Collapse of the tunnel is one of the biggest critical conditions, the user will not feel it on the surface. The underground drill must have the ability to detect that incident before it happens and then the underground drill must be able to know how to move to a safer place.
Most of the commands need a location as inputs of the commands. In this case, a 3-dimensional plane representation is used. The underground drill always represents location (0, 0, 0) even though it moves from location A to location B. Below is the graphical representation of the issue.
This way, user can input the coordinate for commanding an underground drill to do some particular job like bombing a target location or scan the area from where to where.
Besides the above, this new programming language is highly portable. This programming language can be enhanced to perform new job such as going under water to search and rescue people. The programmer can choose not to use all the built-in modules. In fact, the programmer can create new modules. The new modules can be programmed to read inputs from other devices such as mouse or keyboard to perform the tasks. This will allow room for expandability to the existing language.
Language Features and Characteristic
Support different kinds of control devices
Support Graphical User Interface (GUI)
Support Global Positioning System (GPS)
Support Artificial Intelligence
Inclusion and/or Exclusion of Features
Support different kinds of control devices
Support Graphical User Interface
Support Global Positioning System
Support Artificial Intelligence
Develop the Regular Grammar
Data Types
Operator |
Description |
Example |
int |
16-bit signed integer |
int A |
large_integer |
32-bit signed integer |
large_int A |
char |
8-bit Windows (ANSI) characters |
char A |
string |
Character string stores value up to 255 characters |
string A |
bool |
Boolean stores TRUE or FALSE |
bool A |
float |
6-7 digits significant signed floating-point |
float A |
large_float |
15-16 digits significant signed floating-point |
large_float A |
Typed vs Typeless
Assignment and Comment
Operator |
Description |
Example |
= |
Assignment |
A = 1 + 2 |
## |
Sigle Line Comment |
## This is sigle line comment |
!#, #! |
Multiple Lines Comment |
!# This is the start for the comment |
Arithmetic Operations
Operator |
Description |
Example |
+ |
Addition |
Result = A + B |
- |
Subtraction |
Result = A – B |
* |
Multiplication |
Result = A * B |
/ |
Division |
Result = A / B |
\ |
Integer Division |
Result = A \ B |
% |
Modulus |
Result = A % B |
Logical Operations
Operator |
Description |
Example |
&& |
AND |
A && B |
| |
OR |
A | B |
! |
NOT |
!A |
Equality and Relational Operations
Operator |
Description |
Example |
= = |
Equal |
A = = B |
!= |
Not Equal |
A != B |
> |
Greater Than |
A > B |
< |
Smaller Than |
A < B |
>= |
Greater Than or Equal |
A >= B |
<= |
Smaller Than or Equal |
A <= B |
Statement Types
If-Then-Else Statement
Nested If-Then-Else Statement
While Statement
Repeat-Until Statement
Case Statement
For Statement
Modules
Module |
Description of Module |
Variables |
Description of Variables |
Scan (float x1, float y1, float z1, float x2, float y2, float z3) |
Scan for mine from initial location to final location |
float x1 |
Initial location in x-plane |
Turn (char Direction, float Degree) |
Turn left or right in the amount of degree |
char Direction |
Turning direction, L or R |
Forward (float Distance) |
Move forward in the amount of feet |
float Distance |
Number of feet to move forward |
Backward (float Distance) |
Move backward in the amount of feet |
float Distance |
Number of feet to move backward |
Bomb (float x_axis, float y_axis, float z_axis) |
Bomb a location in the specified target location |
float x_axis |
Target location in x-plane |
Detect () |
Detect for mines, count number of groups of mines and show the location of mine on the controller screen |
|
|
Drill (float Depth) |
Drill the current location until the specified depth |
float Depth |
Depth in feet that to be drill |
Collect () |
Store the mines in the storage compartment after drilling |
|
|
Modularity
Grammar
Example of the Programming Language
References