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.
|
| printf(char *fmt,...) |
| Formatted print. Characters 'i', 'f' and 'e' may be used in combination with '%'. | |
|
| double sin(double x) |
| sin of x | |
|
| double cos(double x) |
| cos of x | |
|
| double tan(double x) |
| tangent of x | |
|
| double asin(double x) |
| sin-1(x) in range betweem -pi/2 and pi/2 | |
|
| double acos(double x) |
| cos-1(x) in range between 0 and pi | |
|
| double atan(double x) |
| tan-1(x) | |
|
| double atan2(double y,double x) |
| tan-1(y/x) | |
|
| double sinh(double x) |
| hyperbolic sine of x | |
|
| double cosh(double x) |
| hyperbolic cosine of x | |
|
| double tanh(double x) |
| hyperbolic tangent of x | |
|
| double exp(double x) |
| exponential function ex. | |
|
| double log(double x) |
| natural logarithm ln(x). | |
|
| double log10(double x) |
| base 10 logarithm log10(x). | |
|
| double pow(double x,double y) |
| xy | |
|
| double sqrt(double x) |
| square-root | |
|
| double ceil(double x) |
| smallest integer not less than x, as a double | |
|
| double floor(double x) |
| largest integer nor greater than x, as a double | |
|
| double fabs(double x) |
| absolute value of x | |
|
| double fmod(double x,double y) |
| floating-point remainder of x/y, with the same sign as x. | |
|
| 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. | |
|
| void SetColor(int r,int g,int b) |
| red, green and blue values are specified between 0 and 100, inclusive. | |
|
| void MoveTo(int x,int y) |
| Move pen to (x,y) with pen up. | |
|
| void LineTo(int x,int y) |
| Move pen to (x,y) with pen down. | |
|
| void GifOut() |
| returns the drawing in GIF format. | |
|
| 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. | |
|
| void ClosePoly() |
| End of the fill-polygon operation. An OpenPoly()-ClosePoly() pair with a polygon drawing operation in between yields a painted polygon. | |
|
| 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. | |
|
| void DrawString(char *c) |
| draw the given string from the current pen position | |
|
| void MakeGraph(int left,int top,int right,int bottom) |
| make a graph with the size of given rectangle | |
|
| void HorizTime() |
| horizontal axis is time | |
|
| void HorizScale(char *c,double left,double right) |
| define and draw the horizontal scale. c is title string. left and right define range. | |
|
| void VertScale(char *c,double left,double right) |
| define and draw the vertical scale. c is title string. left and right define range. | |
|
| void MoveToG(double x,double y) |
| move to point inside graph giving its coordinate in physical values | |
|
| void LineToG(double x,double y) |
| move to point inside graph with pen-down giving its coordinate in physical values | |
|
| void PlotG(int mark,double x,double y) |
| plot a mark such as a dot in graph giving its coordinate in physical values | |