コード例 #1
0
        public TreeAnalysis Parser()
        {
            TreeAnalysis tree = new TreeAnalysis(new OneParentNode("Tree", Program()));

            //tree.RootNode.PrintNode();
            return(tree);
        }
コード例 #2
0
        static void Main(string[] args)
        {
            Console.Write("<<File Name>>:");
            string str = Console.ReadLine();

            if (!str.EndsWith(".txt"))
            {
                StringBuilder FName = new StringBuilder();
                FName.Append(str).Append(".txt");
                str = FName.ToString();
                Console.WriteLine(str);
            }
            LexicalAnalizer LexAnalizer = new LexicalAnalizer(str);

            LexicalAnalizer.LA lexstruct = LexAnalizer.Out();
            SynthaxAnalyzer    SA        = new SynthaxAnalyzer(lexstruct);
            CodeGen            g         = new CodeGen(lexstruct);
            TreeAnalysis       tree      = SA.Parser();

            tree.RootNode.PrintNode();
            Console.WriteLine("\n\n\n");
            g.Generator(tree);
        }
コード例 #3
0
 public void Generator(TreeAnalysis tree)
 {
     stream = new StreamWriter("RESULT.txt", false, Encoding.Default);
     DepthFirstRun(tree.RootNode);
     stream.Close();
 }