O’zbekiston


Download 3.06 Mb.
bet3/5
Sana03.12.2023
Hajmi3.06 Mb.
#1806449
1   2   3   4   5
Bog'liq
BOZOROV OG’ABEK labaratoriya7

getchar();

  • return 0;

    103. }
    Dastur natijasi:

    Daturning to’liq matni:



    1. #pragma once

    2. #include"stdafx.h"

    3. #include

    4. #include

    5. #include

    6. #include







    7) #define INT

    01

    8) #define CHAR

    02

    1. #define FLOAT

    2. #define LONG

    03



    04

    11) #define DOUBLE

    05

    12) #define STRUCT

    06

    13) #define PRINTF

    07

    14) #define SCANF

    08

    15) #define FOR

    09

    16) #define DO

    10

    1. #define WHILE 11

    2. #define IF 12

    3. #define ELSE 13

    4. #define CONTINUE 14

    5. #define BREAK 15

    6. #define DEFAULT 16

    7. #define CASE 17

    8. #define GOTO 18

    9. #define SWITCH 19

    10. #define OB 20

    11. #define CB 21

    12. #define LP 22

    13. #define RP 23

    14. #define EQUALTO 24

    15. #define LT 25

    16. #define GT 26

    17. #define PLUS 27

    18. #define MINUS 28

    19. #define MUL 29

    20. #define DIV 30

    21. #define COLON 31

    22. #define SCOLON 32

    23. #define TERNARY 33

    24. #define COMMA 34

    25. #define PLINE 35

    26. #define CARAT 36

    27. #define DIGIT 37

    28. #define ID 38

    29. #define OSB 39

    30. #define CSB 40

    31. #define HSH 41

    32. #define PER 42

    33. #define MAIN 43

    34. #define VOID 44

    35. #define NOTEQU 45

    36. #define AND 46

    37. #define BSH 47

    38. #define DQ 48

    39. #define SQ 49

    40. #define DOT 50

    41. #define INCLUDE 51

    42. #define SPACE 52

    43. #define TAB 53

    44. #define NUM_ENTRIES 54

    45. int token_no=0,key=0,ident=0,sp=0,op=0,digit=0;

    46. char keyM[100][100],identM[100][100],spM[10000],opM[100][100],digitM[1000];

    47. using namespace std;




    1. struct table

    65) {

    1. char name[25];

    2. int token;

    68) };



    1. struct table ref_tab[NUM_ENTRIES] = {




    1. {"int", INT},

    2. {"char", CHAR},

    3. {"float", FLOAT},

    4. {"long", LONG},

    5. {"double", DOUBLE},

    6. {"struct", STRUCT},

    7. {"printf", PRINTF}, 77) {"do", DO},

    78) {"while", WHILE}, 79) {"if", IF},

    1. {"else", ELSE},

    2. {"continue", CONTINUE},

    3. {"break", BREAK},

    4. {"default", DEFAULT},

    5. {"case", CASE},

    6. {"goto", GOTO},

    7. {"switch", SWITCH}, 87) {"{", OB},

    88) {"}", CB},
    89) {"(", LP},
    90) {")", RP},
    91) {"=", EQUALTO},
    92) {"<", LT},
    93) {">", GT},
    94) {"+", PLUS},
    95) {"-", MINUS},
    96) {"*", MUL},
    97) {"/", DIV},
    98) {":", COLON},
    99) {";", SCOLON},
    100) {"?", TERNARY},
    101) {",", COMMA},
    102) {"|", PLINE},
    103) {"^", CARAT}, 104) {"[", OSB},
    105) {"]", CSB},
    106) {"#", HSH},
    107) {"%", PER},

    1. {"main", MAIN},

    2. {"void", VOID},

    110) {"!=", NOTEQU},
    111) {"&", AND},
    112) {"\\",BSH},
    113) {"\"",DQ},
    114) {"'", SQ},
    115) {"include",INCLUDE},
    116) };

    117) char out_token[NUM_ENTRIES+1][40]=


    118) {
    119) " ",

    1. "INT",

    2. "CHAR",

    3. "FLOAT",

    4. "LONG",

    5. "DOUBLE",

    6. "STRUCT",

    7. "PRINTF",

    8. "SCANF",

    9. "FOR",

    129) "DO",
    130) "WHILE",
    131) "IF",

    1. "ELSE",

    2. "CONTINUE",

    3. "BREAK",

    4. "DEFAULT",

    5. "CASE",

    6. "GOTO",

    7. "SWITCH",

    139) "{",
    140) "}",
    141) "(",
    142) ")",
    143) "=",
    144) "<",
    145) ">",
    146) "+",
    147) "-",
    148) "*",
    149) "/",
    150) ":",
    151) ";",
    152) "?",
    153) ",",
    154) "|",
    155) "^",
    156) "DIGIT",
    157) "ID",
    158) "[",
    159) "]",
    160) "#",
    161) "%",

    1. "MAIN",

    2. "VOID",

    164) "!=",
    165) "&",
    166) "\\",
    167) "\"",
    168) "'",
    169) ".",
    170) "INCLUDE"
    171) };

    1. namespace Leksik_analizator {

    2. using namespace System;

    3. using namespace System::ComponentModel;

    4. using namespace System::Collections;

    5. using namespace System::Windows::Forms;

    6. using namespace System::Data;

    7. using namespace System::Drawing;

    8. ///

    9. /// Summary for Form1

    10. ///


    11. public ref class Form1 : public System::Windows::Forms::Form

    183) {

    1. public:

    2. Form1(void)

    186) {
    187) InitializeComponent();
    188) //
    189) //TODO: Add the constructor code here
    190) //
    191) }

    1. protected:

    2. ///

    3. /// Clean up any resources being used.

    4. ///


    5. ~Form1()

    197) {
    198) if (components)

    199) {200) delete components;


    201) }
    202) }

    1. private: System::Windows::Forms::DataGridView^ dataGridView1;

    2. protected:

    3. private: System::Windows::Forms::DataGridViewTextBoxColumn^ Column1;

    4. private: System::Windows::Forms::DataGridViewTextBoxColumn^ Column2;

    5. private: System::Windows::Forms::DataGridViewTextBoxColumn^ Column3;

    6. private: System::Windows::Forms::DataGridViewTextBoxColumn^ Column4;

    7. private: System::Windows::Forms::DataGridViewTextBoxColumn^ Column5;

    8. private: System::Windows::Forms::Button^ button1;

    9. private: System::Windows::Forms::TextBox^ textBox1;

    10. private: System::Windows::Forms::Label^ label1;

    11. private: System::Windows::Forms::Label^ label2;

    12. private: System::Windows::Forms::Label^ label3;

    13. private: System::Windows::Forms::Label^ label4;

    14. private: System::Windows::Forms::Label^ label5;

    15. private:

    16. ///

    17. /// Required designer variable.

    18. ///


    19. System::ComponentModel::Container ^components;

    20. #pragma region Windows Form Designer generated code

    21. ///

    22. /// Required method for Designer support - do not modify

    23. /// the contents of this method with the code editor.

    24. ///


    25. void InitializeComponent(void)

    228) {

    1. this->dataGridView1 = (gcnew System::Windows::Forms::DataGridView());

    2. this->Column1 = (gcnew System::Windows::Forms::DataGridViewTextBoxColumn());

    3. this->Column2 = (gcnew System::Windows::Forms::DataGridViewTextBoxColumn());

    4. this->Column3 = (gcnew System::Windows::Forms::DataGridViewTextBoxColumn());

    5. this->Column4 = (gcnew System::Windows::Forms::DataGridViewTextBoxColumn());

    6. this->Column5 = (gcnew System::Windows::Forms::DataGridViewTextBoxColumn());

    7. this->button1 = (gcnew System::Windows::Forms::Button());

    8. this->textBox1 = (gcnew System::Windows::Forms::TextBox());

    9. this->label1 = (gcnew System::Windows::Forms::Label());

    10. this->label2 = (gcnew System::Windows::Forms::Label());

    11. this->label3 = (gcnew System::Windows::Forms::Label());

    12. this->label4 = (gcnew System::Windows::Forms::Label());

    13. this->label5 = (gcnew System::Windows::Forms::Label());

    14. (cli::safe_cast >(this-

    >dataGridView1))->BeginInit();

    1. this->SuspendLayout();

    244) //
    245) // dataGridView1
    246) //

    1. this->dataGridView1->ColumnHeadersHeightSizeMode = System::Windows::Forms::DataGridViewColumnHeadersHeightSizeMode:: AutoSize;

    2. this->dataGridView1->Columns->AddRange(gcnew cli::array< System::Windows::Forms::DataGridViewColumn^ >(5) {this->Column1,

    3. this->Column2, this->Column3, this->Column4, this->Column5});

    4. this->dataGridView1->Location = System::Drawing::Point(12, 54);

    5. this->dataGridView1->Name = L"dataGridView1";

    6. this->dataGridView1->Size = System::Drawing::Size(543, 422);

    7. this->dataGridView1->TabIndex = 0;

    254) //
    255) // Column1
    256) //

    1. this->Column1->HeaderText = L"Identifikatorlar";

    2. this->Column1->Name = L"Column1";

    259) //
    260) // Column2
    261) //

    1. this->Column2->HeaderText = L"Maxsus operatorlar";

    2. this->Column2->Name = L"Column2";

    264) //
    265) // Column3
    266) //

    1. this->Column3->HeaderText = L"kalit sozlar";

    2. this->Column3->Name = L"Column3";

    269) //
    270) // Column4
    271) //

    1. this->Column4->HeaderText = L"Operatorlar";

    2. this->Column4->Name = L"Column4";

    274) //
    275) // Column5
    276) //

    1. this->Column5->HeaderText = L"Raqamlar";

    2. this->Column5->Name = L"Column5";

    279) //
    280) // button1
    281) //

    1. this->button1->Location = System::Drawing::Point(153, 482);

    2. this->button1->Name = L"button1";

    3. this->button1->Size = System::Drawing::Size(222, 35);


    4. Download 3.06 Mb.

      Do'stlaringiz bilan baham:
  • 1   2   3   4   5




    Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
    ma'muriyatiga murojaat qiling