Abdullah Sheneamer 2012

-  How to Compile Your Source Code

You have two ways to compile your source code by DCSPM compiler:

1)  You can compile your source code by DCSPM compiler program as I explained in previous section how to use DCSPM compiler section.

2)  You can compile your source code by CMD which is in “ C:\Windows\System32\cmd.exe”

a)  First, you should write the directory of your source code file and DCSPM compiler program such as Figure C4.My command is “ cd C:\Users\Abdullah\Documents\Visual Studio 2010\DCSPM Compiler\COMPILER\bin\Debug”

b)  After clicking enter, you should write this command “ Compiler.exe “yourPascalName.pas” to run your Pascal program in DCSPM compiler program

such as Figure C5. After compile your Pascal program, DCSPM will generate YourProgramName.il file in the same directory of DCSPM compiler program. My pascal program name is “IfElseStatements.pas”

c)  You can run YourProgramName.il such as “ ilAsm YourProgram.il” to get YourProgram.exe such as Figure C6

d)  You can run yourProgramName.exe in CMD such as Figure C7

-  How to Test Pascal Code

I have tested nine programs which have different lines such as 11, 22, 33, 44, 55, 66, 77, 88, 99 lines. I did three kinds of test. First test is lexical analysis test. Second test is parser test. Third test is between initial nested if/else statement and improved nested if/else statement.

1-  Lexical Analysis phase Test

You have to write your Pascal program in main screen see Figure C1. When you click “Compile” the button which is in main screen, DCSPM will generate the MSIL screen which has two speeds time between using array list and dictionary in the left of the screen

such as in Figure C4.

I used this code below to test speed of lexical analysis which using array list for symbol table:

System.Diagnostics.Stopwatchstopwatch=

newSystem.Diagnostics.Stopwatch();

Stopwatch stopwatch = new Stopwatch();

Stopwatch.Start();

lex();

stopwatch.Stop();

speed = "Time Elapsed of Lexical Analysis: " + Elapsed.TotalMilliseconds + "ms";

And the code to test the speed of lexical analysis which using dictionary data structure for symbol table:

System.Diagnostics.Stopwatchstopwatch=

newSystem.Diagnostics.Stopwatch();

Stopwatch stopwatch = new Stopwatch();

Stopwatch.Start();

Improvedlex();

stopwatch.Stop();

speed = "Time Elapsed of Lexical Analysis: " + Elapsed.TotalMilliseconds + "ms";

More details about the code see section 5.2 Evaluation and performance.

2-  Parser phase test

I used the same approach of lexical analysis phase test. I used the same code but I put parser() function instead of lex() function such as the code below:

System.Diagnostics.Stopwatchstopwatch=

newSystem.Diagnostics.Stopwatch();

Stopwatch stopwatch = new Stopwatch();

Stopwatch.Start();

parser();

stopwatch.Stop();

speed = "Time Elapsed of Parser: " + Elapsed.TotalMilliseconds + "ms";

3-  Initial nested if/else statement MSIL and improved nested if/else statement MSIL

I tested initial and improvement if/else MSIL results which are generated in il file by DCSPM compiler. I created a batch timer.cmd file to calculate time of MSIL results such as the code below:

@echo off

echo %time% < nul

cmd /c %1

echo %time% < nul

After writing your Pascal program in main screen see Figure C1. When you click “Compile” the button which is in main screen, DCSPM will generate the MSIL and produce MSIL of your program in a file such as NameOftheProgram.il.

After producing your program MSIL, you should compile your file.il such as in Figure C9

There is another way to compile your program to MSIL , then compile and run your program MSIL by using this command “ Compiler.exe NameOfProgram.pas “ , then run your program MSIL “ilasm NameOfprogram.il” such as in Figure C10

When you finished compiling file.il by using ILAsm my .il file, then it will produce the exe with the same name as that of .il file. You should use the command in cmd: timer myfile.exe. To test your program of either initial if/else or improved if/else MSIL results such as in Figure C11. After getting times, you should subtract end time with start time such as end time – start time = 13:52:02.48 – 13:52:02.29 = 19 ms.

1