Exemple #1
0
        static void Main(string[] args)
        {
            
            
           syn syntax = new syn();
           
            int counter = 0;
            int count = 0;
            string line;
            System.IO.File.WriteAllText("check.txt", string.Empty);
            System.IO.File.WriteAllText("int.txt", string.Empty);
            System.IO.File.WriteAllText("float.txt", string.Empty);
            System.IO.File.WriteAllText("string.txt", string.Empty);
            System.IO.File.WriteAllText("char.txt", string.Empty);
            System.IO.File.WriteAllText("icg.txt", string.Empty);

            // Read the file and display it line by line.
            System.IO.StreamReader file =
               new System.IO.StreamReader("d:\\VS 2012/Lexical2/Lexical/bin/Debug/classpart.txt");
            while ((line = file.ReadLine()) != null)
            {
                
                counter++;
            }

            file.Close();
            syntax.arr(counter);
            System.IO.StreamReader file1 =
               new System.IO.StreamReader("d:\\VS 2012/Lexical2/Lexical/bin/Debug/classpart.txt");
            while ((line = file1.ReadLine()) != null)
            {
                //Console.WriteLine(line);
                syntax.set(line);
                counter++;
            }

            file1.Close();


            

            syntax.get();



          //  syntax.get();
            
            bool check;
            check = syntax.validate();
            if (check == true)
           {
                Console.WriteLine("valid");
            }
            else
          {
               Console.WriteLine("not valid");
           }
            
           
            Console.ReadLine();
        }