Here are some goals:
Learning stuff
This is by far the biggest goal. I didn’t super understand all the ins and outs of compilers. I still don’t but at least I have a way to learn now. You shouldn't use talktalk. But you might enjoy perusing talktalk.
Fully typed everything
Types are cool.
As much type inference as possible
I don’t know if it's a good idea. It’s probably not. I just think it’s neat.
Familiar-ish syntax
Haskell/ML-y syntax is beautiful. I hate it.
Figure out nice syntax highlighting color schemes
I feel like making full programming language is the only way to do this, right? Right? Don't answer that.
Here are some non-goals:
Blazingly fast performance?
I mean I’m probably not gonna litter the codebase with sleeps but I’m allowed to if I want.
Trying to make everything perfectly sound and decidable?
Is this even possible? I feel like I saw a YouTube video that said it’s not.
Trying to get others to use it?
Why? PHP exists, you should probably use that.
--
How it works1
First we parse the code into a tree. Then we resolve the names in the tree. Then we elaborate the tree into a core language, which is where the type checking happens. Then a lint pass checks the core is well typed, effects and all. Then the core gets one copy of everything per type it's used at, and a lil interpreter runs it (or clang compiles it, if you ask nicely). There’s no trick to it, it’s just a simple trick!
At this point you’re cracking your knuckles saying "nice try, wise guy, but you’ll have to do better than that if you want me to adopt this at my fortune 500 company where I do a very good job and that is why they pay me the BIG bucks." Ok ok, call off your goons. Here’s some more detail2.
Parsing
The parser is plain recursive descent, by hand. It turns the source into a tree of items, and it keeps going when your code is half-written, since that's what an editor hands it. The grammar is written out by hand as EBNF too (talk syntax prints it), and a test holds the two together, which is how I find out what I actually implemented.
Name Resolving
At this point we have a tree with things that have names. Like functions, variables, nominals (structs/enums), methods, etc. Those names are all strings. Since different names can be different things at different times, we give every named thing a unique identity so we can tell the difference. The resolver rebuilds the tree with those identities in place of the strings. No side tables. Every pass rebuilds the tree it's given.
Elaboration
This is where I've spent like 90% of my time. Turns out there's a lot of history there. Who knew? The elaborator turns the surface tree into a dependently typed core calculus (call-by-push-value, if you're the kind of person that means something to). Types are values in core, so the type checker is mostly an evaluator. Inference is bidirectional with unification for the parts it can't push down. Effects show up here as rows on function types, and the elaborator figures the rows out from function bodies so you mostly don't write them.
Lint
Core gets checked one more time, on its own terms, so that when the elaborator is wrong about something (it happens) the interpreter never sees it.
Running
First the core is monomorphized: one copy of each definition for each type it's used at. Then the interpreter runs it on an abstract machine (CEK, if you're still that kind of person). The interpreter is written in talktalk itself, compiled natively and carried inside the talk binary. Effect handlers are real continuations. Values have no identity except cells, which are refcounted, and cycles pass only through cells, so those are collected by trial deletion. Or talk build lowers the same program to LLVM IR and hands it to clang, and you get a native executable. That backend is written in talktalk too.
--
At this point you’re rubbing your hands together thinking “mamma mia! I’m about to make a million smackaroos using talktalk!” Well you probably are. But before you start firing up your local AI coding buddy you should know what’s still not there yet.
Lazy iterators
map, filter, and friends are there, but they're eager: every step hands you a whole new array. If you want one thing at a time, write your own iterator (see the tour).
Documentation
Some. This website, mostly.
So anyway, maybe you can see what I meant by "don't use this, peruse this."