Hello everyone
I need a little help here
i got a simple source language with simple rules
the general look of the program
Program my-prog; // any program start with the keyword program
var // just one time to start stating the variables
x:datatype // this part is for intial variables
X,y:datatype // for two varibles
Begin // now we start the dosy of the program
.
.
.
.
End
the Instructions
1- if(condition) then
statment; // one instruction only
2- if(condition)
Begin
statment1;
statment2;
End
else
Begin
.
.
.
End // in case of more than one instruction
3- while(condition) do
Begin
.
.
.
End
4- for counter=val1 to val2 do
Begin
.
.
.
End
5- var_name := exp;
6- read(x); // for reading x is a variable
7- readln(x);
8- write(exp);
9- writeln(exp);
there is a ready functions in this language such as:
sin, cos, tan, square, sqrt, max, min.
mathimatical things:
+, +=, -, -=, *, *=, /, /=
comparing things:
>, <, <=, >=, =, !=
first step is the lexical analysis which read a stream of characters and returns tokens
then semantic analysis
If anyone can help it would be cool otherwise thanks