HOME
ABOUT GCS
INTERFACE
DESCRIPTION
EXAMPLES

Description of the Current System

The current system is just an exploratory system that implements only a part of the C programming language. I have omitted the terminals listed below, in order to releave my programming load. I thought them as luxurious or redundant or too sophisticated for the phase 1 model.

After finishing the programming, I realized that to include these terminals simply affects the size of the parse table and there will little extra efforts be needed. So I think it's a good idea to include all of them in the future model.

!
!=
%
%=
&
&&
&=
*=
++
+=
--
-=
->
.
...
/=
:
<<
<<=
>>
>>=
?
^
^=
auto
case
const
continue
default
do
enum
extern
float
goto
long
register
short
signed
sizeof
static
string
struct
switch
typedef
union
unsigned
void
volatile
while
|
|=
||
~

The first thing the GCS program does is to uncomment the source text sent from the client. The usual "/* */" comments can be used as well as the C++ style "//" comments. To be able to write comments is one of the major advantage of this system over the other interfaces such as GUI.

The GCS program next identifies the terminals in the client's source text. If any of the terminals listed above be used, GCS returns an error message to the client.

Then the GCS program constructs a parse tree based on the grammar. This process is straightforward and any grammartical error will be detected and reported to the client.

The execution of the client program is done by traversing the leaves and boughs of the parse tree. The tree is decorated by instructions or actions to perform at these leaves and boughs. It's like hanging ornaments in a Christmas tree.
I have not yet fully decorated the tree and I will do it over the time. It will take some time to complete it and you should induce the state of development from the examples. Variable initialization and multi-dimensional array are among the items yet to be implemented as of now.

The heart of GCS is the functions. Currently implemented functions are listed below. I will increase them over the time.
0
 printf(char *fmt,...)
 Formatted print. Characters 'i', 'f' and 'e' may be used in combination with '%'.
1
 double sin(double x)
 sin of x
2
 double cos(double x)
 cos of x
3
 double tan(double x)
 tangent of x
4
 double asin(double x)
 sin-1(x) in range betweem -pi/2 and pi/2
5
 double acos(double x)
 cos-1(x) in range between 0 and pi
6
 double atan(double x)
 tan-1(x)
7
 double atan2(double y,double x)
 tan-1(y/x)
8
 double sinh(double x)
 hyperbolic sine of x
9
 double cosh(double x)
 hyperbolic cosine of x
10
 double tanh(double x)
 hyperbolic tangent of x
11
 double exp(double x)
 exponential function ex.
12
 double log(double x)
 natural logarithm ln(x).
13
 double log10(double x)
 base 10 logarithm log10(x).
14
 double pow(double x,double y)
 xy
15
 double sqrt(double x)
 square-root
16
 double ceil(double x)
 smallest integer not less than x, as a double
17
 double floor(double x)
 largest integer nor greater than x, as a double
18
 double fabs(double x)
 absolute value of x
19
 double fmod(double x,double y)
 floating-point remainder of x/y, with the same sign as x.
20
 void MakeView(int width,int height)
 Set an imaginary rectangle area where the drawing takes place. width and height are in pixels and the coordinate system is upperl-left-origin system.
21
 void SetColor(int r,int g,int b)
 red, green and blue values are specified between 0 and 100, inclusive.
22
 void MoveTo(int x,int y)
 Move pen to (x,y) with pen up.
23
 void LineTo(int x,int y)
 Move pen to (x,y) with pen down.
24
 void GifOut()
 returns the drawing in GIF format.
25
 void OpenPoly()
 used in combination with ClosePoly(). MoveTo and LineTo function calls in between define a polygon, inside of which is painted by the currently set color. The last point of the polygon will be set to the first point automatically if contour is not closed.
26
 void ClosePoly()
 End of the fill-polygon operation. An OpenPoly()-ClosePoly() pair with a polygon drawing operation in between yields a painted polygon.
27
 void FontInfo(int font,int direc,int mode)
 font is the font ID number that must be either 11, 16 or 22. They are bitmapped fonts with the sizes of 6x11, 8x16 and 12x22. direc and mode are not yet used and set them to 0.
28
 void DrawString(char *c)
 draw the given string from the current pen position
29
 void MakeGraph(int left,int top,int right,int bottom)
 make a graph with the size of given rectangle
30
 void HorizTime()
 horizontal axis is time
31
 void HorizScale(char *c,double left,double right)
 define and draw the horizontal scale. c is title string. left and right define range.
32
 void VertScale(char *c,double left,double right)
 define and draw the vertical scale. c is title string. left and right define range.
33
 void MoveToG(double x,double y)
 move to point inside graph giving its coordinate in physical values
34
 void LineToG(double x,double y)
 move to point inside graph with pen-down giving its coordinate in physical values
35
 void PlotG(int mark,double x,double y)
 plot a mark such as a dot in graph giving its coordinate in physical values

DIALOGUE INTERFACE
MORE FUNCTIONS