コード例 #1
0
ファイル: CParser.cs プロジェクト: gh0std4ncer/reko
 public CParser(ParserState parserState, CLexer lexer)
 {
     this.ParserState = parserState;
     this.lexer = new LookAheadLexer(
         new CDirectiveLexer(parserState, lexer));
     this.grammar = new CGrammar();
 }
コード例 #2
0
        public void Convert()
        {
            var lexer        = new CLexer(rdr);
            var parser       = new CParser(parserState, lexer);
            var declarations = parser.Parse();
            var symbolTable  = new SymbolTable(platform)
            {
                NamedTypes =
                {
                    { "size_t",  new PrimitiveType_v1 {
                          Domain = Domain.UnsignedInt, ByteSize = 4
                      } },                                                                               //$BUGBUG: arch-dependent!
                    { "va_list", new PrimitiveType_v1 {
                          Domain = Domain.Pointer, ByteSize = platform.PointerType.Size
                      } }
                }
            };

            foreach (var decl in declarations)
            {
                symbolTable.AddDeclaration(decl);
            }

            var lib = new SerializedLibrary
            {
                Types      = symbolTable.Types.ToArray(),
                Procedures = symbolTable.Procedures.ToList(),
            };
            var ser = SerializedLibrary.CreateSerializer();

            ser.Serialize(writer, lib);
        }
コード例 #3
0
ファイル: XmlConverter.cs プロジェクト: mmyydd/reko
        public void Convert()
        {
            var lexer        = new CLexer(rdr);
            var parser       = new CParser(parserState, lexer);
            var declarations = parser.Parse();

            foreach (var decl in declarations)
            {
                decl.Accept(this);
            }

            var lib = new SerializedLibrary
            {
                Types      = Types.ToArray(),
                Procedures = procs.ToList(),
            };
            var ser = SerializedLibrary.CreateSerializer();

            ser.Serialize(writer, lib);
        }
コード例 #4
0
ファイル: CDirectiveLexer.cs プロジェクト: mmyydd/reko
 public CDirectiveLexer(ParserState state, CLexer lexer)
 {
     this.state     = state;
     this.lexer     = lexer;
     this.tokenPrev = new CToken(CTokenType.EOF);
 }
コード例 #5
0
ファイル: CDirectiveLexer.cs プロジェクト: gh0std4ncer/reko
 public CDirectiveLexer(ParserState state, CLexer lexer)
 {
     this.state = state;
     this.lexer = lexer;
     this.tokenPrev = new CToken(    CTokenType.EOF);
 }