#59implement identifier names for codegen

  • avatar~clovercommented · 2 years ago
    Author
    Owner
    • store identifier hints in Teg (likely give each instruction an associated identifier)
    • pass along these "identifier hints" in Sema. these hints should be simple u32s, which index into the Teg string_bytes (as a null terminated string)
    • JsNodeGen will create a "symbol table", which is a list of strings of the names it decides to use.
    • JsLink can combine these into a symbol table table (better name pending), in which it can use a system similar to esbuild's Ref in order to point to other JsTrees

    the visible output of this work is code like

    fn hello(x: int) -> int {
      let y = x * x;
      let z = y * y;
      z
    }
    

    is this output

    let hello = x => {
      let y = x * x;
      return y * y;
    }
    

    instead of

    let hello = v0 => {
      let v1 = v0 * v0;
      return v1 * v1;
    }
    

    Milestone: 0.3.0.

  • avatar~clover changed the status to Todo · 2 years ago