public CParser(ParserState parserState, CLexer lexer) { this.ParserState = parserState; this.lexer = new LookAheadLexer( new CDirectiveLexer(parserState, lexer)); this.grammar = new CGrammar(); }
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); }
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); }
public CDirectiveLexer(ParserState state, CLexer lexer) { this.state = state; this.lexer = lexer; this.tokenPrev = new CToken(CTokenType.EOF); }
public CDirectiveLexer(ParserState state, CLexer lexer) { this.state = state; this.lexer = lexer; this.tokenPrev = new CToken( CTokenType.EOF); }