Urgent.News

What's breaking now, across thousands of outlets.

Tech

Let's make a programming language. Functions—Key points

We continue the development of our toy programming language. In this episode, our speaker Yuri demonstrates how to implement functions and explains how functions, scopes, and symbol lookup are built in code using C++. About the speaker Yuri Minaev is an experienced C++ developer, architect at PVS-Studio, and a recognized voice in the C++ community who has spoken at CppCast, C++ on Sea, and…

In the latest episode of the "Let's make a programming language" series, Yuri Minaev, a C++ developer and architect at PVS-Studio, demonstrates how to implement functions in the toy language using C++. Functions introduce multiple scopes and different levels of name visibility, with names declared inside a function being inaccessible outside it while names from parent scopes remain accessible.

Parsing functions involves declaring them with the 'fn' keyword, specifying parameters, and defining a compound statement containing the function body. Functions are parsed in two stages: declaration and body processing. The semantic analyzer determines a function's return type from return statements, checks compatibility, and adds implicit casts when necessary.

An empty function with no return statements gets the void type. The talk concludes with functions implemented and introduces the evaluator as the next step.

Brief written by urgent.news from Dev.to's own syndicated text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

SubScale vs Rocket Money vs Bobby: Which Subscription Tracker Actually Protects Your Privacy?

Subscription trackers all promise the same thing: stop losing money to forgotten renewals. But they take very different approaches to your data to get there — and that difference matters more than…

  • Rocket Money connects to bank accounts via Plaid, automatically detecting subscriptions.
  • Manual trackers Bobby and SubScale require user input, eliminating bank data sharing.
  • SubScale markets itself as completely privacy-focused, with no data linked to user identity.

While Microsoft Is Busy Learning Rust, I'm Rebuilding .NET for WASI

Apparently Stephen Toub is busy with Rust now, so I've decided to cover his .NET shift. Okay, that's a tongue in cheek obviously.

  • Stephen Toub migrated GitHub Copilot's agent runtime from TypeScript to Rust
  • Author developing independent .NET compiler, CoreLib, and runtime for WASI
  • NetWasm provides native executables without conventional .NET runtime

More from Wednesday 23 September →