Progress report in Pen programming language

March 20th, 2022

@raviqqe

Agenda

  • Progress report
    • Built-in map type
    • JSON package
  • Next plans

Progress report

Built-in map type

Pull requests

Built-in map type (continued)

Functionalities

  • Hash Array Mapped Trie
    • Implementation migrated from a Core package to a Prelude package
  • Deterministic iteration
    • Multi-layer HAMT for hash collision resolution
  • Key types need to be comparable.
    • Eq/Hash trait equivalents in Rust are implemented automatically.
  • Map types are comparable as long as they do not contain any types not comparable.

Built-in map type (continued)

Examples

Types

{string: number} # String-to-number map
{[string]: number} # Lists can be keys!
{{string: number}: number} # Maps can be keys!

Built-in map type (continued)

Examples

Expressions

{string: number} # Empty map
{string: number "foo": 1, "bar": 2} # With entries
{string: number ...xs, "foo": 1} # Insertion
{string: number ...xs, "foo"} # Deletion
{string: number ...xs, ...ys} # Merging

# Indexing
if x = xs["foo"] {
  x
} else {
  error("key not found")
}

JSON package

  • Pull request: #851
    • Work in progress
  • Parsing/formatting
  • Parsing is almost done other than the parts we need map types.
    • Handwritten LL(1) parser
    • No lexer for now

Next plans

  • Upgrade to LLVM 14
    • The final RC is released last week.
    • Hopefully, next week?
  • Additional map type features
    • List comprehension integration
    • Map comprehension (?)

Summary

  • Progress
    • Built-in map type
    • JSON package
  • Future plans
    • LLVM 14
    • More language features for map types