Sunday, March 29, 2009

Compiler Instruction Set

//Ronie Q. Biloy
//Lizyl Mercurio
//User’s Manual

Upon running the program, input filename (ex. file.txt) to be compiled in the given textfield.
There are two textArea which are Turboc++ (Left) and Assembly Code (Right). After compiling it will generate an ASM code in the High.txt.

1. All instruction set must be in newLine. And semi-colon is one of those that indicates newLine.
2. All instruction set aside from HeaderFile and main must end with a semi-colon.
3. Syntax for HeaderFile #include
4. Syntax for HeaderFile #include
Allowed HeaderFile AND

clrscr cout
getch cin
getche
5. Syntax for void main //no return statement...
6. Syntax for main //have a return statement...
Allowed main: void main() AND main()
7. Syntax for Balanced Scope
8. Syntax for Balanced Parenthesis
9. Syntax for method clrscr
10. Syntax for method getch
11. Syntax for method getche
12. Syntax for int
13. Syntax for float
13. Syntax for double
Allowed DataType are: int,float,double
15. Syntax rule for declaring a variable name
variable name:
a. must not start with a no.# or aany special character
b. can only use underscore and equal_sign(Initialization) as special character
c. cannot be declared twice
d. must declared first before the variable can be use
16. Reserved word and DataType can't be use as variable name
17 Syntax for Initializing variable name
a. number datatype must not initialize into characterType
b. Integer datatype can't be initialize into float/double datatype
18. Type-Checking
a. variable with int datatype can be assigned to int datatype only.
b. variable with float datatype can be initialize into float/double datatype
c. variable with double datatype can be initialize into float/double datatype
19. Syntax for cout
cout statement must contain four (4) <<
Allowed Statement:
ex.
a. cout< b. cout<<"hello";
c. cout<<"hello"< d. cout<<"hello"<<"world";
e. cout< f. cout<20. Syntax for cin
21. Syntax for Assignment Statement
Assignment Statement:
a. must be in same datatype
b. int and float variable name must not assigned to character
c. involve variable to variable or even variable to no.# constant assignment statement
22. Syntax for Binary Expression
Allowed Binary Expression:
a. var=var1+var2 (plus)
b. var=var1-var2 (minus)
c. var=var1*var2(multiply)
d. var=var1/var2 (divide)
23. Syntax for Unary Expression
Allowed Unary Expression:
a. ++ (unary plus)
b. -- (unary minus)
24. Syntax for if Conditional Statement
Allowed Conditional Statement:
a. if(var1 b. if(var1>var2){...statement...}
c. if(var1<=var2){...statement...}
d. if(var1>=var2){...statement...}
e. if(var1==var2){...statement...}
f. if(var1or>=or== no.# constant){...statement...}
g. if(no.# constant or<=or>or>=or== var2){...statement...}
25. A. if clrscr/getch/getche (methods) is declared #include also declared a hearfile for the ff. methods.
B. if cout/cin (syntax) is declared #include also declared a hearfile for the ff. methods.











 

©2009 Design Analysis | by TNB