Hacker News new | ask | show | jobs
by dunham 124 days ago
My little language Newt is 7 kloc. Dunno if it's worth including, it's mostly an exercise to learn how these things work and is not as polished as I'd like.

- Self-hosted

- Compiles to javascript

- Bidirectional typechecking with NbE (based on elaboration zoo)

- Dependent type checking

- type classes

- ADTs with dependent pattern matching

- TCO (trampoline for mutually tail recursive functions)

- Erasure of compile-time only values (0, ω quantities, but not linear)

- Web playground

- LSP (added this month)

- Syntax is similar to Agda / Idris / Haskell

https://github.com/dunhamsteve/newt

1 comments

Either newt was already in the list, or it got added. We talked a bit about using our languages for AoC 2024 -- looks like you've been keeping busy working on it!
Yeah it has been fun. Lots of directions I can take it:

Since I have an LSP, I've got faster turn around and can add editor functionality that requires poking at the compile state. That's my current thread.

I have a C backend on hold, while I think about how I want to represent data without boxing everything and about whether I want to do reference counting or GC. (Reference counting unlocks "counting immutable beans" if I decide to give that a go, but I'd also like to try implementing GC someday.)

I should do some browser interop stuff and write something other than a compiler in my language.

And there are language enhancements: implementing "Do unchained" from Lean, automatic handling of lazy and/or async modalities, deriving implementations of classes, ...