Progress report in Pen programming language

October 2, 2022

@raviqqe

Agenda

  • Progress report
    • String concatenation
    • Debug function
  • Next plans

Progress report

String concatenation

  • Pen now has a string concatenation operator (+.)
  • Multiple string concatenations are batched into one.
concatenateStrings = \(ss [string]) string {
  if [s, ...ss] = ss {
    s() + concatenateStrings(ss)
  } else {
    ""
  }
}

Debug function

  • debug built-in function pretty-prints values of any types.
    • \(any) none
  • Work is still in progress.
    • Primitive, record, and union types are done.
foo = \() none {
  xs = [number 1, 2, 3]

  debug(xs)
}

Output:

[number 1, 2, 3]

Type information

  • Pen compiles AST -> HIR -> MIR -> F-- -> LLVM IR -> assembly.
  • Pen previously had no HIR-level type information.
    • But only at the MIR level.
  • We need to inject custom type information for reflection from HIR to MIR.
    • e.g. debug function

Type information

Internal representation

Variants:

offset (words) data
0 pointer to type information
1 payload

Type information

Internal representation

Type information:

offset (words) data type
0 Clone function (payload) -> payload
1 Drop function (payload) -> ()
2 Synchronize function (payload) -> ()
3 Custom function () -> something

Next plan

  • Bug fixes on macOS
  • Refactoring...

Summary

  • Progress
    • String concatenation
    • Debug function
  • Next plans