Beispiel #1
0
 public void Compile(ParserCompiler pc)
 {
     foreach (var rule in Rules)
     {
         rule.Compile(pc);
     }
 }
Beispiel #2
0
        static void Main(string[] args)
        {
            //var secs = (new DateTime(2009, 1, 1) - new DateTime(1970, 1, 1)).TotalSeconds;
            string inf  = args[0];
            string outf = args[1];
            string ns   = args[2];
            string cls  = args[3];

            using (StreamReader sr = new StreamReader(inf))
            {
                string         data   = sr.ReadToEnd();
                GramParser     parser = new GramParser(new GramTokenizer(new StringReader(data), new StringSliceProvider(data)));
                RuleCollection rules  = parser.ParseFile();
                ParserCompiler pc     = new ParserCompiler(rules);
                rules.Compile(pc);
                using (StreamWriter sw = new StreamWriter(outf))
                {
                    CSharpWriter csw = new CSharpWriter(sw);
                    csw.WriteLine("using DatAdmin;");
                    rules.GenCode(csw, ns, cls);
                }
            }
        }
Beispiel #3
0
 public RuleCompiler(ParserCompiler pc, ChainRule rule)
 {
     Rule = rule;
     PC   = pc;
 }
Beispiel #4
0
 public override void Compile(ParserCompiler pc)
 {
     m_compiler = new RuleCompiler(pc, this);
     m_compiler.Compile();
 }
Beispiel #5
0
 public virtual void Compile(ParserCompiler pc)
 {
 }