Discussion
Loading...

Discussion

  • About
  • Code of conduct
  • Privacy
  • Users
  • Instances
  • About Bonfire
alcinnz
@alcinnz@floss.social  ·  activity timestamp 18 hours ago

Looking at the next component of Hare's self-hosted parser... I'm afraid that its very much in a state of incompletion! There's TODOs everywhere! I'll discuss their proper implementation (written in C) later, but today I'll coarsely describe this "hare::unit" module.

A linked-stack of closed-hashmaps + arrays of variables, alongside how each "scope" was declared. Each variable tracking its type, hash, mutability, name, & type. Alongside routines to manipulate this data.

1/?

  • Copy link
  • Flag this post
  • Block
alcinnz
@alcinnz@floss.social replied  ·  activity timestamp 17 hours ago

There's also a "context" type tracking not just that scopes stack but also a function signature & type store. Its error type isn't very meaningful yet.

There's types representing a successfully type-checked expression, annotating the AST with the implicit types.

There's a "process" routine for branching over all declarations in the dependencies & recursively their expressions, looking up the types & identifiers.

A "scan" routine works similarly, but is even more incomplete.

2/2.1!

  • Copy link
  • Flag this comment
  • Block
alcinnz
@alcinnz@floss.social replied  ·  activity timestamp 17 hours ago

There's structs representing typechecked functions & sourcefiles.

And there's a wrapper combining the "process" & "scan" steps.

2.2/2.2 Fin for today! Tomorrow: Unparsing!

  • Copy link
  • Flag this comment
  • Block
Log in

bonfire.cafe

A space for Bonfire maintainers and contributors to communicate

bonfire.cafe: About · Code of conduct · Privacy · Users · Instances
Bonfire social · 1.0.0-rc.3.26 no JS en
Automatic federation enabled
  • Explore
  • About
  • Members
  • Code of Conduct
Home
Login