SetDDT() public method

public SetDDT ( string s ) : void
s string
return void
示例#1
0
        static void Get()
        {
            for (;;)
            {
                t  = la;
                la = Scanner.Scan();
                if (la.kind <= maxT)
                {
                    ++errDist; break;
                }                                                           /* ML return changed to break */
                if (la.kind == 43)
                {
                    Tab.SetDDT(la.val);
                }

                la = t;
            }
        }
示例#2
0
文件: Parser.cs 项目: yisea123/X-PLC
        void Get()
        {
            for (;;)
            {
                t  = la;
                la = scanner.Scan();
                if (la.kind <= maxT)
                {
                    ++errDist; break;
                }
                if (la.kind == 44)
                {
                    tab.SetDDT(la.val);
                }

                la = t;
            }
        }
示例#3
0
        public static void Main(string[] arg)
        {
            Console.WriteLine("Coco/R (Aug 4, 2003)");
            string ATGName = null;

            for (int i = 0; i < arg.Length; i++)
            {
                if (arg[i] == "-nonamespace")
                {
                    Tab.nsName = null;
                }
                else if (arg[i] == "-namespace")
                {
                    Tab.nsName = arg[++i];
                }
                else if (arg[i] == "-trace")
                {
                    Tab.SetDDT(arg[++i]);
                }
                else
                {
                    ATGName = arg[i];
                }
            }
            if (arg.Length > 0 && ATGName != null)
            {
                int pos = ATGName.LastIndexOf('/');
                if (pos < 0)
                {
                    pos = ATGName.LastIndexOf('\\');
                }
                string file = ATGName;
                string dir  = ATGName.Substring(0, pos + 1);

                Scanner.Init(file);
                Trace.Init(dir);
                Tab.Init();
                DFA.Init(dir);
                ParserGen.Init(file, dir);

                Parser.Parse();

                Trace.Close();
                Console.WriteLine();
                Console.WriteLine("{0} errors detected", Errors.count);
            }
            else
            {
                Console.WriteLine("Usage: Coco {{Option}} Grammar.ATG {{Option}}{0}" +
                                  "Options:{0}" +
                                  "  -nonamespace{0}" +
                                  "  -namespace <packageName>{0}" +
                                  "  -trace   <traceString>{0}" +
                                  "Valid characters in the trace string:{0}" +
                                  "  A  trace automaton{0}" +
                                  "  F  list first/follow sets{0}" +
                                  "  G  print syntax graph{0}" +
                                  "  I  trace computation of first sets{0}" +
                                  "  P  print statistics{0}" +
                                  "  S  list symbol table{0}" +
                                  "  X  list cross reference table{0}" +
                                  "Scanner.frame and Parser.frame files needed in ATG directory{0}" +
                                  "or in a directory referenced by the environment variable CRFRAMES.",
                                  Environment.NewLine);
            }
        }