CS 441-Midterm Exam
Fall 1999
Meng Yi Yee
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 turnel 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.
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 Range: 32,768 to 32,767 |
int A |
large_integer | 32-bit signed integer Range: -2,147,483,648 to 2,147,483,647 |
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 8 bits exponent length, 23 bits mantissa length |
float A |
large_float | 15-16 digits significant
signed floating-point 11 bits exponent length, 52 bits mantissa length |
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 This is the end of the comment !# |
Arithmetic Operations
Operator | Description | Example |
+ | Addition | Result = A + B |
- | Subtraction | Result = A B |
* | Multiplication | Result = A * B |
/ | Division | Result = A / B Sample output: Result = 17.1 |
\ | Integer Division | Result = A \ B Sample output: Result = 17 |
% | Modulus | Result = A % B Sample output: Result = 1 (17.1) |
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 float y1 float z1 float x2 float y2 float z2 |
Initial location in x-plane Initial location in y-plane Initial location in z-plane Final location in x-plane Final location in y-plane Final location in z-plane |
Turn (char Direction, float Degree) | Turn left or right in the amount of degree | char Direction float Degree |
Turning direction, L or R Number of degree to be turned |
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 float y_axis float z_axis |
Target location in x-plane Target location in y-plane Target location in z-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