codingOL

Parser Program

Jul 22nd, 2012
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.23 KB | None | 0 0
  1. using System;
  2. using System.IO;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. using pseudo_c;
  7. using Hime.Redist.Parsers;
  8.  
  9. namespace parser
  10. {
  11.     class Program
  12.     {
  13.         public static void Main(string[] args)
  14.         {
  15.             pseudo_cLexer lexer = null;
  16.             pseudo_cParser parser = null;
  17.             ParserActions actions = new ParserActions();
  18.            
  19.             Console.Write("Input filename: ");
  20.             String filename = Console.ReadLine();
  21.            
  22.             if(!File.Exists(filename)) {
  23.                 Console.WriteLine("{0} does not exist.",filename);
  24.                 Console.Read();
  25.                 return;
  26.             }
  27.            
  28.             TextReader reader = new StreamReader(filename);
  29.  
  30.             try {
  31.                 lexer = new pseudo_cLexer(reader);
  32.                 Console.WriteLine("----- Lexer Integrity Test -----");
  33.                 Console.WriteLine("Complete");
  34.                 Console.WriteLine("----- Parser -----");
  35.                 parser = new pseudo_cParser(lexer, actions);
  36.                 //parser.Analyse();
  37.             }
  38.             catch (Exception ex) {
  39.                 Console.WriteLine(ex.ToString());
  40.             }
  41.                
  42.             reader.Close();
  43.            
  44.             Console.Read();
  45.         }
  46.     }
  47. }
Advertisement
Add Comment
Please, Sign In to add comment