A programming language is designed and implemented using the Lex and Yacc compiler generating package to be used as a compiler for C language.
Team members | Sec | BN |
---|---|---|
Ahmed Hamdy | 1 | 1 |
Ayat Mostafa | 1 | 10 |
Mohamed Abdullah | 2 | 16 |
Nada Adel | 2 | 27 |
- We assume that, if the comparison is true, the flag will be zero
- Any complete statement (line) ends with a semicolon(;)
if ( expression ) {
line1
line2
...
}
else if ( expression ) {
line1
line2
...
}
...
...
else {
line1
line2
...
}
switch ( identifier ) {
case number/char/string :
line 1
line 2
....
break;
...
...
default :
line 1
line 2
....
break;
}
for ( int i = 0; expression ; expression )
{
line 1
line 2
}
while(/*any_logical_exp*/)
{
line 1
line 2
....
}
do
{
line 1
line 2
....
}
while(/*any_logical_exp*/);
/* any number of nested blocks, each defined with a start and an end curly braces */
{
line 1
....
}
{
line 1;
{
line 2
line 3
....
}
line 4
....
}
/* each block can contain any other type of statements with no constraints */
-int
-float
-char
-string
-bool
-void for function
e.g
int x;
int y=5;
string name = "I love compiler course"
char c='a';
bool flag=true;
Data_type function_name(params){
line1
line2
..
return expression;
}