Skip to content

Initial development plan

Eric Mertens edited this page Aug 7, 2017 · 1 revision

This list is how I'm looking at our initial set of components, tasks, and questions. We can tackle the AST extraction and initial Corrode port in parallel.

Components

  • clang-based AST extraction
  • rust-based C-AST to Rust translation
  • Rust to Rust refactoring tool

Initial tasks

  • Define the desired C AST and C-type representation on the Rust side

    • Evaluate clang's ASCII dump output
    • Identify missing information in AST dump
    • Determine ideal C type representation on Rust side
    • Determine C AST representation on Rust side
  • Evaluate CastXML for export as alternative to custom tool

  • Determine portable serialization format

    • Evaluate protobuf and cbor (others?) for library support in C++ and Rust
  • Implement clang-based AST export tool

    • AST serialization tool in terms of clang frontend.
    • Use csmith to gain confidence in coverage of C syntax
  • Implement Rust-side deserialization

    • Depends on AST and type representation decisions
  • Begin porting Corrode to Rust

    • Depends on AST and type representation decisions
  • Build "symbol map" functionality

    • Identify components that need external decisions made during export
    • Determine file format for symbol map
  • Determine solution for null function pointers

    • Can we create a distinguished null function that we use instead of NULL? We'd need to handle zero-initializers and detect comparison to NULL at function pointer types.

      void null_function(void) { abort(); }
      void(*null_function_ptr)(void) = &null_function;
    • Intelligently wrap some function pointers in optional

    • Wrap all function pointers in optional

  • Establish a solution for tracking macros and comments.

    • Preserve macro information in clang.
    • Preserve comments with source locations.
Clone this wiki locally