We continue building our own programming language from scratch.
In the previous session, we introduced variables — they could be declared, reference one another, and were resolved through a global hash table. Now it's time to add one of the core building blocks of any language: functions. Implementing functions is really a story about scopes and name resolution. We'll explore how identifiers are looked up across different scope levels: the global scope, function scopes with their own variables, and nested local scopes inside function bodies. What happens when the same variable name exists in multiple scopes? How does the compiler determine which one to use?
In this video, we will walk through the implementation step by step, demonstrating how functions, scopes, and symbol lookup are built in code using C++. Along the way, you'll gain a deeper understanding of one of the fundamental mechanisms behind modern programming languages. Have fun watching this video and coding :)
0