Professional Documents
Culture Documents
Lab (NO.1+H.W) - Compiler (2) - 2023 - 2024
Lab (NO.1+H.W) - Compiler (2) - 2023 - 2024
1
)2(
Sq. Contents Page
(1) Complete the program in C++ that simulates the sub - task of Lexical analysis phase in first semester to
build the Lexemes table (cutting the source program into the Lexemes (main -task)).
3
(2) Introduction of a program to create a Lexemes table 4
(3) The first method _ Write the program in C++ that simulates the sub - task of Lexical analysis phase to
build the Lexemes table (cutting the source program into the Lexemes (main -task)– Using Four 5
Arrays).
(4) A virtual representation of address locations in Four arrays, counters, and the number of Lexemes 6–7
inside the computer (on paper).
(5) Lap.1.1 Individual assignment during class: The second method _ Write the program in C++ that
simulates the sub - task of Lexical analysis phase to build the Lexemes table (cutting the source 8
program into the Lexemes (main -task) – Using Three Arrays). ()واجب داخل املخترب
(6) Lap.1.2 Individual assignment during class: The third method _ Write the program in C++ that
simulates the sub - task of Lexical analysis phase to build the Lexemes table (cutting the source 9
program into the Lexemes (main -task) – Using Two Arrays). ()واجب داخل املخترب
(7) HW.Lap.1.3 : How to draw a virtual representation of address locations in Three arrays, counters, and
the number of Lexemes inside the computer (on paper).
10
HW.Lap.1.4: How to draw a virtual representation of address locations in Two arrays, counters, and
the number of Lexemes inside the computer (on paper).
()3
ت م تتة الربنتتةصج ل تتةء Lexemes
tableصتتيف ن تترب الربنتتةصج املفتتا
وحذف التد قةت ودصج الةراغةت.
الحظ يف ال طر : 119
يف هذا االيدةز مت صدةجلة االسطر الةة غة والةراغ
اذا جةء يف بااية دو ن ةية اجلم ة.
الحظ :مت صدةجلة الةراغةت املتتةل تة ل تن مل
يت صدةجلة االسطر الةة غة والةراغ اذا
جةء يف بااية دو ن ةية اجلم ة.
[1] X = X X X + 1 0 0 ; \0
Lexs_oneLine [0] [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] Lexs_table
Loop i = 0 Counter n = 0,1,2,3,4,5
i f ( X X X < y ) \0
Lex_one [0] [1] [2] [3]
[0] [1] [2] )1( رقمLexeme
Loop k = 0 , 1 , 2 [0] i f \0
Counter M = 0 , 1 , 2 i f \0
)2( رقمLexeme [1] ( \0
Lex_one [0] [1]
Loop k = 3 , 4 [2] X X X \0
Counter M = 0 , 1 ( \0
)3( رقمLexeme [3] < \0
Lex_one [0] [1] [2] [3]
Loop k = 5 , 6 , 7 ,8 [4] Y \0
Counter M=0 , 1 , 2 , 3 X X X \0 )4( رقمLexeme
[5] ) \0
Lex_one [0] [1]
[6]
Loop k = 9 , 10 )5( رقمLexeme
Counter M = 0 , 1 < \0
[7]
Lex_one [0] [1] )6( رقمLexeme ص ةن ة متث ل [8]
ص اويف الد ةوين ا بيف املفة أةت
Loop k = 11 , 12
Counter M = 0 , 1 y \0
داخل احلةس ة
[9]
Lex_one [0] [1] [10]
Loop k = 13 , 14 A virtual representation of address locations in four arrays, counters,
Counter M = 0 , 1 ) \0 and the number of Lexemes inside the computer (on paper). [11]
Source [0] [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] … … … … [99] )7(
program [0] i f ( X X X < y ) \0
G
[1] X = X X X + 1 0 0 ; \0
Lexs_table
Lexs_oneLine [0] [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15]
Counter n =
Loop i = 1 X = X X X + 1 0 0 ; \0 0,1,2,3,4,5,6,7,8,9,10,11
Lex_one [0] [1] [2] [3]
[0] [1] A virtual representation of address locations in four arrays, counters,
Loop k = 0 , 1
and the number of Lexemes inside the computer (on paper). [0] i f \0
Counter M = 0 , 1 X \0
ص ةن ة متث ل [1] ( \0
ص اويف الد ةوين ا بيف املفة أةت
Lex_one [0] [1]
Loop k = 2 , 3 )7( رقمLexeme
Counter M = 0 , 1 = \0 داخل احلةس ة [2] X X X \0
[3] < \0
Lex_one [0] [1] [2] [3] )8( رقمLexeme
Loop k = 4 , 5 , 6 , 7 [4] Y \0
Counter M=0 , 1 , 2 , 3 X X X \0
)9( رقمLexeme [5] ) \0
Lex_one [0] [1]
Loop k = 8 , 9 [6] X \0
Counter M = 0 , 1 + \0 )10( رقمLexeme
[7] = \0
Lex_one [0] [1] [2] [3] [8] X X X \0
Loop k = 10,11,12,13 )11( رقمLexeme
Counter M=0 , 1 , 2 , 3 1 0 0 \0 [9] + \0
Lex_one [0] [1] [10] 1 0 0 \0
Loop k = 14 , 15 )12( رقمLexeme
Counter M = 0 , 1 ; \0 [11] ; \0
)8(
)8(
الطريقة الثةن ة
.استخاا ثالث صفة أةت ل حل
صيف ص ةن ة متث ل ط ةعة
ع ةوين املفة أةت
HW.Lap.1.3
How to draw a virtual representation of address locations in Three arrays, counters, and the number of
Lexemes inside the computer (on paper).
HW.Lap.1.4
How to draw a virtual representation of address locations in Two arrays, counters, and the number of
Lexemes inside the computer (on paper).